Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 828856 - app-admin/authbind-2.1.2 fails to compile with clang/lld
Summary: app-admin/authbind-2.1.2 fails to compile with clang/lld
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: LD-is-lld, systemwide-lld
  Show dependency tree
 
Reported: 2021-12-10 18:46 UTC by Agostino Sarubbo
Modified: 2022-06-14 14:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,38.33 KB, text/plain)
2021-12-10 18:46 UTC, Agostino Sarubbo
Details
0001-app-admin-authbind-don-t-call-LD-directly.patch (file_828856.txt,3.09 KB, patch)
2022-06-14 14:30 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2021-12-10 18:46:24 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: app-admin/authbind-2.1.2 fails to compile with clang/lld.
Discovered on: amd64 (internal ref: tinderbox)

NOTE:
This machine uses clang as a compiler and lld as a linker.
Comment 1 Agostino Sarubbo gentoo-dev 2021-12-10 18:46:26 UTC
Created attachment 758311 [details]
build.log

build log and emerge --info
Comment 2 Agostino Sarubbo gentoo-dev 2021-12-10 18:46:27 UTC
Error(s) that match a know pattern:

ld.lld: error: unable to find library -ldl
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-14 13:23:22 UTC
I think this is caused by setting LD which we consider to be unsupported. You should just set -fuse-ld instead.
Comment 4 Agostino Sarubbo gentoo-dev 2022-06-14 13:32:32 UTC
(In reply to Sam James from comment #3)
> I think this is caused by setting LD which we consider to be unsupported.
> You should just set -fuse-ld instead.

This is what was done, unless I misunderstood what are you saying:

x86_64-pc-linux-gnu-clang -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld  authbind.o   -o authbind
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-14 13:40:15 UTC
(In reply to Agostino Sarubbo from comment #4)
> (In reply to Sam James from comment #3)
> > I think this is caused by setting LD which we consider to be unsupported.
> > You should just set -fuse-ld instead.
> 
> This is what was done, unless I misunderstood what are you saying:
> 
> x86_64-pc-linux-gnu-clang -Wl,-O1 -Wl,--as-needed
> -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld  authbind.o   -o
> authbind

So, it works for me if I *just* do *FLAGS="... -fuse-ld=lld", but if I set LD=ld.lld, it fails like in this bug.

Setting LD (and calling LD directly in the build system) is considered obsolete and most things don't support it. It's because calling LD is inflexible and doesn't allow passing options correctly.

So, I would not bother setting LD=... in the tinderbox. Only -fuse-ld=foo.
Comment 6 Agostino Sarubbo gentoo-dev 2022-06-14 13:53:09 UTC
(In reply to Sam James from comment #5)
> (In reply to Agostino Sarubbo from comment #4)
> > (In reply to Sam James from comment #3)
> > > I think this is caused by setting LD which we consider to be unsupported.
> > > You should just set -fuse-ld instead.
> > 
> > This is what was done, unless I misunderstood what are you saying:
> > 
> > x86_64-pc-linux-gnu-clang -Wl,-O1 -Wl,--as-needed
> > -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld  authbind.o   -o
> > authbind
> 
> So, it works for me if I *just* do *FLAGS="... -fuse-ld=lld", but if I set
> LD=ld.lld, it fails like in this bug.

Right, but I guess this is a case where it uses $LD instead of $CC/CXX for link
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-14 14:02:07 UTC
(In reply to Agostino Sarubbo from comment #6)
> (In reply to Sam James from comment #5)
> > (In reply to Agostino Sarubbo from comment #4)
> > > (In reply to Sam James from comment #3)
> > > > I think this is caused by setting LD which we consider to be unsupported.
> > > > You should just set -fuse-ld instead.
> > > 
> > > This is what was done, unless I misunderstood what are you saying:
> > > 
> > > x86_64-pc-linux-gnu-clang -Wl,-O1 -Wl,--as-needed
> > > -Wl,--defsym=__gentoo_check_ldflags__=0 -fuse-ld=lld  authbind.o   -o
> > > authbind
> > 
> > So, it works for me if I *just* do *FLAGS="... -fuse-ld=lld", but if I set
> > LD=ld.lld, it fails like in this bug.
> 
> Right, but I guess this is a case where it uses $LD instead of $CC/CXX for
> link

Ah! I was about to write "I think it uses LD if it's set, but if it's not, it'll do the right thing" (this has happened lots before), but you're right!

But there's some bad news too:
ld.lld: error: duplicate symbol: _init
>>> defined at /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/../../../../lib64/crti.o:(.init+0x0)
>>> defined at libauthbind.c:116 (/var/tmp/portage/app-admin/authbind-2.1.2/work/authbind/libauthbind.c:116)
>>>            libauthbind.o:(.text+0x340)
collect2: error: ld returned 1 exit status

It's doing something quite naughty :(
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-14 14:30:02 UTC
Created attachment 785003 [details, diff]
0001-app-admin-authbind-don-t-call-LD-directly.patch

I'm not sure if the attached patch is right or not. The behaviour differs when invoked as ld vs via the gcc driver. I tried to see the relevant options but didn't figure it out.

I'm not sure how to test the authbind library either. Hm.