[lsb-discuss] Trying to link libreadline.a, LSB 4.0 on SLES11

Dallman, John john.dallman at siemens.com
Fri Apr 8 14:36:59 UTC 2016


> The two-letter all-caps ones typically come from libtinfo (which is part of
> the ncurses build, but a separate library), and in fact I find them there
> when looking.

I can't find libtinfo on this SLES11sp1 system. I have libncurses:

rpm -q -filesbypkg libncurses5-5.6-90.55
libncurses5               /lib64/libncurses.so.5
libncurses5               /lib64/libncurses.so.5.6
libncurses5               /lib64/libncursesw.so.5
libncurses5               /lib64/libncursesw.so.5.6
libncurses5               /usr/lib64/libform.so.5
libncurses5               /usr/lib64/libform.so.5.6
libncurses5               /usr/lib64/libformw.so.5
libncurses5               /usr/lib64/libformw.so.5.6
libncurses5               /usr/lib64/libmenu.so.5
libncurses5               /usr/lib64/libmenu.so.5.6
libncurses5               /usr/lib64/libmenuw.so.5
libncurses5               /usr/lib64/libmenuw.so.5.6
libncurses5               /usr/lib64/libpanel.so.5
libncurses5               /usr/lib64/libpanel.so.5.6
libncurses5               /usr/lib64/libpanelw.so.5
libncurses5               /usr/lib64/libpanelw.so.5.6
libncurses5               /usr/lib64/libtic.so.5
libncurses5               /usr/lib64/libtic.so.5.6

I don't have a /lib64/libtinfo* or /usr/lib64/libtinfo*. I have /usr/lib64/libtic*, but that seems to be part of tic, the terminal information compiler. Any guesses as to other packages that might contain it?

