[erlang-questions] Port of Erlang (19.2) on AIX

REIX, Tony <>
Mon Jan 16 17:12:26 CET 2017

Hello Mikael,

Thanks for the information !

I'm using GCC v4.8.4 . In general, porting an OpenSource package on AIX is only a matter of small and very small issues, except when assembler is used (Ruby, GCC, GCC Go, Erlang, ...).

After building with Hipe, I've tried without Hipe.
And I got the same result: an infinite loop, in read() from signal_dispatcher_thread_func().
  In: ERLC   ../ebin/hipe_rtl.beam              with Hipe (--enable-hipe)
  In: ERLC   ../ebin/hipe_consttab.beam    without Hipe (--disable-hipe) . No idea why "hipe" appears here also.
So, for now, I have a common issue, with or without hipe.

Full configure is (without hipe):

./configure ppc-ibm-aix6.1 --prefix=/opt/freeware --exec-prefix=/opt/freeware --bindir=/opt/freeware/bin --sbindir=/opt/freeware/sbin --sysconfdir=/opt/freeware/etc --datadir=/opt/freeware/share --includedir=/opt/freeware/include --libdir=/opt/freeware/lib --libexecdir=/opt/freeware/libexec --localstatedir=/opt/freeware/var --sharedstatedir=/opt/freeware/com --mandir=/opt/freeware/man --infodir=/opt/freeware/info --enable-shared-zlib --enable-sctp --disable-systemd --disable-hipe --without-jinterface --without-common_test --without-debugger --without-dialyzer --without-et --without-megaco --without-observer --without-reltool --without-typer --without-wx
configure: WARNING: you should use --build, --host, --target


About ELF/XCOFF, thanks for informing me that this part should not be too big.

Now, when building with No SMP support in addition to No threads and No Hipe, the build goes further, up tow Java building:
 JAVAC  /opt/freeware/src/packages/BUILD/otp_src_19.2/lib/ic/priv/com/ericsson/otp/ic/Environment.class
Environment.java:41: package com.ericsson.otp.erlang does not exist
  private com.ericsson.otp.erlang.OtpSelf self;
I'll investigate later.

Now, building with :  --disable-hipe --disable-threads --disable-smp-support --without-javac

I have an issue with LD:

LD     ../priv/lib/powerpc-ibm-aix6.1/dyntrace.so
ld: 0706-012 The -h flag is not recognized.
ld: 0706-012 The -a flag is not recognized.

I'll investigate, fix and go further.

Thanks for indicating the main options of ./configure of Erlang to study at first.





Le 15/01/2017 à 10:58, Mikael Pettersson a écrit :

REIX, Tony writes:
 > Hi,
 > I'd like to port Erlang/OTP on AIX.
 > After browsing several files and ReadMe files in the source and on Erlang web-site, it seems to me that AIX is not yet handled by Erlang.
 > I've already started to look at the code. And it appears that there is some assembler code for PowerPC, probably for Linux.
 > However, browsing the code, I see that it talks of ELF (AIX is XCOFF) and of AIX. I'm quite lost.
 > Moreover, I've read that only 32bit Linux/PowerPC is handled. No 64bits. Correct ?
 > I'd like to find information about:
 >   - which parts must be modified/extended for handling AIX (XCOFF) ?
 >   - which parts must be modified/extended for handling 64bit in addition to PowerPC 32bit ?

The Erlang/OTP VM should build without using any of that assembly code.  What you need is:
- a POSIX environment (see HOWTO/INSTALL.md)
- a decent ANSI-C or better yet ISO-C compiler, GCC is preferred
- a libc with pthreads (even that might be optional, c.f. Windows, but might need configure-time overrides)
- a termcap or ncurses library (optional but useful for the Erlang shell; --without-termcap if you don't have it)

Note that the VM builds for Windows which is PE-COFF, so there is no hard dependency on ELF.

HiPE (the native code stuff) does work on 64-bit PowerPC, but the runtime support is written for Linux (ELF)
and some older MacOS so would need updating for XCOFF and the AIX assembler, and re-validation for however
the AIX ABI looks these days.  Just pass --disable-hipe when configuring and ignore that for now.

Threading uses ordinary pthreads.  --disable-threads if the AIX threads are too different.

Threading and SMP support wants atomics.  That's a bit of a mess, using GCC inline assembly code
and fallbacks using (I think) pthreads synchronization primitives and/or libatomic.  Either way, that code
should build and work without any use of inline assembly code.   Try --disable-threads --disable-smp-support
for an initial, basic, but functioning VM.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170116/8926dacf/attachment.html>

More information about the erlang-questions mailing list