AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

Can someone please try this "hello world" program

  • 1.  Can someone please try this "hello world" program

    Posted Wed August 11, 2010 04:02 AM

    Originally posted by: DavidKirkby


    I've got access to an AIX 6.1 machine, but are having trouble compiling even the simplist of programs. A "hello world" works, but if I include <unistd.h> so it fails. The following program will not compile with gcc. I did not configure this system or gcc, but what I do note is that gcc appears to have been built for a target of AIX 5.3, yet this system is running AIX 6.1 I believe (I've posted the output of uname -a, for someone to verify that).

    As you might guess, I'm a bit of an AIX newbie.

    Dave

    bash-4.0$ cat test.c
    #include <stdio.h>
    #include <unistd.h>

    main() {
    printf("hello world\n");
    }
    bash-4.0$ gcc test.c
    In file included from test.c:2:
    /usr/include/unistd.h:924: error: expected ')' before '[' token
    /usr/include/unistd.h:925: error: expected declaration specifiers or '...' before 'rid_t'
    bash-4.0$ gcc -v
    Using built-in specs.
    Target: powerpc-ibm-aix5.3.0.0
    Configured with: ../stage/gcc-4.2.4/configure --disable-shared --enable-threads=posix --prefix=/opt/pware --with-long-double-128 --with-mpfr=/opt/pware --with-gmp=/opt/pware
    Thread model: aix
    gcc version 4.2.4
    bash-4.0$ uname -a
    AIX lpar5 1 6 00C6B7C04C00


  • 2.  Re: Can someone please try this "hello world" program

    Posted Wed August 11, 2010 05:03 AM

    Originally posted by: ostost


    I installed the latest version of gcc for AIX6.1 (gcc-4.2.0-3.aix6.1.ppc.rpm) from ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gcc/ and this works on my machine.

    1. cat hello.c
    #include <stdio.h>
    #include <unistd.h>

    main() {
    printf("hello world\n");
    }

    1. gcc hello.c

    1. gcc -v
    Using built-in specs.
    Target: powerpc-ibm-aix6.1.0.0
    Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,java --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1.0.0 --build=powerpc-ibm-aix6.1.0.0 --disable-libjava-multilib
    Thread model: aix
    gcc version 4.2.0

    1. ./a.out
    hello world


  • 3.  Re: Can someone please try this "hello world" program

    Posted Wed August 11, 2010 07:18 AM

    Originally posted by: DavidKirkby


    Thank you.

    I think there's a problem with the setup on this machine, though there is probably little I can do about it, as I don't have root access.

    The AIX machine is provided as a free access machine

    http://www.metamodul.com/10.html

    but it looks like gcc is mis-configured on this system.

    Are you aware of anywhere where I can get a binary version of gcc that does not need to be installed by root?

    Dave


  • 4.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 07:21 AM

    Originally posted by: flodstrom


    It looks like the wrong gcc version has been installed on that host. You need to have your administrator to remove that gcc version and install the AIX6.1 version (not the AIX5.3 one).

    Gcc is one of those packages that is bound to specific OS releases and you can't mix it. That means gcc for 5.3 won't work properly on 6.1 (and the other way around).

    Sorry don't know of any user installable version!

    ...Or even better, try to get access to a host with the xlc/xlC compiler.


  • 5.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 07:46 AM

    Originally posted by: DavidKirkby


    Thank you.

    Yes, I thought the compiler version installed was the wrong one.

    Since I'm only a guest on this system (it's free access for open-source projects), I can't go screaming to the admin, though I have mentioned there's a problem.

    I think since gcc is neither written in C or C++, I suspect I might have a tough time compiling it with the IBM C/C++ compilers. Last I knew, one could not compile gcc with the Sun compilers, as they wont't accept all the virus-like gcc extensions to the language. I think you need gcc to compiler gcc now, though I might be wrong on that.

    There are IBM compilers on this AIX system, but the trials have elapsed.

    I do have my own IBM RS/6000, which I bought to test some open-source code I wrote many years ago, but it's a very old 32-bit machine and running AIX 4.3.3.

    Are you aware of any public access AIX machines I could use for testing some code on AIX? I'd like to see just how difficult an AIX port of Sage http://www.sagemath.org/ would look.

    Dave


  • 6.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 10:42 AM

    Originally posted by: flodstrom


    Unfortunately I don't know of any sites providing AIX access (other than sites that have a fee...). I used to know of a site, but now I can't find it, sorry.

    Just curious. Are you the same person that is involved in porting SAGE for various platforms (AIX included)?


  • 7.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 11:01 AM

    Originally posted by: DavidKirkby


    Thank you for providing the information about the lack of the free AIX sites.

    Yes, I am the person porting Sage. I have been, and stir are, working mainly on Solaris and OpenSolaris. The 32-bit Solaris 10 SPARC port is complete - that works 100%,

    64-bit Solaris, Solaris on x86 and OpenSolaris are not complete.

    I've done a little bit of testing on HP-UX (nothing serious, just a quick try).

    On AIX I'm basically stuck to even try, with no access to suitable hardware with a working gcc. I'd like to know just how much would and would not work.

    I own a very old 32-bit IBM RS/6000 7025 F50 with AIX 4.3.3 on it. I bought a set of AIX 5.3 disks for it yesterday, so will at some point get that running AIX 5.3. But it will be too slow for development really. But I'm intrigued to see how much will or will not work on AIX.

    If there were others keen on porting Sage to AIX, I suspect it could be done. Because of the way Sage works, all changes have to be reviewed by someone else, which makes it almost impossible to do a port on ones own, with nobody else able to check ones changes.

    Dave


  • 8.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 03:30 PM

    Originally posted by: gcorneau


    There is a IBM Virtual Loaner program ( http://www-304.ibm.com/partnerworld/wps/pub/systems/vlp/index ). Not sure of the rules/regulations (it says "no-charge"). But perhaps that's only for BusinessPartners.


    Glen Corneau
    IBM Power Systems Advanced Technical Skills


  • 9.  Re: Can someone please try this "hello world" program

    Posted Thu August 12, 2010 04:53 PM

    Originally posted by: DavidKirkby


    Thank you for the information about about the a IBM Virtual Loaner program. That sounds interesting. I will follow up on that.

    I'm personally in a bit of a difficult position. I'm not an IBM business partner, nor do I work in academia any more. Yet this project is fairly and squarely an open-source project for very advanced maths. The lead developer (William Stein) is a professor of mathematics at the University of Washington.

    I'm hoping between IBM and the Uni of Washington something can be worked out. (There has been some communications).

    If the worst comes to the worst, I'll stick AIX 5.3 on my server and give Sage a go. (I ordered a set of CDs yesterday). But my RS/6000 is not a suitable machine for development - it's 32-bit, too old and too slow. It's also too power-hungry for me to personally pay from my own pocket to keep on. But it will at least allow me to get some idea of the difficulties.

    Dave


  • 10.  Re: Can someone please try this "hello world" program

    Posted Sun December 05, 2010 05:26 PM

    Originally posted by: Claire.Margulies


    gcorneau wrote:
    There is a IBM Virtual Loaner program ( http://www-304.ibm.com/partnerworld/wps/pub/systems/vlp/index ). Not sure of the rules/regulations (it says "no-charge"). But perhaps that's only for BusinessPartners.

    <HR>
    Glen Corneau
    IBM Power Systems Advanced Technical Skills

    Thanks for your analysis! Now I understand more about it.


  • 11.  Re: Can someone please try this "hello world" program

    Posted Tue April 22, 2014 01:17 PM

    Originally posted by: PatriciaZi


    Hello Dave,

    Same issue here with different version AIX

    I am also not able to control changes to gcc

     


    # gcc -Wall -D_GNU_SOURCE hello.c -o hello.o
    In file included from hello.c:2:/usr/include/unistd.h:935: error: expected ')' before '[' token/usr/include/unistd.h
    :936: error: expected declaration specifiers or '...' before 'rid_t'

    # gcc -v
    Using built-in specs.Target: powerpc-ibm-aix5.3.0.0
    Configured with: ../configure
    --with-as=/usr/bin/as
    --with-ld=/usr/bin/ld
    --enable-languages=c,c++,java
    --prefix=/opt/freeware
    --enable-threads
    --enable-version-specific-runtime-libs
    --host=powerpc-ibm-aix5.3.0.0
    --target=powerpc-ibm-aix5.3.0.0
    --build=powerpc-ibm-aix5.3.0.0
    --disable-libjava-multilibThread
    model: aixgcc version 4.2.0