<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body bgcolor="#CCCCCC" text="#000000">
<p><font size="+1">Hello Mikael,</font></p>
<p><font size="+1">Thanks for the information !</font></p>
<p><font size="+1">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, ...).</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">After building with Hipe, I've tried without Hipe.<br>
And I got the same result: an infinite loop, in read() from signal_dispatcher_thread_func().<br>
  In: </font><font size="+1"><tt>ERLC   ../ebin/hipe_rtl.beam</tt></font><font size="+1">              with Hipe (--enable-hipe)<br>
  In: </font><font size="+1"><tt>ERLC   ../ebin/hipe_consttab.beam</tt></font><font size="+1">    without Hipe (--disable-hipe) . No idea why "hipe" appears here also.<br>
So, for now, I have a common issue, with or without hipe.<br>
</font></p>
<p><font size="+1">Full configure is (without hipe):</font></p>
<p><font size="+1">./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
<b>--disable-hipe</b> --without-jinterface --without-common_test --without-debugger --without-dialyzer --without-et --without-megaco --without-observer --without-reltool --without-typer --without-wx<br>
configure: WARNING: you should use --build, --host, --target</font></p>
<p><font size="+1">Investigating.</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">About ELF/XCOFF, thanks for informing me that this part should not be too big.</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">Now, when building with No SMP support in addition to No threads and No Hipe, the build goes further, up tow Java building:<br>
 <b>JAVAC</b>  /opt/freeware/src/packages/BUILD/otp_src_19.2/lib/ic/priv/com/ericsson/otp/ic/Environment.class<br>
Environment.java:41: package com.ericsson.otp.erlang does not exist<br>
  private com.ericsson.otp.erlang.OtpSelf self;<br>
                                 ^<br>
I'll investigate later.</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">Now, building with :  --disable-hipe --disable-threads --disable-smp-support --without-javac</font></p>
<p><font size="+1">I have an issue with LD:</font></p>
<p><font size="+1">LD     ../priv/lib/powerpc-ibm-aix6.1/dyntrace.so<br>
ld: 0706-012 The -h flag is not recognized.<br>
ld: 0706-012 The -a flag is not recognized.<br>
</font></p>
<p><font size="+1">I'll investigate, fix and go further.</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">Thanks for indicating the main options of ./configure of Erlang to study at first.<br>
</font></p>
<p><font size="+1"><br>
Regards</font></p>
<p><font size="+1">Tony<br>
</font></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">Regards,</font></p>
<p><font size="+1">Tony<br>
</font></p>
<p><font size="+1"></font><br>
</p>
<div class="moz-cite-prefix">Le 15/01/2017 à 10:58, Mikael Pettersson a écrit :<br>
</div>
<blockquote cite="mid:22651.18370.454189.186497@gargle.gargle.HOWL" type="cite">
<pre wrap="">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.

</pre>
</blockquote>
<br>
</body>
</html>