<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 13.04.2012 11:35, Noel Grandin wrote:
    <blockquote cite="mid:4F87F365.5070804@peralex.com" type="cite">
      <br>
      <br>
      On 2012-04-12 14:40, Stephan Bergmann wrote:
      <br>
      <blockquote type="cite">Insist on people compiling with an
        unbroken toolchain instead?
        <br>
        <br>
        <br>
      </blockquote>
      It looks like Fedora is also going to do this:
      <br>
      <a class="moz-txt-link-freetext" href="http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking">http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking</a>
      <br>
      <br>
      I'm willing to write a configure test to add the --no-as-needed
      flag if someone can point me in the right direction.
      <br>
      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?
      <br>
      <br>
    </blockquote>
    this is a tricky one, because ldd -r -u is not portalble. <br>
    We could create a lib, link it to binary but without actually using
    something from that lib.<br>
    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.<br>
    If it is ok, then we are on system with linker defaulting to
    --as-needed and not otherwise.<br>
    <br>
    Here is a quick test on Mac OS X (where ld even not aware of this
    option):<br>
    <br>
    <font face="Arial" size="2">$ echo 'int foo(){return 42;}'&gt;
      foo.c;
      gcc -o libfoo.so -shared foo.c </font>
    <br>
    <font face="Arial" size="2">$ echo 'main(){return 42;}' &gt; bar.c;
      gcc
      -o bar bar.c -L. -lfoo </font>
    <br>
    <font face="Arial" size="2">$ ./bar; echo $?</font>
    <br>
    <font face="Arial" size="2">42</font>
    <br>
    <font face="Arial" size="2">$ rm libfoo.so; ./bar; echo $?</font>
    <br>
    <font face="Arial" size="2">dyld: Library not loaded: libfoo.so</font><br>
    <br>
    and here on Ubuntu with linker defaulting to --as-needed:<br>
    <br>
    <font face="Arial" size="2">$ echo 'int foo(){return 42;}'&gt;
      foo.c;
      gcc -o libfoo.so -shared foo.c </font>
    <br>
    <font face="Arial" size="2">$ echo 'main(){return 42;}' &gt; bar.c;
      gcc
      -o bar bar.c -L. -lfoo </font>
    <br>
    <font face="Arial" size="2">$ ./bar; echo $?</font>
    <br>
    <font face="Arial" size="2">42</font>
    <br>
    $ rm libfoo.so; ./bar; echo $? <br>
    42<br>
    $ ldd -r -u bar<br>
    Unused direct dependencies:<br>
    <br>
    <br>
    Now we have a test, how do we solve the broken make check on Ubuntu
    anyway?<br>
    I would prefer a small/quick hack in place to repaire the broken
    make check on Ubuntu.<br>
    Then we have time to refactor the hack and make it the right way...<br>
    <br>
    Or may be I'm wrong in my suggestion, that Ubuntu is the first class
    citizen OS to hack on LO?<br>
    <br>
    Ciao<br>
    David<br>
    <br>
  </body>
</html>