jeffreykegler/Marpa--R2

Problems to install Marpa::R2 8.000000 on AIX

XSven opened this issue · 12 comments

XSven commented

perl 5.14.2
AIX 7.2
OBJECT_MODE wasn't set at the beginning!

  • prepare was successful (perl Build.PL)

  • build was successful too (./Build)

    This is the last line of the build

    gcc -maix64 -static-libgcc -maix64 -Wl,-b64 -Wl,-bhalt:4 -Wl,-G -Wl,-bI:/usr/local/perl-5.14.2_64_8/lib/5.14.2/aix-thread-multi-64all/CORE/perl.exp -Wl,-bE:R2.exp -Wl,-bnoentry -lpthreads -lc -lm -L/usr/local/perl-5.14.2_64_8/lib -o blib/arch/auto/Marpa/R2/R2.so lib/Marpa/R2.o /home/micsw/.cpan/build/Marpa-R2-8.000000/libmarpa_build/.libs/libmarpa.a

    Note the option -maix64 that fits how perl itself was compiled!

  • test fails (./Build test)

    t/00-load.t ............ # Can't load '/home/micsw/.cpan/build/Marpa-R2-8.000000/blib/arch/auto/Marpa/R2/R2.so' for module Marpa::R2: 0509-161 There is not enough memory for the process.
    # rtld: 0712-001 Symbol _marpa_o_or_node_and_node_count was referenced
    # from module /home/micsw/.cpan/build/Marpa-R2-8.000000/blib/arch/auto/Marpa/R2/R2.so(), but a runtime definition
    # of the symbol was not found.
    # 0509-021 Additional errors occurred but are not reported. at /usr/local/perl-5.14.2_64_8/lib/5.14.2/aix-thread-multi-64all/DynaLoader.pm line 190.
    # at t/00-load.t line 24.
    # Compilation failed in require at t/00-load.t line 24.
    Bailout called. Further testing stopped: Could not load Marpa::R2
    FAILED--Further testing stopped: Could not load Marpa::R2

  • My guess is that the compilation is a mixture of 32bit and 64bit parts.
    I thought it shouldn't harm to set the OBJECT_MODE varibale to 64 and to
    export it.

  • building after cleaning fails (OBJECT_MODE=64 ./Build)

    screen
    configure: error: in `/home/micsw/.cpan/build/Marpa-R2-8.000000/libmarpa_build':
    configure: error: C compiler cannot create executables

    config.log
    configure:3714: gcc conftest.c >&5
    Assembler:
    /ib/dat/tmp/ccRpna1X.s: line 9: Only .llong should be used for relocatable expressions.
    configure:3718: $? = 1

    Looking at this

    http://www.hpc.cineca.it/content/i-cannot-use-gcc-compiler-even-very-simple-programs

    I thought now it is a good idea to set the CFLAGS variable to -maix64 and to
    export it.

  • building after cleaning fails (CFLAGS=-maix64 OBJECT_MODE=64 ./Build)

    screen
    configure: error: in `/home/micsw/.cpan/build/Marpa-R2-8.000000/libmarpa_build':
    configure: error: C compiler cannot create executables

    config.log
    configure:13382: /home/micsw/.cpan/build/Marpa-R2-8.000000/libmarpa_build/compile gcc -o conftest -maix64 conftest.c >&5
    configure[10]: /home/micsw/.cpan/build/Marpa-R2-8.000000/libmarpa_build/compile: cannot execute
    configure:13382: $? = 126
    configure: program exited with status 126
    configure: failed program was:
    ...
    configure:13396: result: 0
    configure:13407: error: Marpa requires that int be at least 32 bits -- on this system that is not the case

After several hours of work I am lost now. Would appreciate your help.

The error message "configure:13407: error: Marpa requires that int be at least 32 bits -- on this system that is not the case" was put in to test for 16-bit machines, which are not supported.

I'll let the IRC channel know about this ticket, to see if there are other AIX users in the Marpa community.

