Compiling static Erlang

Grzegorz Junka list1 at gjunka.com
Sun Jul 12 14:54:37 UTC 2020


I am trying to compile Erlang so that it doesn't use shared libraries. 
The compilation fails with linking errors, two examples:

ld: error: relocation R_X86_64_PC32 cannot be used against symbol 
__stack_chk_guard; recompile with -fPIC
 >>> defined in /lib/libc.so.7
 >>> referenced by aes_ige.c:0 
(/usr/src-13/crypto/openssl/crypto/aes/aes_ige.c:0)
 >>>               aes_ige.o:(AES_ige_encrypt) in archive 
/usr/lib/libcrypto.a

ld: error: can't create dynamic relocation R_X86_64_32 against local 
symbol in readonly segment; recompile object files with -fPIC or pass 
'-Wl,-z,notext' to allow text relocations in the output
 >>> defined in /usr/lib/libcrypto.a(aes_ige.o)
 >>> referenced by aes_ige.c:47 
(/usr/src-13/crypto/openssl/crypto/aes/aes_ige.c:47)
 >>>               aes_ige.o:(AES_ige_encrypt) in archive 
/usr/lib/libcrypto.a

I understand it complains about /usr/lib/libcrypto.a and /lib/libc.so.7 
(in this example) not compiled with fPIC? Do I need to recompile world 
with fPIC enabled for this to work?

I was trying with these configure options:

./configure --prefix=/home/g/work/erlang --enable-pie --with-ssl 
--disable-dynamic-ssl-lib --disable-hipe --enable-builtin-zlip 
--enable-kernel-poll --enable-sctp --enable-native-libs 
--enable-dirty-schedulers --disable-shared --enable-static 
--with-javac=no --with-odbc=no

GrzegorzJ



More information about the freebsd-erlang mailing list