Linker problems for clean_ogre_cmake_project

Problems building or running the engine, queries about how to use features etc.
Post Reply
tyrolite
Gnoblar
Posts: 6
Joined: Thu Jul 19, 2012 12:36 pm
Location: Romania

Linker problems for clean_ogre_cmake_project

Post by tyrolite »

Hello everyone ! this is my first post on Ogre forums :D

So, these days I decided to give OGRE a try and see what my game programmer skills are made of, but I'm stuck setting up the first app.
I followed this tutorial : http://www.ogre3d.org/tikiwiki/tiki-ind ... or+-+Linux but when I try to run make && make install in console I receive the following linker error:

Code: Select all

tyrolite@archlinux clean_ogre_cmake_project-build]$ make && make install
Linking CXX executable dist/bin/OgreApp
/usr/bin/ld: CMakeFiles/OgreApp.dir/BaseApplication.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/bin/ld: note: '_ZN5boost6system15system_categoryEv' is defined in DSO /usr/lib/libboost_system.so.1.50.0 so try adding it to the linker command line
/usr/lib/libboost_system.so.1.50.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [dist/bin/OgreApp] Error 1
make[1]: *** [CMakeFiles/OgreApp.dir/all] Error 2
make: *** [all] Error 2
Note that I have boost 1.50.0-1 and ogre 1.8.0-3 installed.

Any clues ?
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Linker problems for clean_ogre_cmake_project

Post by duststorm »

There are some issues with boost 1.50 and the CMake build script.
Transporter submitted a patch that makes it work, but it has not been applied yet. You can find it here to apply it yourself: http://www.ogre3d.org/mantis/view.php?id=538
Developer @ MakeHuman.org
tyrolite
Gnoblar
Posts: 6
Joined: Thu Jul 19, 2012 12:36 pm
Location: Romania

Re: Linker problems for clean_ogre_cmake_project

Post by tyrolite »

I din't know how to apply the patch and I took another route trying to solve my problem:

1. removed the ogre package provided by the archlinux distribution
2. cloned the unstable default branch:

Code: Select all

hg clone https://bitbucket.org/sinbad/ogre/
3. cmake, make & make install

The ogre build went fine, a few warnings here and there but no errors. I read a bit about the patch tool and found out that it just makes a diff. I looked in the .patch files to see which files are being modified and then in my cloned files and they seem to be updated. Acording to the bitbucket log, CMake/Templates/SDK_CMakeLists.txt.in for example, was modified 3 days ago. After doing this I ran again cmake on the clean_ogre_cmake_project, but I still get the linker error when trying to build it with make. :(

Do I still have to apply the patch? I so, how?If not, what else could be wrong ?
dimaursu16
Gnoblar
Posts: 1
Joined: Mon Jul 23, 2012 7:40 am

Re: Linker problems for clean_ogre_cmake_project

Post by dimaursu16 »

Same OS, same problem here. Will Archlinux fix this soon? I don't want to mess around with compiling from sources.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: Linker problems for clean_ogre_cmake_project

Post by scrawl »

Hm, I'm on archlinux too with latest packages but I don't have this problem.

Edit: Probably because I built Ogre from latest HG sources. Should have read the entire thread.. :roll:
dimaursu16 wrote:Same OS, same problem here. Will Archlinux fix this soon? I don't want to mess around with compiling from sources.
tyrolite
Gnoblar
Posts: 6
Joined: Thu Jul 19, 2012 12:36 pm
Location: Romania

Re: Linker problems for clean_ogre_cmake_project

Post by tyrolite »

@dimaursu16:
There's nothing wrong with compiling from sources.You don't have to be afraid and you must break out of your pacman shell :lol: There are lots of applications that are not int the pacman database and neither in the AUR meaning that if you want them you must compile them; compiling from sources being, in fact, the good old linux way of dealing with software. It's your choice after all, you can wait for others to fix the problem or you can find a workaround and fix it yourself.

Building from the latest hg sources didn't worked for me but I found a workaroud that did: I went in the pacman cache folder(/var/cache/pacman/pkg) and downgraded my boost and boost-libs to the 1.49 version. After recompiling the current sources, there was an issue with a constant in xtime.hpp from boost. I decided then to take a previous OGRE stable version, that is 1.74 and recompiled. The error persisted but I found the trick for that on the archlinux forums: I only had to rename the constant that was causing the compile error. I didn't triend to compile with OGRE 1.8.0 or current versions because I'm not an up-to-date nazi and I don't need the lastest itzy-bitzy-fancy features. Right now I'm just spinning ogre heads :mrgreen:
coreproblem
Gnoblar
Posts: 1
Joined: Thu Aug 02, 2012 11:42 pm
x 1

Re: Linker problems for clean_ogre_cmake_project

Post by coreproblem »

I had the same problem (boost 1.50.0-2, ogre 1.8.0-3).
Adding -lboost_system to the linker command line fixed it for me:

Code: Select all

// linking:
g++ -o bin/app build/*.o -O3 -Wall $(pkg-config --libs OGRE OIS) -lboost_system
krack
Gnoblar
Posts: 1
Joined: Thu Nov 01, 2012 7:01 am

Re: Linker problems for clean_ogre_cmake_project

Post by krack »

coreproblem wrote:I had the same problem (boost 1.50.0-2, ogre 1.8.0-3).
Adding -lboost_system to the linker command line fixed it for me:

Code: Select all

// linking:
g++ -o bin/app build/*.o -O3 -Wall $(pkg-config --libs OGRE OIS) -lboost_system
Your solution works great!
I editted a file in $APP-build/CMakeFiles/OgreApp.dir/
called: link.txt and just added your '-lboost_system' @
"...libOgreMain.so -lboost_system -lboost_thread -lboost_date_time -lOIS -Wl,-rpath,/usr/local/lib"

Is that what you meant by "...added to the linker command"?


-------------------
Anyway it works now and I use Arch like the rest.
awpr
Gnoblar
Posts: 1
Joined: Tue Nov 13, 2012 3:02 am

Re: Linker problems for clean_ogre_cmake_project

Post by awpr »

The workaround I found, which seems to me to be a cleaner solution, is to change the following in the template's CMakeLists.txt:

Code: Select all

set(OGRE_BOOST_COMPONENTS thread date_time)
to read:

Code: Select all

set(OGRE_BOOST_COMPONENTS system thread date_time)
This is a small subset of what's in the linked patches, but since those are against a completely different file (which lives in the OGRE source tree) and I've yet to figure out how the two are related, this is the path of least resistance for me.

My understanding of what's happening here is that this is the result of a change in ld's behavior (which apparently happened in 2010?): previously it would "attempt to implicitly satisfy link requirements" (https://fedoraproject.org/wiki/Features ... DSOLinking - I'm assuming this change made it upstream and into other distributions of ld), but it no longer does. Since libboost_system would previously have been pulled in by this behavior, it wasn't listed; now, it needs to be.

Unless of course libboost_system became its own shared object only recently, in which case that's to blame. I'm not really familiar with boost's history.

Either way, boost's system component needs to be on the linker command line, and it wasn't because CMakeLists.txt didn't tell FindBoost.cmake to find it.
Post Reply