Can you please try with environment variable LIBPATH so that it contains the location of the shared library you built. I suppose this can be:
export LIBPATH=/home/micsw/.cpan/build/Marpa-R2-8.000000/blib/arch/auto/Marpa/R2:$LIBPATH
and retry with the very first step, with no modification anywhere.

The warning about the "int" size is a false positive, unfortunate side-effect of something else.
You have to be in an environment similar to the one that has been used to build perl itself.

I suggest these readings:
https://www.perlmonks.org/?node_id=1127409
http://www.hpc.cineca.it/content/tips-linking-libraries-ibm-sp6-aix

XSven commented

Unfortunately the LIBPATH approach did not work. Instead I followed my intuition that the compilation is a mixture of 32bit and 64bit parts. libmarpa.a created by the libtool was always a 32bit archive and previously I was not able to fix this using the proper CFLAGS and/or OBJECT_MODE settings. Now I have done the following

I have changed the line 4030 of the file engine/read_only/configure from

CFLAGS="-g -O2"

to

CFLAGS="-maix64 -g -O2"

This has the effect that the libtool (auto-generated by configure) LTCC compiler flag is now

LTCFLAGS="-maix64 -g -O2"

Then I have started the build with

AR_FLAGS='-X64 cru' ./Build

and everything (build, test, and install) runs through smoothly.

Now we should try to figure out how to fix the Marpa distribution so that things work out of the box.

One solution is to add an AIX.README, which I can refer to the from the updates page.

The "right" thing is to add AIX support to the configuration, but this would take a lot of effort. The "right" way is not to specify AIX, but to test for it and for each of the flags used. We'd then have to test the new configuration, not just on AIX, but on all the other platforms to ensure there was no regression.

All this is doable, but the real downside is that any change in the configuration after that could easily break AIX support, which we would not find out, because we don't have easy access to an AIX testbed.

For this reason, at the moment I prefer the idea of adding the AIX.README. That is safe from my damaging it in future configuration changes -- once I put it in it will only be changed in response to input from AIX users -- and AIX users will get a more honest impression of what we know,
and the level of support they can expect.

Let me know your thoughts.

XSven commented

I understand your concerns and I share your view on the effort and the risk to break something now or in the future if we would try to implement/integrate the AIX configure the "right" way. I am fine with your AIX.README suggestion. I would refer to the AIX.README from the README and the INSTALL at least.

I've added AIX.README to the repo: https://github.com/jeffreykegler/Marpa--R2/blob/0627d2614291d37732eb6c47bb0f3ed0e503440e/AIX.README

Next steps:

1.) @XSven I will wait a bit to see if you suggest any changes in the AIX.README.
2.) I will add links from other places in the Marpa::R2 report to the AIX.README -- in particular there is an UPDATES file, intended precisely for this kind of thing: https://github.com/jeffreykegler/Marpa--R2/blob/master/UPDATES.md
3.) I will look into updating the CPAN install for AIX.
4.) I will backport the AIX.README to libmarpa

After that, if all seems OK, I will close this issue.

XSven commented

I would state the version of the Marpa::R2 release in the AIX.README because if a new version changes engine/read_only/configure the line number in the AIX.README may not be the right one anymore.

XSven commented

Fine thanks. Step 1.) is done.

I updated INSTALL_NOTES and the UPDATES file in commit 964aa6a .

I will wait a few days for any comments. Then I will do the next two steps:

1.) I will backport the AIX.README to libmarpa
2.) I will look into updating the CPAN install for AIX.

Note that I have reversed the order from my previous list of steps. That's because I'm slightly more optimistic about incorporating AIX support in the normal way. But that means the new step 2.) will take more time, so I want to do the libmarpa backport first.

For the reasons given in #278 (comment), made more cogent by the lapse ot time, I don't think updating the CPAN install for AIX is practical. Accordingly, I think task 2 of the plan in #278 (comment), to "look into" that possibility, is "completed".

Task 1 of the plan in #278 (comment) will be completed with the closing of jeffreykegler/libmarpa#72, expected in about a week.

Accordingly, I am marking this issue as "ready to be closed". Absent feedback to the contrary, I will close this issue in about a week.

Closed as per #278 (comment).