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.
Created attachment 147461 [details] ogre-1.4.7.ebuild Probably no point in incrementing the revision number.
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 attachment 149213 [details, diff] 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!