creating Linux "portable" x64 binary

Paul Zillmann paul at zil.li
Fri Feb 22 13:08:00 UTC 2019


Hello Juan,

unfortunately is it not possible to static link the glibc.
You can try static link another libc like musl-libc [1].

Should there be any problems compiling OpenSSL with musl-libc, take a 
look at the packages from Alpine Linux [2], they are using musl as their 
standard libc.
You should get portable POSIX Linux ELF64 executables out of this process.

1: https://www.musl-libc.org/how.html
2: https://git.alpinelinux.org/aports/tree/main/openssl/APKBUILD

- Paul

Am 22.02.19 um 11:28 schrieb Juan Isoza:
>
>
> Hello,
> I want create for one of my application a Linux binary which run on 
> all current linux system running x86_64 processor.
>
> by example, I uses -static-libgcc -static-libstdc++ when I link my app 
> , because I'm not sure found recent version of this lib
> I also use -lrt to prevent search some tims function added on recent GLIBC
>
> With openssl 1.1.0, I had no problem related to openssl
>
> With openssl 1.1.1, there is somes modern function searched at compile 
> on recent library
>
> So, I just run these command
> sed -i -e 's/__ELF__/__ELF_and_sure_modern__/g' ./crypto/rand/rand_unix.c
> sed -i -e 's/__GLIBC_PREREQ/__GLIBC__not_use_PREREQ/g' 
> ./crypto/rand/rand_unix.c
> sed -i -e 's/__GLIBC_PREREQ/__GLIBC__not_use_PREREQ/g' ./crypto/getenv.c
> sed -i -e 's/__GLIBC_PREREQ/__GLIBC__not_use_PREREQ/g' ./crypto/crypto.c
> sed -i -e 's/__GLIBC_PREREQ/__GLIBC__not_use_PREREQ/g' ./crypto/uid.c
>
> with this modification, I'm sure that checking of modern API fail, and 
> I use previous api (like if I compile on oldest linux).
>
> I suggest offering an option to not trying using these modern 
> GLICBC_PREREQ , or pehaps uses dl (when openssl is compiled to uses dl)
>
> regards!



More information about the openssl-users mailing list