InternalErrorException Could not load dynamic library Codec_STBI Topic is solved

Problems building or running the engine, queries about how to use features etc.
niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

Ogre Version: 14.3.1
Operating System: Windows 10
Render System: :?:

Good day everyone,

I am getting this error when opening the SampleBrowser.exe.

InternalErrorException: Could not load dynamic library D:/Projects/Ogre3D/ogre/build/bin/\.Codec_STBI. System Error: The specified module could not be found. in DynLib::load at D:\Projects\Ogre3D\ogre\OgreMain\src\OgreDynLib.cpp (line 136)

Image

Can someone help me how to debug this or figure out what the issue is?
I've searched in Google and don't see any relevant topic.

This is my environment

Code: Select all

$ cmake --version
cmake version 3.30.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ g++ -v

Using built-in specs.
COLLECT_GCC=C:\x86_64-14.2.0-release-posix-seh-msvcrt-rt_v12-rev0\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/x86_64-14.2.0-release-posix-seh-msvcrt-rt_v12-rev0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/14.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-14.2.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/buildroot/x86_64-1420-posix-seh-msvcrt-rt_v12-rev0/mingw64 --enable-host-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libssp --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-Builds project' --with-bugurl=https://github.com/niXman/mingw-builds LD_FOR_TARGET=/c/buildroot/x86_64-1420-posix-seh-msvcrt-rt_v12-rev0/mingw64/bin/ld.exe --with-boot-ldflags='-pipe -fno-ident -L/c/buildroot/x86_64-1420-posix-seh-msvcrt-rt_v12-rev0/mingw64/opt/lib -L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib  -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.2.0 (x86_64-posix-seh-rev0, Built by MinGW-Builds project)
You do not have the required permissions to view the files attached to this post.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by sercero »

Hello,

Did you do a "make install"?

Another thing, do you have the file "Codec_STBI.dll" in the directory "D:/Projects/Ogre3D/ogre/build/bin/"?

I have reviewed the files you attached and it seems that you did build with STBI support...

I'm also using MinGW so it should work, but I have not yet compiled OGREs latest version.

I will try it tonight to see if I encounter the same problems...

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

sercero wrote: Sun Nov 03, 2024 2:43 pm

Did you do a "make install"?

Sorry I am not familiar with Windows + MinGW but I tried mingw32-make install.
I still get the same error when opening the SampleBrowser.exe. This is the output

mingw_make.txt

.

sercero wrote: Sun Nov 03, 2024 2:43 pm

I have reviewed the files you attached and it seems that you did build with STBI support...

I am just using the default configuration as I am following the tutorial from ogre website but with MinGW.

sercero wrote: Sun Nov 03, 2024 2:43 pm

Another thing, do you have the file "Codec_STBI.dll" in the directory "D:/Projects/Ogre3D/ogre/build/bin/"?

Yes the files exist. This is the build directory.

Code: Select all

