Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jul 2020 14:54:22 +0000
From:      Grzegorz Junka <list1@gjunka.com>
To:        freebsd-erlang@freebsd.org
Subject:   Compiling static Erlang
Message-ID:  <cb2be724-21d3-8543-3e79-77ae5b7e2253@gjunka.com>

next in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cb2be724-21d3-8543-3e79-77ae5b7e2253>