Problem linking freshly built Ogre 14.3

Problems building or running the engine, queries about how to use features etc.
Tom Duhamel
Gnoblar
Posts: 9
Joined: Fri Nov 15, 2019 2:07 pm
x 3

Problem linking freshly built Ogre 14.3

Post by Tom Duhamel »

Ogre Version: 14.3
Operating System: Fedora 42/KDE
Render System: OpenGL

As I'm not sure I did wrong, and I can tell I did something wrong, I'll just explain the whole process before getting to the problem.

I compiled Ogre 14.3 from source, successfully. (Fedora comes with 1.9. I tried to compile a few years ago and it didn't work back then so I just stayed on 1.9 until now).

I then copied the whole /usr/local directory (there was nothing else in there before install) to my other computer.

I updated paths in the cmake file, then fixed the few errors in my project due to the few changes in the API. It compiles, but doesn't link.

After a bit of research, I figured I had to make a little change for find_package to work. (Learnt a log about how find_package works in the process) The new build doesn't appear to include FindOGRE.cmake, therefore it's using the one from 1.9 that is already on the system (this might be a part of the problem). I figured that passing the path of the new installation into OGRE_HOME does the trick. (The documentation incorrectly states OGRE_DIR by the way)

Now this works, except there's a little hiccup. OGRE_Property and OGRE_RTShaderSystem are still found from the 1.9 installation, rather than the new installation. The other components are properly loaded from the new installation. Was there another variable to pass the path to those as well? I couldn't find one.

During my research, I found that anohter way was to pass the path to the SDK directory, install of using FindOGRE.cmake. I can't figure what that means. The only SDK I can see in the source tree has just an Android directory inside of it.

Code: Select all

cmake_minimum_required(VERSION 3.10)

project(tribes)

set (SRCS
    main.cpp
    base.cpp
    world.cpp
    terrain.cpp
    controllers.cpp
    entity.cpp
    animal.cpp
    random.cpp
)

add_executable(tribes ${SRCS})
target_compile_options(tribes PRIVATE -Wuninitialized -Wno-register)
#-Wall -Wextra -Wpedantic
include_directories(/usr/local/include/OGRE /usr/include/OIS /usr/local/include/OGRE/Overlay /usr/local/include/OGRE/Paging /usr/local/include/OGRE/Terrain)

set (OGRE_HOME /usr/local)
find_package(OGRE REQUIRED COMPONENTS)
find_package(OIS)
find_package(Boost 1.66 REQUIRED)# COMPONENTS system thread)

file(COPY plugins.cfg DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY resources.cfg DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

target_link_libraries(
    tribes
    ${OGRE_LIBRARIES}
    ${OIS_LIBRARIES}
    # ${OGRE_Overlay_LIBRARIES}
    # ${OGRE_Terrain_LIBRARIES}
    # ${OGRE_Volume_LIBRARIES}
    # ${OGRE_Property_LIBRARIES}
    # ${OGRE_RTShaderSystem_LIBRARIES}
    ${Boost_SYSTEM_LIBRARY_DEBUG})
    #${OGRE_LIBRARIES} ${Boost_LIBRARIES} )

install(TARGETS tribes RUNTIME DESTINATION bin)

Code: Select all

/home/tom/Tribes/build> /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug /home/tom/Dropbox/Tribes
-- Looking for OGRE...
-- Found Ogre  (..)
-- Found OGRE: optimized;/usr/local/lib/libOgreMain.so;debug;/usr/local/lib/libOgreMain.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/local/lib/libOgrePaging.so;debug;/usr/local/lib/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/local/lib/libOgreTerrain.so;debug;/usr/local/lib/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/lib64/libOgreProperty.so;debug;/usr/lib64/libOgreProperty.so
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/lib64/libOgreRTShaderSystem.so;debug;/usr/lib64/libOgreRTShaderSystem.so
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/usr/local/lib/libOgreVolume.so;debug;/usr/local/lib/libOgreVolume.so
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/usr/local/lib/libOgreOverlay.so;debug;/usr/local/lib/libOgreOverlay.so
-- optimized;/usr/local/lib/libOgreMain.so;debug;/usr/local/lib/libOgreMain.so
-- Looking for OIS...
-- Found OIS: optimized;/usr/lib64/libOIS.so;debug;/usr/lib64/libOIS.so
CMake Warning (dev) at CMakeLists.txt:30 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/tom/Tribes/build
*** Finished ***
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 494
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 177

Re: Problem linking freshly built Ogre 14.3

Post by sercero »

I then copied the whole /usr/local directory (there was nothing else in there before install) to my other computer.

I don't understand this sentence, did you compile OGRE on another computer?

I think you did things in a convoluted way that is going to give you all sort of headaches.

The easiest way is to uninstall OGRE 1.9 (the RPM) and then build OGRE 14.3 again from source in the computer you are going to use it and then do a "make install" for OGRE 14.3 that you built from source.

Tom Duhamel
Gnoblar
Posts: 9
Joined: Fri Nov 15, 2019 2:07 pm
x 3

Re: Problem linking freshly built Ogre 14.3

Post by Tom Duhamel »

That's precisely what I did. I didn't think that was going to be an issue. Good thing I posted the whole process.

I will do just that then, sir. Thank you!