$ ls -lah
total 200M
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  3 22:07 .
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:41 ..
-rw-r--r-- 1 niceprogrammer 197121 134M Nov  2 04:44 3.25.tar.gz
-rw-r--r-- 1 niceprogrammer 197121  45K Nov  2 04:45 CMakeCache.txt
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  3 22:07 CMakeFiles
-rw-r--r-- 1 niceprogrammer 197121 3.9K Nov  2 04:45 CPackConfig.cmake
-rw-r--r-- 1 niceprogrammer 197121 4.3K Nov  2 04:45 CPackSourceConfig.cmake
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 Components
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:43 Dependencies
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 Docs
-rw-r--r-- 1 niceprogrammer 197121 1.1K Nov  2 04:45 LICENSE.txt
-rw-r--r-- 1 niceprogrammer 197121  20K Nov  2 04:45 Makefile
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 OgreMain
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 PlugIns
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 RenderSystems
drwxr-xr-x 1 niceprogrammer 197121    0 Jun 18 03:35 SDL2-2.30.4
-rw-r--r-- 1 niceprogrammer 197121 7.2M Nov  2 04:42 SDL2-2.30.4.tar.gz
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:43 SDL2-build
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 Samples
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 Tools
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:43 assimp-5.4.3
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  3 21:37 bin
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:44 bullet3-3.25
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:44 cmake
-rw-r--r-- 1 niceprogrammer 197121  11K Nov  2 04:45 cmake_install.cmake
drwxr-xr-x 1 niceprogrammer 197121    0 Aug 26  2023 freetype-2.13.2
-rw-r--r-- 1 niceprogrammer 197121 3.7M Nov  2 04:41 freetype-2.13.2.tar.gz
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 imgui-1.91.2
-rw-r--r-- 1 niceprogrammer 197121 1.7M Nov  2 04:45 imgui.tar.gz
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:45 include
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:44 inst
-rw-r--r-- 1 niceprogrammer 197121 141K Nov  3 22:07 install_manifest.txt
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 05:08 lib
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:44 pkgconfig
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:41 pugixml-1.14
-rw-r--r-- 1 niceprogrammer 197121 383K Nov  2 04:41 pugixml-1.14.tar.gz
-rw-r--r-- 1 niceprogrammer 197121 2.8K Nov  2 04:44 sample_resources.cfg
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  3 22:07 sdk
-rw-r--r-- 1 niceprogrammer 197121  52M Nov  2 04:43 v5.4.3.tar.gz
-rw-r--r-- 1 niceprogrammer 197121    8 Nov  2 04:41 version.txt
drwxr-xr-x 1 niceprogrammer 197121    0 Nov  2 04:43 zlib-1.3.1
-rw-r--r-- 1 niceprogrammer 197121 1.5M Nov  2 04:43 zlib-1.3.1.tar.gz
sercero wrote: Sun Nov 03, 2024 2:43 pm

I'm also using MinGW so it should work, but I have not yet compiled OGREs latest version.

I will try it tonight to see if I encounter the same problems...

I am a beginner but I was able to compile on Linux months ago (Arch). Now I want to use Windows. Thank you very much for helping out!

You do not have the required permissions to view the files attached to this post.
rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

You can try to follow my guide here to build Ogre using CMake GUI instead:
viewtopic.php?p=554037#p554037

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Mon Nov 04, 2024 3:03 am

You can try to follow my guide here to build Ogre using CMake GUI instead:
viewtopic.php?p=554037#p554037

I wanted to use VS Code+MinGW and not Visual Studio though as I felt I can learn better that way but I tried VS Studio and getting errors.
I installed the "Desktop Development with C++" but removed a few stuff like copilot using for VS Studio Installer.

Image

I configure with default native compilers.

Image

Image

I get this error

Code: Select all

The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:66 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:66 (project):
  No CMAKE_CXX_COMPILER could be found.



Configuring incomplete, errors occurred!

I tried to look up some solutions online and saw some people checking the cmake log file but I don't see a cmake log file in the ogre dir, ogre build dir, and cmake install dir.

I am guessing the issue is my CMake GUI is installed separately from VS Studio and VS Studio has its own CMake? I did not see CMake GUI in the VS Studio installation.

Apologies if my issues and questions seems basic.

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

I am guessing the issue is my CMake GUI is installed separately from VS Studio and VS Studio has its own CMake?

I have never installed CMake or its GUI from any Visual Studio installation, I just installed mine as a standalone.

Are you sure you used x64? Because your image seems to have an empty field there? Your image also seem to be a bit cut off in its combobox/textbox, like something is wrong.

That guide is tested and it works for almost any version of Ogre, except for very old ones or some that have broken links to dependencies.

Record a small video of how you are doing it if you still have errors.

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 479
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 167

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by sercero »

In the screenshot where it says in CMake:

Optional platform for generator (if empty, generator uses: x64)

Why is there an "I" or a pipe character?

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Tue Nov 05, 2024 4:18 am

