On Tue, Jan 19 2021, Charlene Wendling <[email protected]> wrote:
> Hi,
>
>> http://build-failures.rhaalovely.net/mips64/2021-01-12/devel/fmt.log
> (and the same in the current bulk for the other clang+ld.bfd arch,
> macppc)
>
> As often '-Wl,--as-needed' causes undefined reference errors with
> ld.bfd. Surprisingly gcc archs are not impacted.
>
> target_link_libraries() takes precedence over our LDFLAGS, so i could
> not use them.
>
> Sadly cmake has not meson's 'b_asneeded' out of the box, so i've added
> an AS_NEEDED option, which is ON by default, bringing no change
> to clang+ld.lld archs, and turn it OFF on clang+ld.bfd archs.
>
> That also means no REVISION bump is needed (fmt has never been built on
> impacted archs).
>
> With the below diff i can build fmt and pass its tests on macppc [0].
> mips64 seems to have further problems, i'm not 100% positive it would
> fix the build there.
>
> I would be happy to upstream this, but it seems they preferred an OS
> centric approach which doesn't play nice with our situation.
>
> Comments and feedback are welcome,

IIRC this is a bug in binutils, and it's not likely to be fixed soon.

cmake itself provides
https://cmake.org/cmake/help/latest/prop_tgt/LINK_WHAT_YOU_USE.html but
I doubt that it would help us autodetect that --as-needed doesn't work.

An alternative would be to just strip --as-needed on all archs and keep
that as a local patch (we probably don't care about the improvements
from --as-needed).  But your approach makes sense too.  ok jca@ fwiw

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to