Linker problems for clean_ogre_cmake_project

Problems building or running the engine, queries about how to use features etc.

Linker problems for clean_ogre_cmake_project

Postby tyrolite » Thu Jul 19, 2012 1:09 pm

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-index.php?page=Setting+Up+An+Application+-+QtCreator+-+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 ?
tyrolite
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 19 Jul 2012
Location: Romania

Re: Linker problems for clean_ogre_cmake_project

Postby duststorm » Thu Jul 19, 2012 1:15 pm

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

For this message the author duststorm has received kudos
User avatar
duststorm
Minaton
 
Posts: 907
Kudos: 80
Joined: 31 Jul 2010
Location: Belgium

Re: Linker problems for clean_ogre_cmake_project

Postby tyrolite » Sat Jul 21, 2012 5:56 pm

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 ?
tyrolite
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 19 Jul 2012
Location: Romania

Re: Linker problems for clean_ogre_cmake_project

Postby dimaursu16 » Mon Jul 23, 2012 8:06 am

Same OS, same problem here. Will Archlinux fix this soon? I don't want to mess around with compiling from sources.
dimaursu16
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 23 Jul 2012

Re: Linker problems for clean_ogre_cmake_project

Postby scrawl » Mon Jul 23, 2012 11:54 am

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.
User avatar
scrawl
OGRE Expert User
OGRE Expert User
 
Posts: 967
Kudos: 175
Joined: 01 Jan 2011
Location: Germany

Re: Linker problems for clean_ogre_cmake_project

Postby tyrolite » Mon Jul 23, 2012 12:43 pm

@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:
tyrolite
Gnoblar
 
Posts: 6
Kudos: 0
Joined: 19 Jul 2012
Location: Romania

Re: Linker problems for clean_ogre_cmake_project

Postby coreproblem » Thu Aug 02, 2012 11:51 pm

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

For this message the author coreproblem has received kudos
coreproblem
Gnoblar
 
Posts: 1
Kudos: 1
Joined: 02 Aug 2012

Re: Linker problems for clean_ogre_cmake_project

Postby krack » Thu Nov 01, 2012 7:07 am

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.
krack
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 01 Nov 2012

Re: Linker problems for clean_ogre_cmake_project

Postby awpr » Tue Nov 13, 2012 3:14 am

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.
awpr
Gnoblar
 
Posts: 1
Kudos: 0
Joined: 13 Nov 2012


Return to Help

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 14 guests