mailing list of musl libc
 help / color / mirror / code / Atom feed
* BUG: $ORIGIN does not seem to work
@ 2018-01-26 13:39 Stefan Fröberg
  2018-01-26 14:21 ` Szabolcs Nagy
  2018-01-26 16:34 ` Rich Felker
  0 siblings, 2 replies; 14+ messages in thread
From: Stefan Fröberg @ 2018-01-26 13:39 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]

Hello

On glibc the following:

gcc  -o x -Wl,-rpath='$ORIGIN/lib' x.c -L ./lib -lcrypto

or

gcc  -o x -Wl,-rpath,'$ORIGIN/lib' x.c -L ./lib -lcrypto

Gives me binary with relative library path

ldd x
    linux-vdso.so.1 (0x00007ffcb6bee000)
*    libcrypto.so.1.0.0 => /home/wizard/kal-el/lib/libcrypto.so.1.0.0
(0x00007f0bc3593000)**
*    libc.so.6 => /lib64/libc.so.6 (0x00007f0bc31e2000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f0bc2fde000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f0bc2dc7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f0bc39d2000)

cp -rap kal-el/* batman/
ldd x
    linux-vdso.so.1 (0x00007ffdbf0b6000)
*    libcrypto.so.1.0.0 => /home/wizard/batman/lib/libcrypto.so.1.0.0
(0x00007fb682149000)**
*    libc.so.6 => /lib64/libc.so.6 (0x00007fb681d98000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb681b94000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fb68197d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb682588000)


But trying the same with musl does not seem to work?
ldd x
/lib/ld-musl-x86_64.so.1 (0x7f07372e2000)
    libc.so => /lib/ld-musl-x86_64.so.1 (0x7f07372e2000)

and if i remove the -L ./lib from the command it uses system library
gcc  -o x -Wl,-rpath,'$ORIGIN/lib'  x.c   -lcrypto
ldd xx
    /lib/ld-musl-x86_64.so.1 (0x7fdd8618d000)
    libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x7fdd85ed7000)
    libc.so => /lib/ld-musl-x86_64.so.1 (0x7fdd8618d000)


GCC version 7.2 and musl 1.1.18

GCC configured with the following:
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-musl/7.2.0/lto-wrapper
Target: x86_64-linux-musl
Configured with: ../configure --prefix=/usr --build=x86_64-linux-musl
--enable-languages=c,c++,lto --disable-multilib --disable-nls
--disable-libmudflap --disable-libsanitizer --with-system-zlib
--disable-werror --enable-gold=yes --enable-ld=yes --enable-plugin
--enable-plugins --enable-lto --enable-default-pie --enable-default-ssp
--with-linker-hash-style=gnu --enable-libgomp --with-fpmath=sse
Thread model: posix
gcc version 7.2.0 (GCC)


Best regards
Stefan Fröberg

x.c
------------------------------
#include <stdio.h>
#include <openssl/ssl.h>

int main(void)
{
   
OPENSSL_init_crypto(OPENSSL_INIT_NO_ADD_ALL_CIPHERS|OPENSSL_INIT_NO_ADD_ALL_DIGESTS,NULL);
    return(0);
}


[-- Attachment #2: Type: text/html, Size: 3174 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-02-07 20:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 13:39 BUG: $ORIGIN does not seem to work Stefan Fröberg
2018-01-26 14:21 ` Szabolcs Nagy
2018-01-26 23:50   ` Stefan Fröberg
2018-01-27 11:07     ` Szabolcs Nagy
2018-01-27 16:20       ` Stefan Fröberg
2018-01-27 16:42         ` Rich Felker
2018-01-27 17:14           ` Stefan Fröberg
2018-01-27 19:26         ` Szabolcs Nagy
2018-01-27 22:07           ` Stefan Fröberg
2018-01-28  0:54             ` Szabolcs Nagy
2018-02-07 17:35               ` Rich Felker
2018-02-07 20:28                 ` Szabolcs Nagy
2018-01-26 16:34 ` Rich Felker
2018-01-26 21:28   ` Stefan Fröberg

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).