Bug 114022 - lang/erlang r11b5,1 build fails on amd64
Summary: lang/erlang r11b5,1 build fails on amd64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Jimmy Olgeni
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-26 01:40 UTC by Benno Rice
Modified: 2007-08-01 09:31 UTC (History)
0 users

See Also:


Attachments
smime.p7s (2.20 KB, application/pkcs7-signature)
2007-07-12 08:34 UTC, mikechoo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Rice freebsd_committer freebsd_triage 2007-06-26 01:40:04 UTC
When trying to build the erlang r11b5 port on amd64, I get the following:

gmake[4]: Entering directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/c_src'
/usr/bin/install -c -o root -g wheel -d ../priv/obj/amd64-unknown-freebsd6.1
cc -c -o ../priv/obj/amd64-unknown-freebsd6.1/crypto_drv.o -O2 -fno-strict-aliasing -pipe  -I/usr/local/include -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/amd64-unknown-freebsd6.1    -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -fPIC -I/usr/include -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/emulator/beam -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/emulator/sys/unix crypto_drv.c
/usr/bin/install -c -o root -g wheel -d ../priv/lib/amd64-unknown-freebsd6.1 
ld -shared  -o ../priv/lib/amd64-unknown-freebsd6.1/crypto_drv.so ../priv/obj/amd64-unknown-freebsd6.1/crypto_drv.o  /usr/lib/libcrypto.a 
ld: /usr/lib/libcrypto.a(sha1_one.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/lib/libcrypto.a: could not read symbols: Bad value

How-To-Repeat: Build erlang r11b5 port on amd64.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-06-26 12:32:47 UTC
Responsible Changed
From-To: freebsd-ports-bugs->olgeni

Over to maintainer
Comment 2 Benno Rice freebsd_committer freebsd_triage 2007-07-05 02:26:26 UTC
Just as a datapoint, what seems to be happening is that erlang is  
configuring itself to link the static crypto library directly in to  
the crypto driver.  The command line it's using is this:

cc -shared  -o ../priv/lib/amd64-unknown-freebsd6.1/crypto_drv.so ../ 
priv/obj/amd64-unknown-freebsd6.1/crypto_drv.o  /usr/lib/libcrypto.a

If I edit the Makefile.in in otp_src_R11B-5/lib/crypto/c_src and  
force DYNAMIC_CRYPTO_LIB to be 'yes', it does the following instead:

cc -shared  -o ../priv/lib/amd64-unknown-freebsd6.1/crypto_drv.so ../ 
priv/obj/amd64-unknown-freebsd6.1/crypto_drv.o  -L/usr/lib -lcrypto

This works and the build runs to completion.

I'm not entirely sure how it's coming to the decision to use the  
static library instead of the dynamic.

-- 
Benno Rice
benno@freebsd.org
Comment 3 Jimmy Olgeni freebsd_committer freebsd_triage 2007-07-09 15:38:07 UTC
State Changed
From-To: open->patched

The crypto_drv.so issue was fixed in r11b5_1. Could you please check if it works for you?
Comment 4 Nikolai Nespor 2007-07-09 18:11:59 UTC
Just tried to build again but it failed like reported in ports/114021. Here
is the output:

#+v
=== Entering application crypto
gmake[3]: Entering directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/src'
gmake[3]: Für das Ziel »opt« ist nichts zu tun.
gmake[3]: Leaving directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/src'
gmake[3]: Entering directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/c_src'
gmake -f amd64-unknown-freebsd6.2/Makefile TYPE=opt
gmake[4]: Entering directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/c_src'
/usr/bin/install -c -o root -g wheel -d ../priv/obj/amd64-unknown-freebsd6.2
cc -c -o ../priv/obj/amd64-unknown-freebsd6.2/crypto_drv.o -O2 -pipe  -I/usr/local/include -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/amd64-unknown-freebsd6.2    -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -DUSE_THREADS  -D_THREAD_SAFE -D_REENTRANT -fPIC -I/usr/include -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/emulator/beam -I/usr/ports/lang/erlang/work/otp_src_R11B-5/erts/emulator/sys/unix crypto_drv.c
/usr/bin/install -c -o root -g wheel -d ../priv/lib/amd64-unknown-freebsd6.2
cc -shared  -o ../priv/lib/amd64-unknown-freebsd6.2/crypto_drv.so ../priv/obj/amd64-unknown-freebsd6.2/crypto_drv.o  /usr/lib/libcrypto.a
/usr/bin/ld: /usr/lib/libcrypto.a(sha1_one.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/lib/libcrypto.a: could not read symbols: Bad value
gmake[4]: *** [../priv/lib/amd64-unknown-freebsd6.2/crypto_drv.so] Fehler 1
gmake[4]: Leaving directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/c_src'
gmake[3]: *** [opt] Fehler 2
gmake[3]: Leaving directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto/c_src'
gmake[2]: *** [opt] Fehler 2
gmake[2]: Leaving directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib/crypto'
gmake[1]: *** [opt] Fehler 2
gmake[1]: Leaving directory `/usr/ports/lang/erlang/work/otp_src_R11B-5/lib'
gmake: *** [libs] Fehler 2
*** Error code 2

Stop in /usr/ports/lang/erlang.
#-v

Ports updated via portsnap at 17:00 UTC on 2007-07-09.

When using the instructions from Benno Rice the build finishes sucessfully.

-- 
Ich verwalte sie. Ich zähle sie und zähle sie wieder.
Das ist nicht leicht. Aber ich bin ein ernsthafter Mann.
\\
 ---> Antoine de Saint-Exupery, "Der kleine Prinz"
Comment 5 Benno Rice freebsd_committer freebsd_triage 2007-07-10 00:49:10 UTC
On 09/07/2007, at 2:41 PM, Jimmy Olgeni wrote:

> Synopsis: lang/erlang r11b5,1 build fails on amd64
>
> State-Changed-From-To: open->patched
> State-Changed-By: olgeni
> State-Changed-When: Mon Jul 9 14:38:07 UTC 2007
> State-Changed-Why:
> The crypto_drv.so issue was fixed in r11b5_1. Could you please  
> check if it works for you?

As pointed out by Nikolai Nespor this appears to be a separate issue  
to the one fixed in r11b5_1 and I'll note that I did attempt to  
install r11b5_1 and hit the exact same problem.  It's more to do with  
trying to link a static object into a dynamic one and the linker not  
dealing.  For some reason it's deciding to link against libcrypto.a  
instead of libcrypto.so.

-- 
Benno Rice
benno@freebsd.org
Comment 6 mikechoo 2007-07-12 08:34:20 UTC
Found the issue.

the "configure" file in erts directory contained the following :-

   19647 # Remove all SKIP files from previous runs
   19648 for a in ssl crypto ssh; do
   19649   /bin/rm -f $ERL_TOP/lib/$a/SKIP
   19650 done
   19651
   19652 SSL_DYNAMIC_ONLY=no
   19653

SSL_DYNAMIC_ONLY is hard coded to "no", which forced it to link with  
libcrypto.a instead of libcrypto.so

cheers
-Mike
Comment 7 mikechoo 2007-07-18 16:12:28 UTC
After looking through the code again. I realised that I missed a  
section where SSL_DYNAMIC_ONLY=yes was defined.

However, in configure.in

    2633                 if test '!' -f $SSL_LIBDIR/libcrypto.a; then
    2634                         SSL_DYNAMIC_ONLY=yes
    2635                 fi

In my installation of FreeBSD AMD64, this will always fail. As both  
libcrypto.a and libcrypto.so exists.

cheers
-Mike
Comment 8 dfilter service freebsd_committer freebsd_triage 2007-07-31 22:22:10 UTC
olgeni      2007-07-31 21:22:04 UTC

  FreeBSD ports repository

  Modified files:
    lang/erlang/files    patch-erts_configure 
  Log:
  Force use of libcrypto.so. This will fix the build on amd64 (tested on sledge).
  
  PR:             ports/114022
  Submitted by:   benno
  
  Revision  Changes    Path
  1.11      +10 -1     ports/lang/erlang/files/patch-erts_configure
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 9 Jimmy Olgeni freebsd_committer freebsd_triage 2007-07-31 22:24:32 UTC
State Changed
From-To: patched->feedback

The latest port upgrade builds fine on sledge. 
Could you check if it works for you too?
Comment 10 Benno Rice freebsd_committer freebsd_triage 2007-08-01 02:29:16 UTC
Port now builds and installs fine.  Many thanks.

-- 
Benno Rice
benno@freebsd.org
Comment 11 Jimmy Olgeni freebsd_committer freebsd_triage 2007-08-01 09:30:36 UTC
State Changed
From-To: feedback->closed

Fixed. Thanks to everybody for the troubleshooting tips!