Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 644420 - 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: undefined symbol: __rpc_createerr
Summary: dev-perl/Quota-1.7.2 - Can't load '/usr/lib64/perl5/vendor_perl/5.24.3/x86_64...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Christian Affolter
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-01-13 03:09 UTC by Marcel Greter
Modified: 2018-01-24 04:40 UTC (History)
2 users (show)

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


Attachments
patch to also link against libtirpc (Quota-1.7.2.ebuild.patch,578 bytes, patch)
2018-01-13 03:09 UTC, Marcel Greter
Details | Diff
patch with additional improvements (Quota-1.7.2.ebuild.full.patch,809 bytes, patch)
2018-01-13 03:36 UTC, Marcel Greter
Details | Diff
patch with additional improvements (Quota-1.7.2.ebuild.full.patch,814 bytes, patch)
2018-01-13 03:39 UTC, Marcel Greter
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Greter 2018-01-13 03:09:09 UTC
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!
Comment 1 Marcel Greter 2018-01-13 03:28:06 UTC
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"
}
Comment 2 Marcel Greter 2018-01-13 03:33:28 UTC
And finally the ebuild should also depend on net-libs/libtirpc!?
Comment 3 Marcel Greter 2018-01-13 03:36:58 UTC
Created attachment 514558 [details, diff]
patch with additional improvements
Comment 4 Marcel Greter 2018-01-13 03:39:03 UTC
Created attachment 514560 [details, diff]
patch with additional improvements
Comment 5 Marcel Greter 2018-01-13 03:42:59 UTC
Found the bug which introduced this issue:
https://bugs.gentoo.org/630568
Comment 6 Marcel Greter 2018-01-13 04:00:22 UTC
Also found the hopefully correct public repo:
https://github.com/gentoo/gentoo/pull/6845
Comment 7 Larry the Git Cow gentoo-dev 2018-01-24 04:40:55 UTC
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(-)