Board index FlightGear Support Compiling

Git compile - Huge wall of undefined reference errors (OSG).  Topic is solved

Building FlightGear from source, and in the need for help?

Git compile - Huge wall of undefined reference errors (OSG).

Postby caliberza » Fri Sep 02, 2016 11:00 am

I've been trying to compile FG from the latest Git source (done this many times in the past before). But I really can't figure out the errors I'm getting..
I don't really want to post the whole lot because it's a really, really long list, but it seems possibly related to OSG, it starts like:

Code: Select all
[ 15%] Linking CXX executable fgelev
CMakeFiles/fgelev.dir/fgelev.cxx.o: In function `main':
fgelev.cxx:(.text.startup+0x26a): undefined reference to `SGPath::SGPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPath::Permissions (*)(SGPath const&))'
fgelev.cxx:(.text.startup+0x28c): undefined reference to `SGPath::append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
fgelev.cxx:(.text.startup+0x2d6): undefined reference to `SGPath::SGPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPath::Permissions (*)(SGPath const&))'
fgelev.cxx:(.text.startup+0x340): undefined reference to `SGPath::SGPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPath::Permissions (*)(SGPath const&))'
fgelev.cxx:(.text.startup+0x367): undefined reference to `SGPath::append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
fgelev.cxx:(.text.startup+0x39b): undefined reference to `SGPath::local8BitStr[abi:cxx11]() const'
fgelev.cxx:(.text.startup+0x3b8): undefined reference to `SGMaterialLib::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPropertyNode*)'
fgelev.cxx:(.text.startup+0x3e4): undefined reference to `simgear::SGModelLib::init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPropertyNode*)'
fgelev.cxx:(.text.startup+0x4a7): undefined reference to `SGPath::local8BitStr[abi:cxx11]() const'
fgelev.cxx:(.text.startup+0x79a): undefined reference to `simgear::BVHPageNodeOSG::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, osg::ref_ptr<osg::Referenced const> const&)'
fgelev.cxx:(.text.startup+0x1569): undefined reference to `SGPath::SGPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SGPath::Permissions (*)(SGPath const&))'
fgelev.cxx:(.text.startup+0x158b): undefined reference to `SGPath::append(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
fgelev.cxx:(.text.startup+0x1683): undefined reference to `logstream::log(sgDebugClass, sgDebugPriority, char const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
fgelev.cxx:(.text.startup+0x1bd3): undefined reference to `logstream::log(sgDebugClass, sgDebugPriority, char const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
fgelev.cxx:(.text.startup+0x1d72): undefined reference to `logstream::log(sgDebugClass, sgDebugPriority, char const*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'


And then truck loads of lines like:
Code: Select all
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x18): undefined reference to `osgDB::ReadFileCallback::openArchive(std::string const&, osgDB::ReaderWriter::ArchiveStatus, unsigned int, osgDB::Options const*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x20): undefined reference to `osgDB::ReadFileCallback::readObject(std::string const&, osgDB::Options const*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x28): undefined reference to `osgDB::ReadFileCallback::readImage(std::string const&, osgDB::Options const*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x30): undefined reference to `osgDB::ReadFileCallback::readHeightField(std::string const&, osgDB::Options const*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x38): undefined reference to `osgDB::ReadFileCallback::readNode(std::string const&, osgDB::Options const*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(ModelRegistry.cxx.o):(.rodata._ZTCN7simgear13ModelRegistryE0_N5osgDB16ReadFileCallbackE[_ZTVN7simgear13ModelRegistryE]+0x40): undefined reference to `osgDB::ReadFileCallback::readShader(std::string const&, osgDB::Options const*)'


Last few lines:
Code: Select all
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(SGVasiDrawable.cxx.o):(.rodata._ZTV14SGVasiDrawable[_ZTV14SGVasiDrawable]+0xc0): undefined reference to `osg::Drawable::setUpdateCallback(osg::Drawable::UpdateCallback*)'
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(SGVasiDrawable.cxx.o):(.rodata._ZTV14SGVasiDrawable[_ZTV14SGVasiDrawable]+0xc8): undefined reference to `osg::Drawable::setEventCallback(osg::Drawable::EventCallback*)'
collect2: error: ld returned 1 exit status
utils/fgelev/CMakeFiles/fgelev.dir/build.make:113: recipe for target 'utils/fgelev/fgelev' failed
make[2]: *** [utils/fgelev/fgelev] Error 1
CMakeFiles/Makefile2:439: recipe for target 'utils/fgelev/CMakeFiles/fgelev.dir/all' failed
make[1]: *** [utils/fgelev/CMakeFiles/fgelev.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2


I have tried the OSG that comes with my distro (Ubuntu 16.04) and I have manually compiled and OSG 3.2.3 and 3.4.0 and it makes no difference. OSG compiled with no issues.
Simgear compiled and installed with no issues either. I have also deleted and re-downloaded flightgear from git to just make sure that it wasn't a download corruption or something.
Anything obvious I'm missing?

Thanks.
caliberza
 
Posts: 15
Joined: Sat Jul 11, 2015 2:20 pm
Location: South Africa
Callsign: caliber
Version: Git
OS: Linux, Ubuntu 14.04

Re: Git compile - Huge wall of undefined reference errors (O  

Postby elgaton » Fri Sep 02, 2016 1:12 pm

The "undefined references" you show in the first box are related to SimGear (SG-) functions, not to OpenSceneGraph.

  1. Since you are compiling both SimGear and FlightGear from source, did you uninstall any SimGear version you had installed previously (e.g. because you originally installed FlightGear + SimGear from your package manager, then decided to compile them from source, uninstalled FlightGear but forgot to uninstall SimGear)? If you have both the version packaged by your distribution and the one you compiled from source installed, it might be that CMake is picking the first (older) one instead of the second (correct) one.
  2. If that is not the case, try performing a clean build: if you are performing an "out-of-source build", that is, compiling the programs outside the source directory in a dedicated build directory, just remove the latter, otherwise, do a "make clean" and then build SimGear and FlightGear again.
NIATCA 2nd admin, regular ATC at LIPX and creator of the LIPX custom scenery
elgaton
 
Posts: 1107
Joined: Tue Mar 19, 2013 4:58 pm
Callsign: I-ELGA/LIPX_TW
Version: Git
OS: Windows + Arch Linux

Re: Git compile - Huge wall of undefined reference errors (O

Postby caliberza » Sat Sep 03, 2016 8:17 am

elgaton wrote in Fri Sep 02, 2016 1:12 pm:The "undefined references" you show in the first box are related to SimGear (SG-) functions, not to OpenSceneGraph.

Ah, thanks for the clarification, I just assumed it was OSG cos of the lines like:
Code: Select all
/usr/local/lib/x86_64-linux-gnu/libSimGearScene.a(OptionsReadFileCallback.cxx.o): In function `simgear::OptionsReadFileCallback::readHeightField(std::string const&, osgDB::Options const*)':
OptionsReadFileCallback.cxx:(.text+0x225): undefined reference to `osgDB::ReadFileCallback::readHeightField(std::string const&, osgDB::Options const*)'


I have never installed Flightgear from the repository, have always compiled it so definitely not old packages. I did try completely wiping both FG and SG and re-compiling and I still get the error.
Also when I do a "make uninstall" on Simgear and then try run cmake on FG it complains that it can't find Simgear so I'm fairly certain it's finding the correct Simgear.

I wonder if it's possible that my Simgear is broken, somehow something not compiling correctly or something yet not reporting any errors.. I'm lost on what else I can try. :/
caliberza
 
Posts: 15
Joined: Sat Jul 11, 2015 2:20 pm
Location: South Africa
Callsign: caliber
Version: Git
OS: Linux, Ubuntu 14.04

Re: Git compile - Huge wall of undefined reference errors (O

Postby Hooray » Sat Sep 03, 2016 9:37 am

This is most likely due to conflicting versions being found by the cmake logic - it does make sense to review the cmake cache to see what it found, and where.

Note that you will typically also have to run "make install" for SimGear specifically before it shows up properly, so that the cmake logic can find it - and that even applies if you use -DCMAKE_INSTALL_PREFIX already.

As far as I can see, you are installing system-wide into the 64 nit lib location - you may have other directories in use (see ldconfig), which is why it makes sense to search your lib directories for SimGear/OSG related libs that may be conflicting with what you want to be using
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11115
Joined: Tue Mar 25, 2008 8:40 am

Re: Git compile - Huge wall of undefined reference errors (O

Postby caliberza » Sat Sep 03, 2016 9:39 am

I just got it fixed! You were right after all!

I discovered I indeed had two Simgear libs installed - newly compiled one was installed in /usr/local/lib and the older one was in /usr/local/lib/x86_64-linux-gnu/..
I guess a partial reason for my confusion is probably because "make uninstall" would remove the header files (which appear to have only one location) - hence FG compilation would fail and I assumed it had fully removed Simgear. :oops:

I'm guessing this issue must've appeared after I updated Ubuntu 14.04 to 16.04.
caliberza
 
Posts: 15
Joined: Sat Jul 11, 2015 2:20 pm
Location: South Africa
Callsign: caliber
Version: Git
OS: Linux, Ubuntu 14.04


Return to Compiling

Who is online

Users browsing this forum: No registered users and 1 guest