[erlang-patches] Crypto Compile Problem on x86_64 OTP-R11B

Daniel Schutte <>
Sun Nov 18 17:57:39 CET 2007


I have seen a few postings on the web regarding this error - specifically in 
the e-jabberd lists.  The solution is given as compiling with gcc 4.0 instead 
of 4.1.
Erlang Compiles fine, it's just the crypto module that is incomplete - more 
specifically the driver.


================ ENVIRONMENT =====
================ OS =====
(CentOS 5.0)
Linux cupid.erlfinsys.net 2.6.18-8.1.15.el5 #1 SMP Mon Oct 22 08:32:28 EDT 
2007 x86_64 x86_64 x86_64 GNU/Linux

================ OpenSSL =====
openssl-0.9.8b-8.3.el5_0.2

================ GCC =====

[ otp_src_R11B-5]$ gcc --version
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

================ Erlang =====
Erlang OTP-R11B-5

================ ERROR =====
in the make file the following appears:

/usr/bin/ld: /usr/lib64/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32 
against `OPENSSL_cpuid_setup' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[4]: *** [../priv/lib/x86_64-unknown-linux-gnu/crypto_drv.so] Error 1
make[3]: *** [opt] Error 2

============================
Tracing this you get this command that failed

[ c_src]$ 
gcc -shared  -o ../priv/lib/x86_64-unknown-linux-gnu/crypto_drv.so ../priv/obj/x86_64-unknown-linux-gnu/crypto_drv.o  /usr/lib64/libcrypto.a
/usr/bin/ld: /usr/lib64/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32 
against `OPENSSL_cpuid_setup' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

============================
else you will find it doing this: 

1> crypto:start().
exec: 1: ok
2> crypto_drv: not found

=ERROR REPORT==== 25-Oct-2006::12:57:02 ===
** Generic server crypto_server terminating
** Last message in was {'EXIT',#Port<0.96>,normal}
** When Server state == {#Port<0.96>,[]}
** Reason for termination ==
** {port_died,normal}
exec: 1: crypto_drv: not found


============================= Solution / Fix ===

Right or wrong this fixed the problem

after 

./configure
make

go to the directory  %ERL_TOP%/lib/crypto/c_src
issue the command:

gcc -shared  -o ../priv/lib/x86_64-unknown-linux-gnu/crypto_drv.so ../priv/obj/x86_64-unknown-linux-gnu/crypto_drv.o  /usr/lib64/libcrypto.so

now do: make install

crypto:start().



More information about the erlang-patches mailing list