Bug 202115 - games/flightgear port doesn't build
Summary: games/flightgear port doesn't build
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Ganael LAPLANCHE
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-05 22:17 UTC by leventelist
Modified: 2017-01-08 15:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (martymac)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description leventelist 2015-08-05 22:17:36 UTC
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
Comment 1 Ganael LAPLANCHE freebsd_committer 2015-08-06 20:15:22 UTC
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.
Comment 2 leventelist 2015-08-07 20:34:17 UTC
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
Comment 3 commit-hook freebsd_committer 2015-08-08 20:30:44 UTC
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
Comment 4 Ganael LAPLANCHE freebsd_committer 2015-08-08 20:32:39 UTC
Fix committed! Thanks for the report, Lev :)
Comment 5 John Marino freebsd_committer 2015-08-09 17:38:34 UTC
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
Comment 6 John Marino freebsd_committer 2015-08-09 17:40:23 UTC
my guess is this is because "-L/usr/local/lib" (or -L@LOCALBASE@/lib) that was originally suggested was omitted.
Comment 7 John Marino freebsd_committer 2015-08-09 17:51:05 UTC
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.
Comment 8 leventelist 2015-08-09 18:00:13 UTC
Strange. I successfully compiled FG with this fix. What compiler are you using?

Lev
Comment 9 John Marino freebsd_committer 2015-08-09 18:01:45 UTC
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).
Comment 10 John Marino freebsd_committer 2015-08-09 18:03:01 UTC
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.
Comment 11 leventelist 2015-08-09 18:21:16 UTC
Okay. Can you reopen the bug?
Comment 12 John Marino freebsd_committer 2015-08-09 18:33:55 UTC
okay.  I was expecting martymac to do it but ...
Comment 13 Ganael LAPLANCHE freebsd_committer 2015-08-09 20:00:33 UTC
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.
Comment 14 John Marino freebsd_committer 2015-08-09 20:12:54 UTC
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.
Comment 15 John Marino freebsd_committer 2015-08-09 20:13:46 UTC
oops, minus the "LDFLAGS+=       -L${LOCALBASE}/lib" line, I just added that.
Comment 16 commit-hook freebsd_committer 2015-08-10 15:04:36 UTC
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
Comment 17 Ganael LAPLANCHE freebsd_committer 2015-08-10 15:06:38 UTC
Fix for DragonFly committed, thanks!
Comment 18 leventelist 2015-11-08 14:58:23 UTC
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
Comment 19 Ganael LAPLANCHE freebsd_committer 2015-11-09 20:56:24 UTC
Hi Lev,

On what version of FreeBSD are you trying to compile Flightgear ?

Can you provide a build log ?

Best regards,
Ganael.
Comment 20 leventelist 2015-11-09 21:34:20 UTC
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
Comment 21 Ganael LAPLANCHE freebsd_committer 2015-11-11 12:56:14 UTC
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.