Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run tutorial project from samples #1763

Closed
goforbroke1006 opened this issue Nov 4, 2020 · 5 comments
Closed

Can't run tutorial project from samples #1763

goforbroke1006 opened this issue Nov 4, 2020 · 5 comments

Comments

@goforbroke1006
Copy link

System Information

  • Ogre Version: 1.12.9
  • Operating System / Platform: Windows 10 ; Microsoft Visual Studio 2019
  • RenderSystem: DirectX 11

Detailled description

Samples does not work. Build without problem but can't run exe.

Steps to reproduce
  1. Build OgreSDK from sources
#!/bin/bash

OGRE_HOME="C:/OgreSDK"

#rm -rf ${OGRE_HOME}

if [[ ! -d ${OGRE_HOME} ]]; then
  git clone --depth 1 --branch v1.12.9 https://github.com/OGRECave/ogre.git ${OGRE_HOME}
fi

cd ${OGRE_HOME} || exit 1

(
  mkdir -p build32
  cd build32/ || exit 1

  rm -rf ./*

  cmake -DCMAKE_BUILD_TYPE=Release -A win32 .. #-G "Visual Studio 16 2019"
  cmake --build . --config Release
  cmake --install . --config Release

)

echo "Please setup env var OGRE_HOME to 'C:\OgreSDK\build32\sdk' value and reload IDE"
echo "Please setup env var OGRE_DIR to 'C:\OgreSDK\build32\sdk\CMake' value and reload IDE"
  1. Setup OGRE_HOME=C:\OgreSDK\build32\sdk and OGRE_DIR=C:\OgreSDK\build32\sdk\CMake in env vars
  2. Open OgreSDK\Samples\Tutorials as a project in CLion IDE

CMake can find OGRE, great.

"C:\Program Files\JetBrains\CLion 2020.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" C:\OgreSDK\Samples\Tutorials
-- Found OGRE
--   static     : OFF
--   components : Bites;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
--   plugins    : Plugin_BSPSceneManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GL3Plus;RenderSystem_Direct3D9;RenderSystem_Direct3D11;Codec_STBI
--   media      : C:/OgreSDK/build32/sdk/Media
-- Configuring done
-- Generating done
-- Build files have been written to: C:/OgreSDK/Samples/Tutorials/cmake-build-debug

[Finished]
  1. Setup working directory to C:\OgreSDK\build32\sdk\bin. Binary build without errors. Ok.
  2. Try to run exe file

Exception 0xc0000005 encountered at address 0x74ba35c9: Access violation reading location 0x00b01000

Stacktrace:

memcpy 0x0000000074ba33a0
OgreBites::TrayManager::areTraysVisible(void) 0x00000000502051ea
OgreBites::ApplicationContextBase::ApplicationContextBase(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &) 0x0000000050207d48
OgreBites::ApplicationContextSDL::ApplicationContextSDL(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &) 0x000000005021e992
MyTestApp::MyTestApp() Bootstrap.cpp:13
main(int,char **) Bootstrap.cpp:76
invoke_main() 0x00000000007a61c3
__scrt_common_main_seh() 0x00000000007a6047
__scrt_common_main() 0x00000000007a5edd
mainCRTStartup() 0x00000000007a6248
BaseThreadInitThunk 0x0000000077016359
RtlGetAppContainerNamedObjectPath 0x0000000077537c24
RtlGetAppContainerNamedObjectPath 0x0000000077537bf4

Ogre.log

not available

@paroj
Copy link
Member

paroj commented Nov 4, 2020

ogre:

cmake --build . --config Release

but then for Tutorials

-DCMAKE_BUILD_TYPE=Debug

you cant do that with MSVC. If one is debug, the other one must be too. (RelWithDebInfo can be mixed with Release though)

also see #1303

@goforbroke1006
Copy link
Author

I try to build for Debug build type

#!/bin/bash

OGRE_HOME="C:/OgreSDK"

rm -rf ${OGRE_HOME}

if [[ ! -d ${OGRE_HOME} ]]; then
  git clone --depth 1 --branch v1.12.9 https://github.com/OGRECave/ogre.git ${OGRE_HOME}
fi

cd ${OGRE_HOME} || exit 1

(
  BUILD_TYPE=Debug

  mkdir -p build32/${BUILD_TYPE}
  cd build32/${BUILD_TYPE} || exit 1

  cmake                                       \
    -DOGRE_INSTALL_SAMPLES_SOURCE:BOOL=TRUE   \
    -DOGRE_INSTALL_DOCS:BOOL=TRUE             \
    -DOGRE_INSTALL_DEPENDENCIES:BOOL=TRUE     \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE}          \
    -A win32                                  \
    ../..

  cmake --build . --config ${BUILD_TYPE}
  cmake --install . --config ${BUILD_TYPE}

  setx OGRE_HOME ${OGRE_HOME}/build32/${BUILD_TYPE}
)

Another error

CMake Error at build32/Debug/Dependencies/lib/cmake/assimp-5.0/assimpTargets.cmake:85 (message):
  The imported target "assimp::assimp" references the file

     "C:/OgreSDK/build32/Debug/Dependencies/lib/assimp-vc142-mt.lib"

  but this file does not exist.  Possible reasons include:

It happen because I have "C:/OgreSDK/build32/Debug/Dependencies/lib/assimp-vc142-mtd.lib" but not "C:/OgreSDK/build32/Debug/Dependencies/lib/assimp-vc142-mt.lib" (diff in filename - assimp-vc142-mt.lib VS assimp-vc142-mtD.lib

@paroj
Copy link
Member

paroj commented Nov 5, 2020

this is a bug in assimp. Disable it -DOGRE_BUILD_PLUGIN_ASSIMP=OFF or rename the file manually.

@goforbroke1006
Copy link
Author

I update my build script

#!/bin/bash

OGRE_HOME="C:/OgreSDK"

#rm -rf ${OGRE_HOME}

if [[ ! -d ${OGRE_HOME} ]]; then
  git clone --depth 1 --branch v1.12.9 https://github.com/OGRECave/ogre.git ${OGRE_HOME}
fi

cd ${OGRE_HOME} || exit 1

#(
#  BUILD_TYPE=RelWithDebInfo
#  BUILD_DIR=Build/${BUILD_TYPE}
#
#  mkdir -p ${BUILD_DIR}
#  cd ${BUILD_DIR} || exit 1
#
#  cmake                                       \
#    -DCMAKE_BUILD_TYPE=${BUILD_TYPE}          \
#    -G "Visual Studio 16 2019" -A x64         \
#    ../..
#
#  cmake --build . --config ${BUILD_TYPE}
#  cmake --install . --config ${BUILD_TYPE}
#
#  setx OGRE_HOME ${OGRE_HOME}/${BUILD_DIR}/sdk
#)

(
  BUILD_TYPE=Debug
  BUILD_DIR=Build/${BUILD_TYPE}

  mkdir -p ${BUILD_DIR}
  cd ${BUILD_DIR} || exit 1

  cmake                                       \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE}          \
    -DOGRE_BUILD_PLUGIN_ASSIMP=OFF            \
    -G "Visual Studio 16 2019" -A x64         \
    ../..

  cmake --build . --config ${BUILD_TYPE}
  cmake --install . --config ${BUILD_TYPE}

  setx OGRE_HOME ${OGRE_HOME}/${BUILD_DIR}/sdk
)

Now it work fine, but I found out some new problem.
If i choose toolchain Microsoft VS as default, but I have Mingw, freetype lib use mingw as default toolchain. And fretype can't finish build, fall down with errors.
When I delete Cygwin and Mingw it start to compile without problems.

And should not forget disable Assimp codec in plugins.cfg

@paroj
Copy link
Member

paroj commented Nov 6, 2020

ogre should forward the correct generator & toolchain to the dependencies. However, you have to wipe the build folder when either changing the build type or the toolchain - otherwise there will be stale config files around.

@paroj paroj closed this as completed Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants