#44 Misleading error message + segfault
Closed 2 years ago by orbea. Opened 2 years ago by orbea.

slibtool: 3958623
scute: 1.7.0

scute has a bug where they create scute.la instead of libscute.la which results in an unexepected error:

rdlibtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -Wall -Wno-pointer-sign -Wpointer-arith -O2 -pipe -march=native -fno-diagnostics-color -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -o t-link t-link.o ../src/scute.la

rdlibtool: lconf: {.name="libtool"}.
rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/var/tmp/portage/app-crypt/scute-1.6.0/work/scute-1.6.0/tests"}.
rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 84, .st_ino = 765700}.
rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3.
rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 84, .st_ino = 765537}.
rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4.
rdlibtool: lconf: found "/var/tmp/portage/app-crypt/scute-1.6.0/work/scute-1.6.0/libtool".
rdlibtool: link: x86_64-pc-linux-gnu-gcc t-link.o -Wall -Wno-pointer-sign -Wpointer-arith -O2 -pipe -march=native -fno-diagnostics-color -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-rpath -Wl,/usr/lib64/pkcs11 -L../src/.libs -lte -L/usr/lib64 -lassuan -lgpg-error -o .libs/t-link
/usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lte
collect2: error: ld returned 1 exit status
rdlibtool: exec error upon slbt_exec_link_create_executable(), line 1731: (see child process error messages).
rdlibtool: < returned to > slbt_exec_link(), line 2051.
make[2]: *** [Makefile:773: t-link] Error 2
make[2]: Leaving directory '/var/tmp/portage/app-crypt/scute-1.6.0/work/scute-1.6.0/tests'
make[1]: *** [Makefile:448: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-crypt/scute-1.6.0/work/scute-1.6.0'
make: *** [Makefile:380: all] Error 2

See this gentoo issue: https://bugs.gentoo.org/782097

Now while this is a scute bug, slibtool should really have a clearer error message than cannot find -lte when there clearly is no -lte.

Additionally if its changed to te.la instead of scute.la (2 characters or less) slibtool will segfault.

rdlibtool --tag=CC --mode=link gcc -Wall -Wno-pointer-sign -Wpointer-arith -g -O2 -o t-link t-link.o ../src/te.la

rdlibtool: lconf: {.name="libtool"}.
rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/scute/tests"}.
rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 238070}.
rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3.
rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 237634}.
rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4.
rdlibtool: lconf: found "/tmp/scute/libtool".
make[1]: *** [Makefile:742: t-link] Segmentation fault
make[1]: Leaving directory '/tmp/scute/tests'
make: *** [Makefile:452: install-recursive] Error 1
Reading symbols from rdlibtool...
(gdb) r --tag=CC --mode=link gcc -Wall -Wno-pointer-sign -Wpointer-arith -g -O2 -o t-link t-link.o ../src/te.la
Starting program: /tmp/delme/slibtool/bin/rdlibtool --tag=CC --mode=link gcc -Wall -Wno-pointer-sign -Wpointer-arith -g -O2 -o t-link t-link.o ../src/te.la



/tmp/delme/slibtool/bin/rdlibtool --tag=CC --mode=link gcc -Wall -Wno-pointer-sign -Wpointer-arith -g -O2 -o t-link t-link.o ../src/te.la

rdlibtool: lconf: {.name="libtool"}.
rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/scute/tests"}.
rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 45, .st_ino = 238070}.
rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = -1 [ENOENT].
rdlibtool: lconf: openat(AT_FDCWD,"../",O_DIRECTORY,0) = 3.
rdlibtool: lconf: fstat(3,...) = 0 {.st_dev = 45, .st_ino = 237634}.
rdlibtool: lconf: openat(3,"libtool",O_RDONLY,0) = 4.
rdlibtool: lconf: found "/tmp/scute/libtool".
[Detaching after fork from child process 24835]

Program received signal SIGSEGV, Segmentation fault.
0x0000555555569f4f in slbt_exec_link_adjust_argument_vector (dctx=0x555555583860, ectx=0x5555555850b8, depsmeta=0x7fffffff3300, cwd=0x7fffffff33b0 "/tmp/scute/tests", flibrary=false)
    at src/logic/slbt_exec_link.c:587
587                 *dot = 0;
(gdb) bt
PREPROCIMPLLINK0  0x0000555555569f4f in slbt_exec_link_adjust_argument_vector (dctx=0x555555583860, ectx=0x5555555850b8, depsmeta=0x7fffffff3300, cwd=0x7fffffff33b0 "/tmp/scute/tests", 
    flibrary=false) at src/logic/slbt_exec_link.c:587
PREPROCIMPLLINK1  0x000055555556df52 in slbt_exec_link_create_executable (dctx=0x555555583860, ectx=0x5555555850b8, exefilename=0x55555558469e ".libs/t-link") at src/logic/slbt_exec_link.c:1685
PREPROCIMPLLINK2  0x000055555556f538 in slbt_exec_link (dctx=0x555555583860, ectx=0x5555555850b8) at src/logic/slbt_exec_link.c:2058
PREPROCIMPLLINK3  0x00005555555576c9 in slbt_perform_driver_actions (dctx=0x555555583860) at src/driver/slbt_amain.c:78
PREPROCIMPLLINK4  0x0000555555557bab in slbt_main (argv=0x7fffffffe618, envp=0x7fffffffe688, fdctx=0x0) at src/driver/slbt_amain.c:194
PREPROCIMPLLINK5  0x000055555557798d in main (argc=13, argv=0x7fffffffe618, envp=0x7fffffffe688) at src/slibtool.c:14
(gdb) bt full
PREPROCIMPLLINK0  0x0000555555569f4f in slbt_exec_link_adjust_argument_vector (dctx=0x555555583860, ectx=0x5555555850b8, depsmeta=0x7fffffff3300, cwd=0x7fffffff33b0 "/tmp/scute/tests", 
    flibrary=false) at src/logic/slbt_exec_link.c:587
        fd = 0
        fdcwd = -100
        carg = 0x555555585280
        aarg = 0x555555585878
        ldir = 0x0
        slash = 0x7ffffffee290 "so"
        mark = 0x555555584692 "-lso"
        darg = 0x555555585770 ""
        dot = 0x0
        base = 0x0
        dpath = 0x7ffffffef280 "../src/.libs/te.so.slibtool.deps"
        argc = 63
        arg = "../src/.libs\000te.so", '\000' <repeats 4077 times>
        lib = "../src/.libs/te.so.slibtool.deps", '\000' <repeats 3800 times>...
        depdir = '\000' <repeats 1656 times>...
        rpathdir = '\000' <repeats 1912 times>...
        rpathlnk = "../src/.libs/te.so.slibtool.rpath", '\000' <repeats 15 times>, "\221\232WUUU\000\000\300\224\372\367\377\177", '\000' <repeats 18 times>, "\a\000\000\000\000\000\000\000\377\377\377\377\377\377\377\377\000\000\000\000\000\000\000\000\002", '\000' <repeats 15 times>, "\240#\377\377\377\177", '\000' <repeats 122 times>...
        st = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, 
            tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __glibc_reserved = {0, 0, 0}}
        size = 173
        dlen = 0
        mapinfo = 0x0
        fwholearchive = false
        ret = 0
        __func__ = "slbt_exec_link_adjust_argument_vector"
PREPROCIMPLLINK1  0x000055555556df52 in slbt_exec_link_create_executable (dctx=0x555555583860, ectx=0x5555555850b8, exefilename=0x55555558469e ".libs/t-link") at src/logic/slbt_exec_link.c:1685
        fdcwd = -100
        fdwrap = 3
        parg = 0x5555555852e0
        xarg = 0x5555555853e8
        base = 0x0
        ccwrap = 0x0
        cwd = "/tmp/scute/tests", '\000' <repeats 4079 times>
        dpfixup = "${0%/*}/", '\000' <repeats 4087 times>
        output = ".libs/t-link", '\000' <repeats 4083 times>
        wrapper = "t-link.wrapper.tmp", '\000' <repeats 4077 times>
        wraplnk = '\000' <repeats 1992 times>...
        fabspath = false
        fpic = true
        verinfo = 0x555555580c20 <slbt_src_version>
        depsmeta = {altv = 0x555555585830, args = 0x555555585770 "", depscnt = 3, infolen = 173}
        st = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, 
            tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __glibc_reserved = {0, 0, 0}}
        __func__ = "slbt_exec_link_create_executable"
PREPROCIMPLLINK2  0x000055555556f538 in slbt_exec_link (dctx=0x555555583860, ectx=0x5555555850b8) at src/logic/slbt_exec_link.c:2058
        ret = 0
        output = 0x55555558340d "t-link"
        dot = 0x0
        actx = 0x5555555850b8
        fpic = true
        fstaticonly = false
        soname = "(null)(null).so.0", '\000' <repeats 4078 times>
        soxyz = "(null)(null).so.0.0.0", '\000' <repeats 4074 times>
        solnk = "(null)(null).so", '\000' <repeats 4080 times>
        arname = "lib(null).a", '\000' <repeats 1773 times>...
        target = "\357\vQ\371\000\000\000\000ޱ\375\367\377\177\000\000\372\005\000\000\000\000\000\000\354\255\375\367\377\177\000\000\001\000\000\000\000\000\000\000\360EUUUU\000\000\000\340\372\367\377\177\000\000,JUUUU\000\000[\232;\017\000\000\000\000ޱ\375\367\377\177\000\000\f\a\000\000\000\000\000\000x\341\335\367\377\177\000\000\000\340\372\367\377\177\000\000\b\305\377\377\377\177\000\000\004\305\377\377\377\177\000\000 \345\372\367\377\177\000\000\000\000\000\000\377\177\000\000XDUUUU\000\000x\341\335\367\377\177\000\000\060\000\335\367\377\177\000\000,JUUUU\000\000i\356<\000\000\000\000\000\004\305\377\377\377\177\000\000 \345\372\367\377\177\000\000\320\305\377\377\377\177\000\000\360E"...
        lnkname = '\000' <repeats 16 times>, "x\341\335\367\377\177\000\000\060\000\335\367\377\177\000\000YIUUUU\000\000<Ԗ\002\000\000\000\000\204\324\377\377\377\177\000\000 \345\372\367\377\177\000\000P\325\377\377\377\177\000\000\030HUUUU\000\000@\325\377\377\377\177\000\000\020\000\000\000\060\000\000\000\340\332\377\377\377\177\000\000 \332\377\377\377\177\000\000\000\340\372\367\377\177\000\000$JUUUU\000\000W\323\003\266\000\000\000\000ޱ\375\367\377\177\000\000\006\a\000\000\000\000\000\000\354\255\375\367\377\177\000\000\001\000\000\000\000\000\000\000\200CUUUU\000\000\000\340\372\367\377\177\000\000KIUUUU\000\000\366#\316 \000\000\000\000ޱ\375"...
        __func__ = "slbt_exec_link"
PREPROCIMPLLINK3  0x00005555555576c9 in slbt_perform_driver_actions (dctx=0x555555583860) at src/driver/slbt_amain.c:78
No locals.
PREPROCIMPLLINK4  0x0000555555557bab in slbt_main (argv=0x7fffffffe618, envp=0x7fffffffe688, fdctx=0x0) at src/driver/slbt_amain.c:194
        ret = 0
        harg = 0x0
        fdout = 1
        flags = 65669
        noclr = 0
        dctx = 0x555555583860
        program = 0x7fffffffe95c "rdlibtool"
        dash = 0x0
        sargv = {0x0, 0x0, 0xf0b6ff <error: Cannot access memory at address 0xf0b6ff>, 0xc2 <error: Cannot access memory at address 0xc2>, 0x7fffffffe507 ""}
PREPROCIMPLLINK5  0x000055555557798d in main (argc=13, argv=0x7fffffffe618, envp=0x7fffffffe688) at src/slibtool.c:14
No locals.

Bug report + patch for the scute upstream.

https://dev.gnupg.org/T5394

Perhaps this is not a scute bug at all.

Ordinarily, Automake requires that a library’s name start with lib. However, when building a dynamically loadable module you might wish to use a "nonstandard" name. Automake will not complain about such nonstandard names if it knows the library being built is a libtool module, i.e., if -module explicitly appears in the library’s _LDFLAGS variable (or in the common AM_LDFLAGS variable when no per-library _LDFLAGS variable is defined).

https://www.gnu.org/software/automake/manual/html_node/Libtool-Modules.html

Also from the scute issue:

apparently Debian’s policy says the library/module should be called scute

This is actually a scute issue using non-portable GNU libtool behavior that allows linking against a libtool module even when those are intended only for use with dlopen. However slibtool now supports this behavior too.

9c5ba5e

Metadata Update from @orbea:
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata