Bug 215085 - dev-games/ogre - Fix --as-needed with cg
|
Bug#:
215085
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: All
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: normal
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: games@gentoo.org
|
Reported By: chewi@aura-online.co.uk
|
|
Component: Games
|
|
|
URL:
http://www.ogre3d.org
|
|
Summary: dev-games/ogre - Fix --as-needed with cg
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2008-03-27 17:43 0000
|
Because of the way NVIDIA linked their Cg toolkit, building Ogre with the cg
USE flag enabled and -Wl,--as-needed in your LDFLAGS doesn't work. Here's a new
ebuild that filters the flags.
in portage. thanks for the bug report and patch.
Filtering --as-needed is just hiding a bug. It should either be left open or
fixed.
talk is cheap - patches welcome.
The command that causes the error is...
gcc -o conftest <CFLAGS> -Wl,--as-needed conftest.c -lCg -lILU -lIL -lpthread
-lz -lm -ldl
If you add (or move) -lpthread and -lm before the -Wl,--as-needed option then
it works. Maybe you could do some trick with -Wl,--no-as-needed but you'd have
to make sure that -Wl,--as-needed is added again afterwards and ONLY when it is
wanted. It could be done but it wouldn't be too pretty.
There are two lines in the configure script that add the -lCg option and they
read LIBS="-lCg $LIBS". Maybe something could be done with this.
(In reply to comment #4)
> talk is cheap - patches welcome.
Sigh...
(In reply to comment #5)
> The command that causes the error is...
>
> gcc -o conftest <CFLAGS> -Wl,--as-needed conftest.c -lCg -lILU -lIL -lpthread
> -lz -lm -ldl
>
> If you add (or move) -lpthread and -lm before the -Wl,--as-needed option then
> it works.
>
> There are two lines in the configure script that add the -lCg option and they
> read LIBS="-lCg $LIBS". Maybe something could be done with this.
Probably changing the linking order from LIBS="-lCg $LIBS" to LIBS="$LIBS -lCg"
will fix it. But I am not able to test that for another week. Could you have a
go at it?
I tried putting -lCg in various places before but that didn't work. It makes
sense that you have to move -lm and -lpthread because Cg doesn't reference them
when it should and so they must be linked regardless of whether they appear to
be needed.
Created an attachment (id=149213) [details]
ogre-1.4.7-as-needed.patch
Okay I've come up with a very simple patch. We can get away with only modifying
the configure test because libm and libpthread are actually "needed" by OGRE
itself any other time that libCg is linked. Thanks to the way AC_CHECK_LIB
works, it is easy to add extra arguments to the test. Apply this patch before
the ce-gui patch. "-Xlinker --no-as-needed" was used rather than
"-Wl,--no-as-needed" because the comma confuses autoconf. Sorry for the extra
work, Mr Bones!