On 07/25/2013 04:55 AM, Markus Koschany wrote:
> On 25.07.2013 05:05, Micah Gersten wrote:
> [...]
>> In Ubuntu, the attached patch was applied to achieve the following:
>>
>>   * Drop -lm from rules file since LDFLAGS is the wrong place for this
>>     - update debian/rules
>>   * Add a patch to more properly fix the build system
>>     - add debian/patches/fix-ld-no-add-needed.patch
>>     - update debian/patches/series
>>
> 
> Hello Micah,
> 
> thanks for the bug report. I have no objections against your patch but i
> would like to understand why adding -lm to LDFLAGS is the wrong place in
> this case here.
> 
> Basically your patch and appending -lm to DEB_LDFLAGS_MAINT_APPEND in
> debian/rules do the same thing and I also pass -Wl, --as-needed to the
> build system. Do you ignore DEB_LDFLAGS_MAINT_APPEND at Ubuntu and why
> do you do that?

I don't think we're ignoring DEB_LDFLAGS_MAINT_APPEND, but with
--as-needed, -lm isn't in the right place if it's appended by LDFLAGS.
I think the reason it works in Debian is that you're calling it after
you pass -lm and in Ubuntu, we already have --as-needed before that.

>From the autoconf manual [1]:
 — Variable: LDFLAGS

    Options for the linker. If it is not set in the environment when
configure runs, the default value is empty. configure uses this variable
when linking programs to test for C, C++, Objective C, Objective C++,
and Fortran features.

    This variable's contents should contain options like -s and -L that
affect only the behavior of the linker. Please see the explanation of
CFLAGS for what you can do if an option also affects other phases of the
compiler.

    Don't use this variable to pass library names (-l) to the linker;
use LIBS instead.

— Variable: LIBS

    -l options to pass to the linker. The default value is empty, but
some Autoconf macros may prepend extra libraries to this variable if
those libraries are found and provide necessary functions, see
Libraries. configure uses this variable when linking programs to test
for C, C++, Objective C, Objective C++, and Fortran features.

There's a wiki entry here about --as-needed [2].  I think I understand
these things well enough to fix them, but not necessarily well enough to
explain them.  AIUI, if symbols aren't needed when they're resolved,
they're dropped, so order now matters in the library link listing.

FWIW, I've seen a lot of maintainers fixing these issues in a similar
way to what you did and was about to ask one of the toolchain
maintainers to write a mail to debian-devel or even d-d-a about it.

I hope this helps.

Thanks,
Micah

[1]
http://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Preset-Output-Variables.html
[2]
http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to