[erlang-questions] : : build 64bit Erlang on Solairs

Raimo Niskanen <>
Tue May 6 12:28:52 CEST 2008


Thank you for your valuable effort. I have made changes
for the OpenSSL 64 bit build issue on Solaris in our
development branch, plus the Orber problem is gone
since R12B-2, so can you try again with a snapshot release:

http://www.erlang.org/download/snapshots/otp_src_R12B-3.tar.gz

Do not take the one 06-May-2008 02:54 since it accidentally
does not have my erts/configure.in changes. I am interested in
knowing how much is missing in a snapshot release (7-may)
for your builds to work as you need.

More comments inserted below...

On Tue, May 06, 2008 at 11:48:31AM +0800, Raymond Xiong wrote:
> On 05/05/08, Raimo Niskanen wrote:
> > > 
> > > If so, however, isn't it better to add CFLAGS in the follwing
> > > line in erts/emulator/Makefile.in?
> > > 
> > > $(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS)
> > >         $(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \
> > >         $(HIPEBEAMLDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) $(LIBS)
> > > 
> > 
> > It sounds weird to add CFLAGS to the LD command line.
> > 
> 
> I agree it's better to use "LDFLAGS=-m64".
> 
:
> > 
> > In our nightly builds we have a directory early in the path
> > that contains two scripts, essentially:
> > gcc:
> > 	#! /bin/sh
> > 	exec /usr/local/pgm/.../bin/gcc -m64 ${1+"$@"}
> > ld:
> > 	#! /bin/sh
> > 	exec /usr/ccs/bin/ld -64 ${1+"$@"}
> > and we set:
> > PATH=/usr/local/bin:/usr/sfw/bin:...
> > LD_LIBRARY_PATH=/usr/local/lib:/usr/sfw/lib
> > LD_LIBRARY_PATH_64=/usr/sfw/lib/64
> > 
> > We have it building and running, but it is not a pretty solution.
> 
> Thanks for the tip. It (and the command Mikael mentioned before)
> helped me to identify where these issues were. However, I cannot
> use it because a) it doesnt' work out of box b) the hack cannot
> be accepted in my build environment.
> 
> I have two patches for erts/configure and lib/orber/c_src/Makefile.in
> to fix this issue. It works for me on Solaris, so it may be
> helpful to others. Here are the introductions:
> 
> $ cd otp_src_R12B-1/
> $ gpatch -p0 < orber_lib_makefile.patch

The orber C code was obsoleted and removed in OTP_R12B-2.

> $ gpatch -p0 < erts_configure.patch
> $ env CC=gcc CFLAGS='-m64 -O3' LDFLAGS="-m64" CPPFLAGS="-I /usr/include/gd2" CXX=g++ ./configure --prefix=/usr --with-ssl=/usr/sfw --enable-dynamic-ssl-lib
> $ gmake
> 

I agree it must be the right(tm) way to do it to specify
CC="gcc" and CFLAGS="-m64". I believe that for the "ld"
linker the correct LDFLAGS should be -64, but I do not
recall how they are passed. However I think the configure
script should detect that the compiler produces 8-byte
integers and figure out the linker flags. At least there
is already such code in erts/configure.in.

> With above steps, I can build 64bit executables and shared
> objects. The only issue is erl_rx_driver.so:
> 
> $  file ./lib/common_test/c_src/erl_rx_driver.so
> ./lib/common_test/c_src/erl_rx_driver.so:	ELF 32-bit MSB
> dynamic lib SPARC Version 1, dynamically linked, not stripped
> 
> The reason is its Makefile is hardcoded, rather than generated
> by configure script(there is no Makefile.in under this subdir).
> I decide to skip the issue for now.

I will talk to the application responsible about this.

> 
> Another thing is that  I think the use of LD_LIBRARY_PATH is due
> to a bug in lib/crypto/c_src/Makefile.in, which I reported a 
> while back:
> 
>   http://www.erlang.org/pipermail/erlang-patches/2008-March/000241.html

I will try that patch and see if it burns...


> 
> -- 
> Regards,
> Raymond

> --- erts/configure.orig	Sun May  4 23:17:15 2008
> +++ erts/configure	Mon May  5 00:34:55 2008
> @@ -20722,6 +20722,12 @@
>  	SSL_LIBDIR="$with_ssl/lib/VC"
>      else
>  	SSL_LIBDIR="$with_ssl/lib"
> +	if test "$GCC" = yes && echo $CFLAGS | grep "\-m64" >/dev/null; then
> +		case $host_os in
> +		  solaris2*)
> + 			SSL_LIBDIR="$with_ssl/lib/64";;
> +		esac
> + 	fi
>      fi
>      SSL_INCLUDE="-I$with_ssl/include"
>      OPENSSL_CMD="$with_ssl/bin/openssl"

> --- lib/orber/c_src/Makefile.in.orig	Sun May  4 22:36:42 2008
> +++ lib/orber/c_src/Makefile.in	Sun May  4 22:38:06 2008
> @@ -102,7 +102,7 @@
>  	-mkdir -p $(BINDIR)
>  
>  $(BINDIR)/obj_init_port: $(OBJ_FILES)
> -	$(CC) -o $@ $(OBJ_FILES) $(LIBS)
> +	$(CC) -o $@ $(ALL_CFLAGS) $(LDFLAGS) $(OBJ_FILES) $(LIBS)
>  
>  $(OBJDIR)/%.o: %.c
>  	$(CC) -c -o $@ $(ALL_CFLAGS) $<

> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list