I'm not going for the battery yet, because I'd like to solve this using as few additional installs as possible. This is because I am not competent at Linux sysadmin, nor authorised to do it (I'm a developer) and need to minimise what I ask my sysadmins to do, across a large number of Linux machines.

--
John Dallman
DF PL TO OT PC PDE
Technology & Innovation

Siemens Industry Sector
Siemens Industry Software Limited
Francis House, 112 Hills Road,
Cambridge CB2 1DP, United Kingdom
Tel.      :+44 (1223) 371554
Fax       :+44 (1223) 371700
john.dallman at siemens.com
www.siemens.com/plm

-----Original Message-----
From: Mats Wichmann [mailto:mats at wichmann.us]
Sent: Thursday, April 07, 2016 4:36 PM
To: Dallman, John (DF PL TO OT PC PDE); lsb-discuss at lists.linux-foundation.org
Subject: Re: [lsb-discuss] Trying to link libreadline.a, LSB 4.0 on SLES11

On 04/07/2016 08:11 AM, Dallman, John wrote:
> I've been building the production build Parasolid solid-modelling library and its test harness to LSB standards for a long time, and it has worked well. There is also a build with a lot of debugging code compiled in that has not been built LSB until now, but I'm trying to fix that. The debugging build is used interactively much more than the production build, and has used GNU readline for many years. But that's where I'm stuck.
>
> Readline is not an LSB-supported library at LSB 4.0.When I link, lsbcc forces it to be linked statically, which is what I want. But then the linker can't find a bunch of other symbols:
>
> Warning: forcing readline to be linked statically
> /usr/lib64/libreadline.a(util.o): In function `_rl_abort_internal':
> /usr/src/packages/BUILD/readline-5.2/util.c:112: undefined reference to `__longjmp_chk'
> /usr/lib64/libreadline.a(terminal.o): In function `_rl_init_terminal_io':
> /usr/src/packages/BUILD/readline-5.2/terminal.c:498: undefined reference to `PC'
> /usr/src/packages/BUILD/readline-5.2/terminal.c:499: undefined reference to `BC'
> /usr/src/packages/BUILD/readline-5.2/terminal.c:500: undefined reference to `UP'
> /usr/src/packages/BUILD/readline-5.2/terminal.c:509: undefined reference to `PC'
> /usr/src/packages/BUILD/readline-5.2/terminal.c:510: undefined reference to `BC'
> /usr/src/packages/BUILD/readline-5.2/terminal.c:511: undefined reference to `UP'
> /usr/lib64/libreadline.a(mbutil.o): In function `mbrlen':
> /usr/include/wchar.h:399: undefined reference to `__mbrlen'
> /usr/include/wchar.h:399: undefined reference to `__mbrlen'
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin
> /ld: ./kid.out: hidden symbol `stat' in
> /usr/lib64/libc_nonshared.a(stat.oS) is referenced by DSO
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin
> /ld: final link failed: Nonrepresentable section on output
> collect2: ld returned 1 exit status
>
> So I seem to be missing symbols __longjmp_chk, BC, PC, UP and __mbrlen, and all of those are undefined symbols in libreadline.a.
>
> libc.so.6 has __longjmp_chk, and __mbrlen, but I don't know why they aren't being picked up. libc.so.6 does not have BC, PC or UP.
>
> My link line is:
>
> /opt/lsb/bin/lsbcc -m64 -Wformat -Wformat-security -D_FORTIFY_SOURCE=1
> -fPIC /Parasolid/lx86/t281_test_lsb4/lsp/kernel.o
> /usr/local/sw_tools/lib/aga_fix.o -L/Parasolid/lx86/tools/lib/64
> -lreadline /Parasolid/lx86/t281_test_lsb4/system/support_part1.so
> /Parasolid/lx86/t281_test_lsb4/system/support_part2.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part1.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part2.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part3.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part4.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part5.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part6.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part7.so
> /Parasolid/lx86/t281_test_lsb4/system/ps_part8.so -lncurses -lpthread
> -lX11 -lc -lm -ldl -Wl,-rpath,/Parasolid/lx86/tools/lib/64 -o kid.out
>
> main() is in kernel.o, and the code that invokes readline functions is in support_part1.so or support_part2.so.
>
> I'm working on 64-bit SLES11sp1, targeting LSB 4.0, with this collection of LSB packages:
>
> lsb-build-base-4.0.1-1
> lsb-build-c++-4.0.2-1
> lsb-build-cc-4.0.1-1
> lsb-build-desktop-4.0.1-1
> lsb-build-qt3-4.0.0-5
> lsb-build-qt4-4.0.1-1
>
> I'm baffled, in part because I can't find a way to look at what symbols are in what sharable libraries. nm and objdump -t refuse for several of them.

The two-letter all-caps ones typically come from libtinfo (which is part of the ncurses build, but a separate library), and in fact I find them there when looking.

There is some past work on making a static readline work in an LSB context, don't know if it's gone out of date now.  It _should_ be in http://bzr.linuxfoundation.org/lsb/devel/appbat/patches, but it looks like our version control browser has gone dead - I'll ping licquia on that (or hopefully he's listening here).  I've attached the patch to this reply as a convenience.

You may also be able to use our "library battery" (a package named lsb-build-libbat), which has a prepared libreadline.a built in the LSB context, and thus not loaded with "illegal" symbols. Unfortunately, I can't tell you exactly where to get a 4.0 copy of that from either. I have a 4.1 version sitting here which I could send, if we can't find these in the package ftp site - I didn't spot in a brief look but that means little.

As far as hunting for symbols, I tend to use readelf, as in:

readelf -sW /usr/lib64/libtinfo.so.5.9 | grep -w BC

you have to take care that some apparent shared libraries are not... for example libc.so and libpthread.so on the native system are not libraries, but linker directive files and so have to hunt to find the _real_ shared library.


Hope this helps...

-- mats

-----------------
Siemens Industry Software Limited is a limited company registered in England and Wales.
Registered number: 3476850.
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.


More information about the lsb-discuss mailing list