mail-mta/exim-{4.72,4.73} USE="-*" fails due to missing -ldl x86_64-pc-linux-gnu-gcc -o exim -rdynamic -ldl acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o directory.o dns.o drtables.o enq.o exim.o expand.o filter.o filtertest.o globals.o dkim.o header.o host.o ip.o log.o lss.o match.o moan.o os.o parse.o queue.o rda.o readconf.o receive.o retry.o rewrite.o rfc2047.o route.o search.o sieve.o smtp_in.o smtp_out.o spool_in.o spool_out.o store.o string.o tls.o tod.o transport.o tree.o verify.o local_scan.o malware.o mime.o regex.o spam.o spool_mbox.o demime.o bmi_spam.o spf.o srs.o dcc.o version.o \ routers/routers.a transports/transports.a lookups/lookups.a \ auths/auths.a pdkim/pdkim.a \ -lresolv -lnsl -lcrypt -lm \ -ldb \ -lpcre -Wl,-O1 -Wl,--as-needed -Wl,-z,now -Wl,--sort-common local_scan.o: In function `local_scan': local_scan.c:(.text+0x5e): undefined reference to `dlopen' local_scan.c:(.text+0x77): undefined reference to `dlsym' local_scan.c:(.text+0x91): undefined reference to `dlsym' local_scan.c:(.text+0xba): undefined reference to `dlclose' local_scan.c:(.text+0xe7): undefined reference to `dlerror' local_scan.c:(.text+0x19c): undefined reference to `dlclose' local_scan.c:(.text+0x1d9): undefined reference to `dlsym' local_scan.c:(.text+0x1f1): undefined reference to `dlclose' local_scan.c:(.text+0x229): undefined reference to `dlclose' local_scan.c:(.text+0x249): undefined reference to `dlclose' It also looks like LDFLAGS are passed at the end which should be at the beginning usually.
passing -ldl as EXTRALIBS in ebuild should fix it, it's suggested way by upstream in src/EDITME what's left to be done is don't pass library via LDFLAGS and put it in correct order
> x86_64-pc-linux-gnu-gcc -o exim -rdynamic -ldl The -ldl is actually in there. Doesn't fail for me, but --as-needed comes later in the pipe. We can discuss the ordering here, but Exim's build system isn't all that standard. Anyhow, I can't reproduce your issue here with 4.74-r1.
per comment #2
Still fails here, even with 4.76
Created attachment 278921 [details] build.log
what is your /bin/sh?
/bin/sh: line 66: export: `LFLAGS+': not a valid identifier That line is from the localscan_dlopen patch, which sets -ldl for Linux, but fails because /bin/sh doesn't like it, apparently
lrwxrwxrwx 1 root root 9 Jun 16 20:56 /bin/sh -> /bin/bash* If it is really a shell script then it shouldn't use += anyway.
it is a makefile, odd it works for me (on Linux).
I updated the patch to include spaces around the = and in particular the +=, can you try if this helps you to get further?
Created attachment 279023 [details] build.log The sh error has been fixed but not the main issue
from your log: > x86_64-pc-linux-gnu-gcc -o exim -rdynamic -ldl So -ldl is in there. What's in your LDFLAGS? I suspect the linker doesn't like -ldl given this early in the process (before the object that needs it or something). It apparently is stripped out of the list of libs to take into consideration.
Ah, right.. I didn't notice the -ldl there. Now it is a as-needed issue.
yup, I just read up on it, and I think I've found a solution.
I just committed a fix, which I really hope fixes this issue. It remains odd that I cannot reproduce it. The link line should be as suggested in [1] now (although that document mentions as-needed is experimental and shouldn't be used in production environments). http://www.gentoo.org/proj/en/qa/asneeded.xml
as-needed is enabled by default in Gentoo for months. The only difference here is that I *force* as-needed. So you can only reproduce it if you force it as well, through the gcc rules/specs file. See code listing 1.4 from your link. I'll test the patch later and let you know if it is fixed or not.
I know it is enabled by default for months, but QA apparently considers it still a no-no. Anyway, that's beside the point here. I see now. Forcing as-needed indeed will trigger the problem, which explains why only a few people see this. Good!
Works, thx :)