games/flightgear doesn't build. The bug is similar to what is written in this post: http://lists.freebsd.org/pipermail/freebsd-ports/2013-December/088564.html If I hack the cmakelist file, I can make the official tar.gz to build. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS} -L/usr/local/lib -lX11") This is a quick and dirty hack, so I wouldn't attach as a patch. Lev
Hi Lev, Thank you for reporting this issue. Could you give me more details about the failure ? On what version of FreeBSD were you trying to build Flightgear ? Could you attach a build log ? Regards, Ganael.
My system is: FreeBSD jive 10.1-RELEASE-p14 FreeBSD 10.1-RELEASE-p14 I have this on the console: [...] Linking CXX executable fgfs /usr/bin/ld: //usr/local/lib/libX11.so.6: invalid DSO for symbol `XConvertSelection' definition //usr/local/lib/libX11.so.6: could not read symbols: Bad value c++: error: linker command failed with exit code 1 (use -v to see invocation) --- src/Main/fgfs --- *** [src/Main/fgfs] Error code 1 make[4]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 1 error make[4]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 --- src/Main/CMakeFiles/fgfs.dir/all --- *** [src/Main/CMakeFiles/fgfs.dir/all] Error code 2 make[3]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 1 error make[3]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 *** [all] Error code 2 make[2]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 1 error make[2]: stopped in /usr/ports/games/flightgear/work/flightgear-3.4.0 ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make[1]: stopped in /usr/ports/games/flightgear *** Error code 1 Stop. make: stopped in /usr/ports/games/flightgear
A commit references this bug: Author: martymac Date: Sat Aug 8 20:29:53 UTC 2015 New revision: 393744 URL: https://svnweb.freebsd.org/changeset/ports/393744 Log: Fix build by explicitly linking to X11 PR: 202115 Submitted by: leventelist@gmail.com Changes: head/games/flightgear/files/patch-CMakeLists.txt
Fix committed! Thanks for the report, Lev :)
I'm actually still seeing related issues on DragonFly: --- utils/fgelev/CMakeFiles/fgelev.dir/all --- --- utils/fgelev/fgelev --- Linking CXX executable fgelev cd /wrkdirs/games/flightgear/work/flightgear-3.4.0/utils/fgelev && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/fgelev.dir/link.txt --verbose=1 /usr/bin/c++ -pipe -D__FreeBSD__=9 -O2 -fno-strict-aliasing -std=c++11 -Wall -D_REENTRANT -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION -pipe -D__FreeBSD__=9 -O2 -fno-strict-aliasing -std=c++11 -lX11 CMakeFiles/fgelev.dir/fgelev.cxx.o -o fgelev /usr/local/lib/libSimGearScene.a /usr/local/lib/libSimGearCore.a /usr/local/lib/libSimGearCore.a /usr/local/lib/libosgText.so /usr/local/lib/libosgSim.so /usr/local/lib/libosgDB.so /usr/local/lib/libosgParticle.so /usr/local/lib/libosgFX.so /usr/local/lib/libosgUtil.so /usr/local/lib/libosgViewer.so /usr/local/lib/libosgGA.so /usr/local/lib/libosg.so /usr/local/lib/libOpenThreads.so /usr/local/lib/libGLU.so /usr/local/lib/libGL.so -pthread -lz -lrt -Wl,-rpath,/usr/local/lib /usr/libexec/binutils225/elf/ld.bfd: cannot find -lX11 *** [utils/fgelev/fgelev] Error code 1
my guess is this is because "-L/usr/local/lib" (or -L@LOCALBASE@/lib) that was originally suggested was omitted.
okay, confirmed. If I manually change the patch to add "-L/usr/local/lib" then it builds. This is because some compilers do not automatically look in /usr/local/lib for libraries. I'd like to see this bug report reopened. There are probably two ways to fix this. 1) change "-lX11" to -L@PREFIX@/lib -X11" and then use REINPLACE_CMD to define @PREFIX@ to value of $PREFIX 2) Surely cmake already knows the prefix so use a variable from there.
Strange. I successfully compiled FG with this fix. What compiler are you using? Lev
It's not strange. Our GCC is not configured to look in /usr/local/lib for libraries by default. This should not be assumed (yes, it's often true, but it's not law).
also, don't forget ports can have a different LOCALBASE than /usr/local (it's configurable) so flightgear would not build on those configurations either.
Okay. Can you reopen the bug?
okay. I was expecting martymac to do it but ...
Hi John, Lev, Yep, sorry, I missed time to work on this today. Thanks for having re-opened this issue. CMAKE_EXE_LINKER_FLAGS is populated from LDFLAGS, so I presume adding : LDFLAGS+= -L${LOCALBASE}/lib to the port's Makefile should fix the problem. Can you confirm that ? Best regards, Ganael.
Yes, that was successful. I see why it worked before. I had this in the Makefile: # workaround with X11 clipboard support # ${ECHO_MSG} 'target_link_libraries(fgfs "-L/usr/local/lib -lX11")' >> \ # ${WRKSRC}/src/Main/CMakeLists.txt LDFLAGS+= -L${LOCALBASE}/lib When CMakefile.txt was patched, this stopped working. So I've known about the issue for a long time.
oops, minus the "LDFLAGS+= -L${LOCALBASE}/lib" line, I just added that.
A commit references this bug: Author: martymac Date: Mon Aug 10 15:03:40 UTC 2015 New revision: 393869 URL: https://svnweb.freebsd.org/changeset/ports/393869 Log: Add LOCALBASE to LDFLAGS to fix build on DragonFly PR: 202115 Submitted by: marino Changes: head/games/flightgear/Makefile
Fix for DragonFly committed, thanks!
The port doesn't compile, again. However, I can make it compile again with this in the cmakelist file: set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS} -L/usr/local/lib -lm -lc++ -lX11") regards, Lev
Hi Lev, On what version of FreeBSD are you trying to compile Flightgear ? Can you provide a build log ? Best regards, Ganael.
I am on 10.2-RELEASE-p2 These are just the last lines: [...] /usr/local/lib/libSimGearScene.a(TreeBin.cxx.o):(.rodata._ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE[_ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE]+0x68): undefined reference to `osg::Object::getUserData()' /usr/local/lib/libSimGearScene.a(TreeBin.cxx.o):(.rodata._ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE[_ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE]+0x70): undefined reference to `osg::Object::getUserData() const' /usr/local/lib/libSimGearScene.a(TreeBin.cxx.o):(.rodata._ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE[_ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE]+0x78): undefined reference to `osg::BufferData::resizeGLObjectBuffers(unsigned int)' /usr/local/lib/libSimGearScene.a(TreeBin.cxx.o):(.rodata._ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE[_ZTVN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE]+0x80): undefined reference to `osg::BufferData::releaseGLObjects(osg::State*) const' /usr/local/lib/libSimGearScene.a(TreeBin.cxx.o):(.rodata._ZTIN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE[_ZTIN3osg13TemplateArrayIfLNS_5Array4TypeE7ELi1ELi5126EEE]+0x18): undefined reference to `typeinfo for osg::Array' HTH, Lev
Hi Lev, Unfortunately, I cannot reproduce the problem ; everything builds fine here, on a fresh 10.2 jail. What compiler are you using ? In your changes : set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS} -L/usr/local/lib -lm -lc++ -lX11") only -lc++ should make the difference here, as -L/usr/local/lib is already part of CMAKE_EXE_LINKER_FLAGS through LDFLAGS. Please don't mix C++ libraries : if dependencies were built with libc++ (which should be mostly the case), use libc++ for Flightgear too. Maybe your compiler tries to use libstdc++ by default ? Have you checked you don't have specific settings in your environment or global make.conf ? Have you tried to rebuild OSG and Simgear first ? Best regards, Ganael.