On 13.04.2012 11:35, Noel Grandin wrote:


On 2012-04-12 14:40, Stephan Bergmann wrote:
Insist on people compiling with an unbroken toolchain instead?


It looks like Fedora is also going to do this:
http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking

I'm willing to write a configure test to add the --no-as-needed flag if someone can point me in the right direction. I can follow the configure.in syntax easily enough, but what would be the easiest way to test for the fact that the linker is defaulting to --as-needed?

this is a tricky one, because ldd -r -u is not portalble.
We could create a lib, link it to binary but without actually using something from that lib. On systems with linker defaulting to --as needed this dependency would be dropped. That why we could safely remove this lib and try to execute the binary. If it is ok, then we are on system with linker defaulting to --as-needed and not otherwise.

Here is a quick test on Mac OS X (where ld even not aware of this option):

$ echo 'int foo(){return 42;}'> foo.c; gcc -o libfoo.so -shared foo.c
$ echo 'main(){return 42;}' > bar.c; gcc -o bar bar.c -L. -lfoo
$ ./bar; echo $?
42
$ rm libfoo.so; ./bar; echo $?
dyld: Library not loaded: libfoo.so

and here on Ubuntu with linker defaulting to --as-needed:

$ echo 'int foo(){return 42;}'> foo.c; gcc -o libfoo.so -shared foo.c
$ echo 'main(){return 42;}' > bar.c; gcc -o bar bar.c -L. -lfoo
$ ./bar; echo $?
42
$ rm libfoo.so; ./bar; echo $?
42
$ ldd -r -u bar
Unused direct dependencies:


Now we have a test, how do we solve the broken make check on Ubuntu anyway?
I would prefer a small/quick hack in place to repaire the broken make check on Ubuntu.
Then we have time to refactor the hack and make it the right way...

Or may be I'm wrong in my suggestion, that Ubuntu is the first class citizen OS to hack on LO?

Ciao
David

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to