Created attachment 514556 [details, diff] patch to also link against libtirpc Running on a pretty fresh gentoo install (hardened/linux/amd64 profile) and encountered the following error with dev-perl/Quota-1.7.2: Can't load '/usr/lib64/perl5/vendor_perl/5.24.3/x86_64-linux-thread-multi/auto/Quota/Quota.so' for module Quota: /usr/lib64/perl5/vendor_perl/5.24.3/x86_64-linux-thread-multi/auto/Quota/Quota.so: undefined symbol: __rpc_createerr at /usr/lib64/perl5/5.24.3/x86_64-linux-thread-multi/DynaLoader.pm line 193. I tracked the error down to how the module is built. For completeness here the steps I did to reproduce and fix the issue: cd /var/tmp/portage/dev-perl/Quota-1.7.2/work/Quota-1.7.2 # this fails with the same error message make clean; perl Makefile.PL; make 'OTHERLDFLAGS=-Wl,-O1 -Wl,--as-needed' OPTIMIZE=-I/usr/include/tirpc test # removing OPTIMIZE fixes the issue make clean; perl Makefile.PL; make 'OTHERLDFLAGS=-Wl,-O1 -Wl,--as-needed' test No idea why the libtirpc include directory was added in the first place. I tried to make some sense out of it and will include this information also here. # grep -e "createerr" -R /usr/include/tirpc/ /usr/include/tirpc/rpc/clnt.h:extern void clnt_pcreateerror(const char *); /* stderr */ /usr/include/tirpc/rpc/clnt.h:extern char *clnt_spcreateerror(const char *); /* string */ /usr/include/tirpc/rpc/clnt.h:struct rpc_createerr { /usr/include/tirpc/rpc/clnt.h:extern struct rpc_createerr *__rpc_createerr(void); /usr/include/tirpc/rpc/clnt.h:#define get_rpc_createerr() (*(__rpc_createerr())) /usr/include/tirpc/rpc/clnt.h:#define rpc_createerr (*(__rpc_createerr())) # grep -e "createerr" -R /usr/include/rpc /usr/include/rpc/rpc.h:extern struct rpc_createerr *__rpc_thread_createerr (void) /usr/include/rpc/rpc.h:#define get_rpc_createerr() (*__rpc_thread_createerr ()) /usr/include/rpc/rpc.h: macro 'rpc_createerr' because this would prevent people from defining /usr/include/rpc/rpc.h: object of type 'struct rpc_createerr'. So we leave it up to the user /usr/include/rpc/rpc.h:# define rpc_createerr (*__rpc_thread_createerr ()) /usr/include/rpc/clnt.h:extern void clnt_pcreateerror (const char *__msg); /* stderr */ /usr/include/rpc/clnt.h:extern char *clnt_spcreateerror(const char *__msg) __THROW; /* string */ /usr/include/rpc/clnt.h:struct rpc_createerr { /usr/include/rpc/clnt.h:extern struct rpc_createerr rpc_createerr; # equery b /usr/include/rpc/rpc.h sys-libs/glibc-2.25-r9 (/usr/include/rpc/rpc.h) # equery b /usr/include/tirpc/rpc/rpc.h net-libs/libtirpc-1.0.2-r1 (/usr/include/tirpc/rpc/rpc.h) # ldd ./blib/arch/auto/Quota/Quota.so linux-vdso.so.1 (0x00007ffd9f3de000) libc.so.6 => /lib64/libc.so.6 (0x00007f001622d000) /lib64/ld-linux-x86-64.so.2 (0x00007f00167f2000) If I manually alter the linking to include "-ltirpc" it also works correctly. So the main culprit seems to be that it is using the includes from "libtirpc" but linking to "glibc". Interestingly I have an older instance where I have the same module installed since quite some time which works correctly. But recompiling it now leads to the same error. Finally what works is the following Makefile.PL call: INC="-I/usr/include/tirpc" OTHERLDFLAGS=-ltirpc I've patched the ebuild locally now with the following line: export mymake="INC=$($(tc-getPKG_CONFIG) --cflags libtirpc) OTHERLDFLAGS=$($(tc-getPKG_CONFIG) --libs libtirpc)" Didn't see any public github repo, otherwise I would have made a PR there. I will include the diff as an attachement to this bug report. Thanks and have a nice day!
It would probably make sense to add a minimal test in the ebuild too: src_test() { perl -Mblib -e 'use Quota' || die "Quota module not usable" }
And finally the ebuild should also depend on net-libs/libtirpc!?
Created attachment 514558 [details, diff] patch with additional improvements
Created attachment 514560 [details, diff] patch with additional improvements
Found the bug which introduced this issue: https://bugs.gentoo.org/630568
Also found the hopefully correct public repo: https://github.com/gentoo/gentoo/pull/6845
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f77afa38d6f043304e1713d6a121b59539c0a4fe commit f77afa38d6f043304e1713d6a121b59539c0a4fe Author: Marcel Greter <marcel.greter@ocbnet.ch> AuthorDate: 2018-01-13 03:57:10 +0000 Commit: Kent Fredric <kentnl@gentoo.org> CommitDate: 2018-01-24 04:40:43 +0000 dev-perl/Quota: Fix linkage against libtirpc bug #644420 - add dependency to libtirpc - add minimal test case Closes: https://bugs.gentoo.org/644420 Closes: https://github.com/gentoo/gentoo/pull/6845 dev-perl/Quota/Quota-1.7.2.ebuild | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)