Are you sure you used x64? Because your image seems to have an empty field there? Your image also seem to be a bit cut off in its combobox/textbox, like something is wrong.

sercero wrote: Tue Nov 05, 2024 12:31 pm

Why is there an "I" or a pipe character?

I left it empty. The symbol inside is just the cursor.

rpgplayerrobin wrote: Tue Nov 05, 2024 4:18 am

Record a small video of how you are doing it if you still have errors.

I pretty much just did this.
:!: New screenshots

  1. Create a "build" dir inside the ogre dir

  2. Enter the ogre dir in "Where is the source code" field

  3. Enter the build dir in "Where to build the binaries" field

  4. Click "Configure"
    Image

  5. Select the "Visual Studio 17 2022" in "Specify the generator for this project"

  6. Leave the "Optional platform for generator (if empty, generator uses: x64" field empty

  7. Leave the "Optional toolset to use (argument to -T)" field empty

  8. Select "Use default native compilers"

  9. Click "Finish"
    Image

  10. Error shows
    Image

    Code: Select all

    The C compiler identification is unknown
    The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt:66 (project):
      No CMAKE_C_COMPILER could be found.
    
    
    
    CMake Error at CMakeLists.txt:66 (project):
      No CMAKE_CXX_COMPILER could be found.
    
    
    
    Configuring incomplete, errors occurred!

Using "MinGW Makefiles" works okay in CMake GUI or in CLI.

Image

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

It seems it is just not finding the compiler?

If I press configure and go through what compiler to use, it creates a file specifying where the .exe file is for the compiler at "ogre-14.3.1\build\CMakeFiles\3.18.2\CMakeCCompiler.cmake" for me.

