AIX

AIX

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


#Power
 View Only
Expand all | Collapse all

building c/cpp files in AIX using gcc

  • 1.  building c/cpp files in AIX using gcc

    Posted Mon March 29, 2010 05:51 AM

    Originally posted by: ravikumarv


    Hi Friends,

    I'm new to AIX.

    I wanted build a project on AIX which is in c/c++ using gcc/g++.
    I installed all the necessary application tools specified in

    ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/README.txt

    I did the installation properly and I'm able compile the source files.But I wanted to link a shared library of mine.
    My steps
    gcc -c myfile.c
    gcc myfile.o -lmylib -L<PathOfThemylib> -o myfile

    Here I'm getting link errors as linker is trying search mylib in the default path but which is not there.
    I tried to link with -bctl option , but gcc did not know about this.

    Could somebody help me to get out of this problem

    Also i read the url:http://www.ibm.com/developerworks/aix/library/au-gnu.html

    Here under possible issues with gcc/g++ on AIX section
    First problem mentioned is:
    "You cannot use the GNU linker on AIX as this will cause incorrectly linked binaries. By default, the AIX linker is used when using GCC on AIX. You should only use the default AIX linker."
    What is default linker editor on AIX.How this can invoked after compilation.

    Thanks & Regards,
    Ravikumar
    #AIX-Forum


  • 2.  Re: building c/cpp files in AIX using gcc

    Posted Thu April 01, 2010 07:31 PM

    Originally posted by: nagger


    Hi,
    The linker is called ld on AIX - I think that is the same as other systems

    I would use the GCC compiler supplied by Michael Perzl for AIX at
    http://www.perzl.org/aix/

    All the software there is recent.
    For GCC it is version 4.2.4

    You name a README file for the place you downloaded from - weird !
    Although http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
    says that too is GCC 4.2.0

    These should install and then let you compile OK and using the AIX linker.
    If you ant more complicated compile options then you are going to have to use the AIX linker directly (I think) and this link
    - http://www.ibm.com/developerworks/aix/library/au-gnu.html
    looks like a good start for ten.

    Best of luck, Nigel
    #AIX-Forum