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

Raymond Xiong Raymond.Xiong@REDACTED
Wed May 7 07:43:29 CEST 2008


On 05/06/08, Raimo Niskanen wrote:
> 
> 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.

Raimo,

I gave it a quick try and it worked fine with the following
command:

$ env CC=gcc CFLAGS='-m64 -O3' LDFLAGS="-m64" CPPFLAGS="-I
/usr/include/gd2" CXX=g++ ./configure --prefix=/export/tmp_b
--with-ssl=/usr/sfw --enable-dynamic-ssl-lib

See more below...
 
> > $ 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.
> 

Yes, I also think it is a bit weird to define "-m64" in LDFLAGS,
but that is the only way to get it working. If you don't set it
(or set it to "-64"), the build would fail when it generates 
beam executable file. See following log:

gcc -o /export/tmp_a/otp_src_R12B-1/bin/sparc-sun-solaris2.11/beam \
         -64   obj/sparc-sun-solaris2.11/opt/plain/erl_main.o ...
gcc: unrecognized option `-64'
ld: fatal: file obj/sparc-sun-solaris2.11/opt/plain/erl_main.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to /export/tmp_a/otp_src_R12B-1/bin/sparc-sun-solaris2.11/beam

The reason is in the follwing lines in erts/emulator/Makefile.in:

$(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS)
        $(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \
        $(HIPEBEAMLDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) $(LIBS)

That's why I asked in previous mail if it's beter to include 
CFLAGS in above lines. But as you mentioned, it is probably 
not a good practice. I googled on the net and found using 
-m64 in LDFLAGs seems to be a popular solution to such issue. 
So I am OK with this usage.

Thanks,
Raymond



More information about the erlang-questions mailing list