There I can see it sets it in the first line:
set(CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe")

Does your file there actually exist if you go to it?

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Wed Nov 06, 2024 5:31 pm

It seems it is just not finding the compiler?

If I press configure and go through what compiler to use, it creates a file specifying where the .exe file is for the compiler at "ogre-14.3.1\build\CMakeFiles\3.18.2\CMakeCCompiler.cmake" for me.

There I can see it sets it in the first line:
set(CMAKE_C_COMPILER "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe")

Does your file there actually exist if you go to it?

When I choose "Specify native compilers" C Compiler is empty and this is for C++ Compiler.

Code: Select all

C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools/VsDevCmd.bat

Image

Image

I put "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx86/x64/cl.exe" in C compiler field and got a new error.
Image

Image

Code: Select all

The C compiler identification is unknown
The CXX compiler identification is unknown
Detecting C compiler ABI info
Detecting C compiler ABI info - failed
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx86/x64/cl.exe
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx86/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx86/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'D:/Projects/Ogre3D/ogre/build/CMakeFiles/CMakeScratch/TryCompile-xk9huc'
    
    Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_56ad7.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n
    MSBuild version 17.11.9+a69bbaaf5 for .NET Framework

    Build started 11/7/2024 3:48:06 AM.

    

    Project "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj" on node 1 (default targets).

    PrepareForBuild:

      Creating directory "cmTC_56ad7.dir\Debug\".

    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(513,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found. [D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj]

      Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.

      Creating directory "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\Debug\".

      Creating directory "cmTC_56ad7.dir\Debug\cmTC_56ad7.tlog\".

    InitializeBuildStatus:

      Creating "cmTC_56ad7.dir\Debug\cmTC_56ad7.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

      Touching "cmTC_56ad7.dir\Debug\cmTC_56ad7.tlog\unsuccessfulbuild".

    ClCompile:

      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\CL.exe /c /W1 /WX- /diagnostics:column /D _MBCS /D "CMAKE_INTDIR=\"Debug\"" /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_56ad7.dir\Debug\\" /Fd"cmTC_56ad7.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\testCCompiler.c"

      Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34123 for x64

      Copyright (C) Microsoft Corporation.  All rights reserved.

      cl /c /W1 /WX- /diagnostics:column /D _MBCS /D "CMAKE_INTDIR=\"Debug\"" /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_56ad7.dir\Debug\\" /Fd"cmTC_56ad7.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\testCCompiler.c"

      testCCompiler.c

    Link:

      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx86\x64\link.exe /ERRORREPORT:QUEUE /OUT:"D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\Debug\cmTC_56ad7.exe" /INCREMENTAL /ILK:"cmTC_56ad7.dir\Debug\cmTC_56ad7.ilk" /NOLOGO /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"D:/Projects/Ogre3D/ogre/build/CMakeFiles/CMakeScratch/TryCompile-xk9huc/Debug/cmTC_56ad7.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:/Projects/Ogre3D/ogre/build/CMakeFiles/CMakeScratch/TryCompile-xk9huc/Debug/cmTC_56ad7.lib" /MACHINE:X64 cmTC_56ad7.dir\Debug\testCCompiler.obj

    LINK : fatal error LNK1104: cannot open file 'kernel32.lib' [D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj]

    Done Building Project "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj" (default targets) -- FAILED.

    

    Build FAILED.

    

    "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj" (default target) (1) ->

    (PrepareForBuild target) -> 

      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(513,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found. [D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj]

    

    

    "D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj" (default target) (1) ->

    (Link target) -> 

      LINK : fatal error LNK1104: cannot open file 'kernel32.lib' [D:\Projects\Ogre3D\ogre\build\CMakeFiles\CMakeScratch\TryCompile-xk9huc\cmTC_56ad7.vcxproj]

    

        1 Warning(s)

        1 Error(s)

    

    Time Elapsed 00:00:00.29

    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:66 (project)


Configuring incomplete, errors occurred!
rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

I have no idea what this can be, as it seem your compiler is simply just not working.

ChatGPT seem to think you have not installed Visual Studio 2022 correctly, and suggests to Modify the installation to be 100% sure the Windows SDK is actually included in it:
https://chatgpt.com/share/672bf55b-c4ec ... ea556f3246

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

Actually, ChatGPT is correct.
Even your image showing what you installed shows that you did not install any Windows SDK at all:
Image

So in short, this issue most likely only has to do with how you installed Visual Studio and not anything regarding CMake.

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Thu Nov 07, 2024 3:55 am

Actually, ChatGPT is correct.
Even your image showing what you installed shows that you did not install any Windows SDK at all:
Image

So in short, this issue most likely only has to do with how you installed Visual Studio and not anything regarding CMake.

CMake "Configure" now worked after installing C++ Win SDK.

cmake_configure_after_installing_win_sdk.txt
cmake_generate.txt

Image

As mentioned in this thread, "Debug" would have errors but "Release" will build completely.

rpgplayerrobin wrote: Mon Nov 04, 2024 3:03 am

You can try to follow my guide here to build Ogre using CMake GUI instead:
viewtopic.php?p=554037#p554037

ALL_BUILD_vs_errors.txt

This is the "D:\Projects\Ogre3D\ogre\build\bin\debug\SampleBrowser_d.exe".
Image


This is the "SampleBrowser.exe" after building "Release". Some samples have errors some works.
Image

Image

Is this Debug (with errors) and Release (some samples not working) build still usable for working on a project?

You do not have the required permissions to view the files attached to this post.
rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

Is this Debug (with errors) and Release (some samples not working) build still usable for working on a project?

Yes.
I use that failed debug build even in my game and it works since I don't even use those projects that fail (assimp for example).
If your release build fails on just some samples, you can most likely just ignore it.

Even debugging things inside Ogre code works (like when pressing F11 to go into an Ogre function in my own project) if you set up your project correctly.

Just make sure the .dll files you need are actually generated for both debug and release.

These are the ones that I require for my project from Ogre:
Codec_STBI.dll
OgreMain.dll
OgreMeshLodGenerator.dll
OgreOverlay.dll
Plugin_OctreeSceneManager.dll
Plugin_ParticleFX.dll
RenderSystem_Direct3D9.dll
RenderSystem_Direct3D11.dll
SDL2.dll
zlib.dll

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

I don't even use those projects that fail (assimp for example)

I see. I thought Assimp is the backbone for loading 3D assets like glb/gltf, fbx, etc. I am planning on trying to figure out the workflow for Blender to Ogre.

I guess that's a wrap for now for this thread.
Any new issues/questions would probably be off-topic.
I was not able to use MinGW as I planned but VS Studio is fine as well.
If I have more questions I'd make new thread.

Thank you very much @rpgplayerrobin , @sercero for spending time on helping.

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

I thought Assimp is the backbone for loading 3D assets like glb/gltf, fbx, etc.

I would not call it a backbone. There are Ogre exporters already for Maya, Max and Blender. Those export using the actual format needed by Ogre (.mesh/.skeleton).

What Assimp is doing is converting arbitrary formats into the Ogre format, but that is of course not as optimized as just having them pre-exported from the programs themselves with the Ogre exporter.

I would not see any reason a game needs to use Assimp, unless it is for importing assets for user created content in a more friendly manner that supports more formats.

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Thu Nov 07, 2024 11:46 pm

I thought Assimp is the backbone for loading 3D assets like glb/gltf, fbx, etc.

I would not call it a backbone. There are Ogre exporters already for Maya, Max and Blender. Those export using the actual format needed by Ogre (.mesh/.skeleton).

What Assimp is doing is converting arbitrary formats into the Ogre format, but that is of course not as optimized as just having them pre-exported from the programs themselves with the Ogre exporter.

I would not see any reason a game needs to use Assimp, unless it is for importing assets for user created content in a more friendly manner that supports more formats.

I see. Thanks for the info.

These are the Projects that failed.

  1. OgreXMLConverter
  2. OgreBullet
  3. Codec_Assimp
  4. Plugin_DotScene

All these are fine?

Debug_vs_build_errors.txt
You do not have the required permissions to view the files attached to this post.
rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

OgreXMLConverter:
You will only need to use it if you are going to upgrade meshes. But if you just export them correctly with the right mesh file format you will never have to use that.

OgreBullet:
If you want this as your physics system, I would check why it does not work. I am not using OgreBullet though.

Plugin_DotScene:
If you want something that imports a whole scene for you from another program or something, it is good to have. But I do not use it myself.

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

I am not sure if I should create a new thread but for now I will post this here.

I created a new "CMake Project" in VS Studio but the sdk seems to be referring to the original ogre repository when finding the resources instead of checking relatively. I am guessing the paths are compiled statically into the output libraries?

This is the logs when running the new "CMake Project".
Image

Code: Select all

Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media' of type 'FileSystem' to resource group 'General'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Main' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Terrain' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/RTShaderLib' of type 'FileSystem' to resource group 'OgreInternal'

What I did was after building the "INSTALL" project on my ogre repository, I copied the "sdk" output folder to my new CMake Project.
I don't know how to link the sdk to my CMake Project so I added it on my windows environment "PATH" for now as suggested in https://ogrecave.github.io/ogre/api/lat ... tupRunning.

On Linux you will typically install these into /usr/local/ which is automatically searched by the linker, so nothing more to do. On Windows however, you will have to either add the sdk/bin folder to PATH or copy your executable into sdk/bin.

Maybe this is the wrong way to do it?

Image


I found this behavior as I was tracing Ogre::FileNotFoundException.

Image

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

Code: Select all

Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media' of type 'FileSystem' to resource group 'General'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Main' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Terrain' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/RTShaderLib' of type 'FileSystem' to resource group 'OgreInternal'

Check the "resources.cfg" file if you can just change them there to relative. Otherwise, debug the code where this actually happens, because there is no need for absolute file paths.

I don't know how to link the sdk to my CMake Project

You should not add those files to visual studio that way, I would remove them if I were you.

Here is how I link my project to my built Ogre SDK built from source:
Project -> Properties -> C/C++ -> General -> Additional Include Directories:
C:\OgreSDK\include\OGRE
C:\OgreSDK\include\OGRE\Overlay
C:\OgreSDK\include
C:\OgreSDK\include\OGRE\MeshLodGenerator

Project -> Properties -> Linker -> General -> Additional Library Directories:
C:\OgreSDK\ogre\build\lib\$(Configuration)
C:\OgreSDK\ogre\build\Dependencies\lib

Then you also need to copy all the .dll files you want to use to where your .exe file is, and I use these (the _d are for your debug directory instead):

Code: Select all

Codec_STBI_d.dll
Codec_STBI.dll

OgreMain_d.dll
OgreMain.dll

OgreMeshLodGenerator_d.dll
OgreMeshLodGenerator.dll

OgreOverlay_d.dll
OgreOverlay.dll

Plugin_OctreeSceneManager_d.dll
Plugin_OctreeSceneManager.dll

Plugin_ParticleFX_d.dll
Plugin_ParticleFX.dll

RenderSystem_Direct3D9_d.dll
RenderSystem_Direct3D9.dll

RenderSystem_Direct3D11_d.dll
RenderSystem_Direct3D11.dll

zlib.dll
zlib.dll

I also have a bat file that copies those automatically to all my projects that should use the Ogre source, since otherwise it would be very hard to have to manually copy all of them each time I alter something in the Ogre source code (which does happen time to time), but that bat file is too specific to post here.

Note that I usually gather my files with a bat file to easily be able to get everything in one place. Below is a bat file to gather all include files and directories into a single place (which is needed if you use the same Additional Include Directories as above):

Code: Select all

xcopy /s /v /y "C:\OgreSDK\ogre\OgreMain\include" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\build\include" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\Samples\Common\include\ListenerFactoryLogic.h" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Bites\include" "C:\OgreSDK\include\OGRE\Bites"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\HLMS\include" "C:\OgreSDK\include\OGRE\HLMS"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\MeshLodGenerator\include" "C:\OgreSDK\include\OGRE\MeshLodGenerator"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Overlay\include" "C:\OgreSDK\include\OGRE\Overlay"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Paging\include" "C:\OgreSDK\include\OGRE\Paging"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Property\include" "C:\OgreSDK\include\OGRE\Property"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\RTShaderSystem\include" "C:\OgreSDK\include\OGRE\RTShaderSystem"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Terrain\include" "C:\OgreSDK\include\OGRE\Terrain"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Volume\include" "C:\OgreSDK\include\OGRE\Volume"

xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\BSPSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\BSPSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\CgProgramManager\include" "C:\OgreSDK\include\OGRE\Plugins\CgProgramManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\FreeImageCodec\include" "C:\OgreSDK\include\OGRE\Plugins\FreeImageCodec"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\OctreeSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\OctreeSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\OctreeZone\include" "C:\OgreSDK\include\OGRE\Plugins\OctreeZone"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\ParticleFX\include" "C:\OgreSDK\include\OGRE\Plugins\ParticleFX"
xcopy /s /v /y "C:\OgreSDK\ogre\build\include\OgreParticleFXPrerequisites.h" "C:\OgreSDK\include\OGRE\Plugins\ParticleFX"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\PCZSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\PCZSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\STBICodec\include" "C:\OgreSDK\include\OGRE\Plugins\STBICodec"

xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\Direct3D9\include" "C:\OgreSDK\include\OGRE\RenderSystems\Direct3D9"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\Direct3D11\include" "C:\OgreSDK\include\OGRE\RenderSystems\Direct3D11"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\GL\include" "C:\OgreSDK\include\OGRE\RenderSystems\GL"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\GL3Plus\include" "C:\OgreSDK\include\OGRE\RenderSystems\GL3Plus"



xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zzip" "C:\OgreSDK\include\zzip"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\freetype2\ft2build.h" "C:\OgreSDK\include"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zconf.h" "C:\OgreSDK\include"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zlib.h" "C:\OgreSDK\include"

After all this, you must also include what .h files from Ogre that you might need, and I use these in my Stdafx.h:

Code: Select all

__pragma(warning(push))
__pragma(warning(disable:4305)) // 'initializing': truncation from 'double' to 'const Ogre::Real'
__pragma(warning(disable:4996)) // 'Ogre::Skeleton::getLinkedSkeletonAnimationSourceIterator': was declared deprecated
__pragma(warning(disable:4267)) // 'Ogre::Skeleton::getLinkedSkeletonAnimationSourceIterator': was declared deprecated
#include <Ogre.h>

#include <OgreStringConverter.h>
#include <OgreException.h>

#include "OgreLodConfig.h"
#include "OgreDistanceLodStrategy.h"
#include "OgreMeshLodGenerator.h"

#include <Overlay\OgreOverlaySystem.h>

#include <overlay/OgreOverlay.h>
#include <overlay/OgreOverlayManager.h>
#include <overlay/OgreTextAreaOverlayElement.h>
#include <overlay/OgreBorderPanelOverlayElement.h>
#include <overlay/OgreFontManager.h>
__pragma(warning(pop))

#define OGRE_IGNORE_DEPRECATED_BEGIN __pragma(warning(push)) \
    __pragma(warning(disable:4996))
#define OGRE_IGNORE_DEPRECATED_END __pragma(warning(pop))

// THESE MIGHT NOT WORK FOR YOU, I BUILT SDL2 SPECIFICALLY INSTEAD:
__pragma(warning(push))
__pragma(warning(disable:4244)) // '=': conversion from 'const SDL_FingerID' to 'int', possible loss of data
#include "SDL2/SDL.h"
#include "SDL2/SDL_syswm.h"
__pragma(warning(pop))
niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

rpgplayerrobin wrote: Mon Nov 11, 2024 8:19 am

Check the "resources.cfg" file if you can just change them there to relative. Otherwise, debug the code where this actually happens, because there is no need for absolute file paths.

By output SDK provided resources.cfg with relative paths by default.

Code: Select all

# Ogre Core Resources
[OgreInternal]
FileSystem=../Media/Main
FileSystem=../Media/RTShaderLib
FileSystem=../Media/Terrain/

# Resources required by OgreBites::Trays
[Essential]
Zip=../Media/packs/SdkTrays.zip
Zip=../Media/packs/profiler.zip

# this line will end up in the [Essential] group
FileSystem=../Media/thumbnails

# Common sample resources needed by many of the samples.
# Rarely used resources should be separately loaded by the
# samples which require them.
[General]
# PBR media must come before the scripts that reference it
FileSystem=../Media/PBR
FileSystem=../Media/PBR/filament

FileSystem=../Media/materials/programs/GLSL
FileSystem=../Media/materials/programs/GLSL120
FileSystem=../Media/materials/programs/GLSL150
FileSystem=../Media/materials/programs/GLSL400
FileSystem=../Media/materials/programs/GLSLES
FileSystem=../Media/materials/programs/SPIRV
FileSystem=../Media/materials/programs/Cg
FileSystem=../Media/materials/programs/HLSL
FileSystem=../Media/materials/programs/HLSL_Cg
FileSystem=../Media/materials/scripts
FileSystem=../Media/materials/textures
FileSystem=../Media/materials/textures/terrain
FileSystem=../Media/models
FileSystem=../Media/particle
FileSystem=../Media/DeferredShadingMedia
FileSystem=../Media/DeferredShadingMedia/DeferredShading/post
FileSystem=../Media/PCZAppMedia
FileSystem=../Media/materials/scripts/SSAO
FileSystem=../Media/materials/textures/SSAO
FileSystem=../Media/volumeTerrain
FileSystem=../Media/CSMShadows
Zip=../Media/packs/cubemap.zip
Zip=../Media/packs/cubemapsJS.zip
Zip=../Media/packs/dragon.zip
Zip=../Media/packs/fresneldemo.zip
Zip=../Media/packs/ogredance.zip
Zip=../Media/packs/Sinbad.zip
Zip=../Media/packs/skybox.zip
Zip=../Media/volumeTerrain/volumeTerrainBig.zip

Zip=../Media/packs/DamagedHelmet.zip
Zip=../Media/packs/filament_shaders.zip

[BSPWorld]
Zip=../Media/packs/oa_rpg3dm2.pk3
Zip=../Media/packs/ogretestmap.zip

# Materials for visual tests
[Tests]
FileSystem=../Tests/Media
rpgplayerrobin wrote: Mon Nov 11, 2024 8:19 am

You should not add those files to visual studio that way, I would remove them if I were you.

I was thinking including the dependencies in the repo is a Git friendly approach especially when working with other people (although it is just me :lol: ).

rpgplayerrobin wrote: Mon Nov 11, 2024 8:19 am

Then you also need to copy all the .dll files you want to use to where your .exe file is, and I use these (the _d are for your debug directory instead):

I see I thought the DLL files would be deleted if I run the clean project/solution or rebuild.


I will try your approach on the SDK but manually for now as I am still learning. The resources for me is more of a blocker.

rpgplayerrobin
Gnoll
Posts: 677
Joined: Wed Mar 18, 2009 3:03 am
x 379

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by rpgplayerrobin »

The resources for me is more of a blocker.

Simply debug Ogre to see why they are absolute. It might be a very simple issue.

niceprogrammer
Gnoblar
Posts: 11
Joined: Sat Nov 02, 2024 12:38 pm
x 1

Re: InternalErrorException Could not load dynamic library Codec_STBI

Post by niceprogrammer »

I was not able to debug it properly so I tried dynamically linking Ogre to my project using a guide to see if it works and it did. Previously I was just using Ogre by adding the path to environment variable PATH.

  1. Library Directory:
    Go to Project Properties > Configuration Properties > VC++ Directories > Library Directories and add the path to the Ogre3D lib folder where the dynamic library .lib files are located. For example, OgreBites.dll.lib.
    • D:\Projects\Ogre3D\ogre\build\sdk\lib;D:\Projects\Ogre3D\ogre\build\sdk\lib\OGRE;
  2. Include Directory:
    In Configuration Properties > VC++ Directories > Include Directories, add the path to the Ogre3D include files.
    • D:\Projects\Ogre3D\ogre\build\sdk\include;D:\Projects\Ogre3D\ogre\build\sdk\include\OGRE;D:\Projects\Ogre3D\ogre\build\sdk\include\OGRE\Bites;
  3. Linker Settings:
    In Configuration Properties > Linker > Input > Additional Dependencies, add the appropriate dll.lib files (e.g., OgreBites.dll.lib and Ogre.dll.lib).
    • D:\Projects\Ogre3D\ogre\build\sdk\lib\OgreMain.lib;D:\Projects\Ogre3D\ogre\build\sdk\lib\OgreBites.lib;D:\Projects\Ogre3D\ogre\build\sdk\lib\OgreRTShaderSystem.lib;
  4. Define Preprocessor Macros:
    In Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions, define OGRE_DLL (if you're using the dynamic library).
    • NDEBUG;_CONSOLE;OGRE_DLL;%(PreprocessorDefinitions)
  5. Ensure DLLs are Available at Runtime:
    When distributing your application, make sure to include the required .dll files along with your executable. These .dll files should be in the same folder as the executable or available via the system's PATH.
    • Copy D:\Projects\Ogre3D\ogre\build\sdk\bin\*.* to the .exe locations
    • Copy D:\Projects\Ogre3D\ogre\build\sdk\Media to <Project DIR>\x64\Media alongside Debug and Release DIRs

Image

Image

You do not have the required permissions to view the files attached to this post.