libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing LD_RUN_PATH through to the linker


From: Tim Rice
Subject: Re: Passing LD_RUN_PATH through to the linker
Date: Sat, 17 Dec 2022 13:11:50 -0800 (PST)
User-agent: Alpine 2.11 (UW2 23 2013-08-11)

Hi Kevin,

On 12/15/22 1:29 PM, Kevin R. Bulgrien wrote:
>> On OpenServer, I usually just build with the SONAME being a full path name.
>>
>> I am attaching a patch to the libtool 2.4.6 generated during
>> a libssh2-1.8.0 build.
>>
>> Once all testing is complete, I do
>> ......
>> rm src/libssh2.la
>> SCOABSPATH=1 ; export SCOABSPATH
>> gmake 2>&1 | tee x.log
>> ......
>> then package.
>>
>> Note: the last hunk is to address a regression introduced in 2.4.6
>> with the freebsd reorg.
> 
> Thanks for the hint.  For some reason I've not been able to build libtool 
> 2.4.3
> and above due to a situation I don't know how to resolve:
> 
>       ...
>         GEN      libtoolize
>         GEN      libltdl/libltdl/lt__argz.h
>       make  all-recursive
>       make[1]: Entering directory `/csdi/src/sco507/gnu/libtool/libtool-2.4.6'
>       Making all in .
>       make[2]: Entering directory `/csdi/src/sco507/gnu/libtool/libtool-2.4.6'
>         CC       libltdl/loaders/libltdl_libltdl_la-preopen.lo
>       libtool: Version mismatch error.  This is libtool 2.4.6, revision 2.4.6,
>       libtool: but the definition of this LT_INIT comes from revision .
>       libtool: You should recreate aclocal.m4 with macros from revision 2.4.6
>       libtool: of libtool 2.4.6 and run autoconf again.
>       make[2]: *** [libltdl/loaders/libltdl_libltdl_la-preopen.lo] Error 63
>       make[2]: Leaving directory `/csdi/src/sco507/gnu/libtool/libtool-2.4.6'
>       make[1]: *** [all-recursive] Error 1
>       make[1]: Leaving directory `/csdi/src/sco507/gnu/libtool/libtool-2.4.6'
>       make: *** [all] Error 2
> 
> autoreconf, or at least the way I've done things, does not correct this issue.

No idea about this. I have not tried to build latest libtool on OpenServer 5
I usually patch libtool post configure on each package as needed
to get full path SONAME

> 
> Nevertheless, after applying your patch, it is possible to see that DT_SONAME
> now has a full path:
> 
>    $ readelf -d /usr/local/lib/libssh2.so.1 | grep SONAME
>     0x0000000e (SONAME)                     Library soname: 
> [/usr/local/lib/libssh2.so.1]
> 
> Unfortunately, this does not seem to cure loading of indirect dependencies as
> far as I can see:
> 
>    $ example/.libs/ssh2
>    Object:  Search Path DT_RUNPATH
>    /usr/local/lib
>    Object: example/.libs/ssh2 Search Path LD_LIBRARY_PATH
>    Object: example/.libs/ssh2 Search Path DT_RPATH
>    Object: example/.libs/ssh2 Search Path DEFAULT
>    /usr/lib
>    _rt_so_find: trying: /usr/local/lib/libssh2.so.1
>    Object: /usr/local/lib/libssh2.so.1 Search Path DT_RUNPATH
>    /usr/local/lib

With my patch, I would have expected DT_RINPATH to be empty.
But then, all my libs installed outside of /usr/lib have full path SONAME

>    search_dir_list: trying: /usr/local/lib/libcrypto.so.3
>    _rt_so_find: trying: /usr/lib/libz.so.1
>    search_dir_list: trying: /usr/local/lib/libssl.so.3
>    _rt_so_find: trying: /usr/lib/libcrypt.so
>    search_dir_list: trying: /usr/local/lib/libcrypto.so.3
>    _rt_so_find: trying: /usr/lib/libz.so.1
>    search_dir_list: trying: /usr/local/lib/libssl.so.3
>    _rt_so_find: trying: /usr/lib/libsocket.so.2
>    search_dir_list: trying: /usr/lib/libnsl.so
>    search_dir_list: trying: /usr/lib/libcrypto.so.3
>    dynamic linker : example/.libs/ssh2 : could not open libcrypto.so.3
>    Killed
> 
> Curiously, the above shows "trying /usr/local/lib/libcrypto.so.3" so I'm not
> sure what went wrong.
> 
>    $ ls -l /usr/local/lib/libcrypto.so.3
>    lrwxrwxrwx   1 root     sys           54 Dec 14 13:29 
> /usr/local/lib/libcrypto.so.3 -> 
> /opt/K/CSDI/openssl/3.0.3/usr/local/lib/libcrypto.so.3
>    $ ls -l /opt/K/CSDI/openssl/3.0.3/usr/local/lib/libcrypto.so.3
>    -rwxr-xr-x   1 root     sys      3731468 Dec 14 13:29 
> /opt/K/CSDI/openssl/3.0.3/usr/local/lib/libcrypto.so.3
> 

That is unexpected.
Are you on old 5.0.7 or the current Definitive 2018?
Does the system have all the patches? (run patchck)

> Perhaps a change to DT_NEEDED is also required so the indirect dependencies 
> also
> have paths:
> 
>    $ readelf -d /usr/local/lib/libssh2.so.1
> 
>    Dynamic segment at offset 0xfb40 contains 21 entries:
>      Tag        Type                         Name/Value
>     0x00000001 (NEEDED)                     Shared library: [libcrypto.so.3]
>     0x00000001 (NEEDED)                     Shared library: 
> [/usr/lib/libz.so.1]
>     0x00000001 (NEEDED)                     Shared library: [libssl.so.3]
>     0x0000000c (INIT)                       0x4dae0
>     0x0000000d (FINI)                       0x4daf0
>     0x0000000e (SONAME)                     Library soname: 
> [/usr/local/lib/libssh2.so.1]
>     0x0000001d (RUNPATH)                    Library runpath: [/usr/local/lib]
>     0x00000004 (HASH)                       0xc0
>     0x00000005 (STRTAB)                     0x5498
>     0x00000006 (SYMTAB)                     0x1408
>     0x0000000a (STRSZ)                      18886 (bytes)
>     0x0000000b (SYMENT)                     16 (bytes)
>     0x00000016 (TEXTREL)                    0x0
>     0x00000003 (PLTGOT)                     0x4ec2c
>     0x00000002 (PLTRELSZ)                   40 (bytes)
>     0x00000014 (PLTREL)                     REL
>     0x00000017 (JMPREL)                     0xfb18
>     0x00000011 (REL)                        0x9e60
>     0x00000012 (RELSZ)                      23736 (bytes)
>     0x00000013 (RELENT)                     8 (bytes)
>     0x00000000 (NULL)                       0x0
> 
> I'm assuming there must be something else different in the way we build.

Which development system are you using?
OpenServer 5.0..7 had 3 different ones available.
OpenServer 5 Definitive 2018 has 4. The latest being a GCC 4.2.4 and friends.

> 
> Regards,
> Kevin R. Bulgrien
> 

-- 
Tim Rice                                Multitalents
tim@multitalents.net





reply via email to

[Prev in Thread] Current Thread [Next in Thread]