Solved

How to Install GCC Compiler on AIX (5.3)

Posted on 2010-11-16
23
3,827 Views
Last Modified: 2012-08-14
Hello
Can someone please provide me All the steps in How to Install GCC Compiler on AIX (5.3)
and how to verify it, after it has been installed.

Thanks
0
Comment
Question by:assistunix
  • 11
  • 10
  • 2
23 Comments
 

Author Comment

by:assistunix
ID: 34147150
This question needs to be in IBM AIX ZONE, and i am STILL UNABLE TO put it in that zone.
Please put this question, in IBM AIX ZONE
0
 
LVL 61

Expert Comment

by:gheist
ID: 34154206
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html - RPM format
http://bullfreeware.com/?list=g - BFF format
http://bio.gsi.de/DOCS/AIX/aixpdslib.seas.ucla.edu/categories/development.html - TGZ format

make sure you install system perl before installing anything else because BFF and RPM perl are mutually exclusive, and you cannot use the other collection after
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34154449
OK,

let's see what gcc versions we have.

aixpdslib: 4.1.0

AIX toolbox + bullfreeware: 4.2.0.3

Bull no longer has BFF packages for gcc - they just point to the AIX toolbox RPMs.  
There is thus no need to worry about perl - particularly because perl is part of AIX sinde AIX 5L and no longer has to be installed separately.

perzl.org - http://www.perzl.org/aix/index.php?n=Main.Gcc has 4.2.4.2, so I'd recommend installing this version.

Download these packages:

¿gcc-4.2.4-2.aix5.3.ppc.rpm
¿gcc-c++-4.2.4-2.aix5.3.ppc.rpm
¿gcc-cpp-4.2.4-2.aix5.3.ppc.rpm
¿gcc-gfortran-4.2.4-2.aix5.3.ppc.rpm
¿libgcc-4.2.4-2.aix5.3.ppc.rpm
¿libgomp-4.2.4-2.aix5.3.ppc.rpm
¿libstdc++-4.2.4-2.aix5.3.ppc.rpm
¿libstdc++-devel-4.2.4-2.aix5.3.ppc.rpm

gfortran is optional, I strongly assume that you don't need it. Please don't install it in this case, because there are some ugly dependencies.

Use the rpm tool (which is also part of AIX since 5L) to install them. The general format is:
rpm -ivh /path/to/downloaded/package

Start with libgcc, then continue with gcc. There is a specialty with gcc - it formally depends on the "info" package, which you don't need and which also has extensive dependencies. So install gcc with

rpm -ivh --nodeps gcc-4.2.4-2.aix5.3.ppc.rpm

Continue with libstdc++ and libstdc++-devel, then install gcc-c++, gcc-cpp and libgomp.

That's all.

Run a first test by simply issuing
gcc -v  (Display the programs invoked by the compiler)
gcc --version
gcc --help

Next you could compile the usual  small Hello World program:

#include <stdio.h>
int main(void)
{
printf("\nHello world!\n");
return 0;
}

Save the above in a file helloworld.c and run
gcc helloworld.c

You will find a file named a.out in the current directory. Type
a.out
and watch what happens.

Good luck!

Btw. Right. You. Are! This Q should be in the AIX zone! That new Question Wizard is just silly!

wmp

 






0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34169169
0
 

Author Comment

by:assistunix
ID: 34169605
Hello wmp
Thank you for your reply.
I am not exactly sure what GCC is, but i have been told to Install GCC.

I had visited http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html and saw a file called, gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection

My question is, do i need ALL the filesets that you mentioned above for GCC installation (perl.com) or can i just install this one fileset from (ibm.com)
gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection


0
 

Author Comment

by:assistunix
ID: 34169680
Also, i downloaded the older versions of these filesets that you had mentioned from perl.com
the reason i download older versions was because the newer version required a newer rpm version.

I installed these:
¿gcc-4.2.4-2.aix5.3.ppc.rpm
¿gcc-c++-4.2.4-2.aix5.3.ppc.rpm
¿gcc-cpp-4.2.4-2.aix5.3.ppc.rpm
¿libgcc-4.2.4-2.aix5.3.ppc.rpm
¿libgomp-4.2.4-2.aix5.3.ppc.rpm
¿libstdc++-4.2.4-2.aix5.3.ppc.rpm
¿libstdc++-devel-4.2.4-2.aix5.3.ppc.rpm

after installing this in the sequence you had suggested, i tried doing the test, however i believe i am failing the test.

after creating a helloworld.c file with content
#include <stdio.h>
int main(void)
{
printf("\nHello world!\n");
return 0;
}

i run gcc helloworld.c
and a file called a.out gets created.


0
 

Author Comment

by:assistunix
ID: 34169683
however, when running a.out , i get an error.

[root@local] /
# ls a.out
a.out
[root@local] /
# a.out
ksh: a.out:  not found.
[root@local] /
#
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34169939
./a.out
0
 

Author Comment

by:assistunix
ID: 34169990
./a.out works and gives me this output

[root@local] /
# ./a.out

Hello world!
[root@local] /
#


However, when you get a chance, can you please answer my inquiry if all these filesets are Must needed for gcc compiler installation or can i just install only
gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection
from  http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34171300
Well,

let's see what the single packages contain.

gcc is the C compiler itself.

libgcc is gcc's low-level runtime library and you will always need it, because the compiler would generate calls to routines in this library automatically.
http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html

gcc-cpp is the C preprocessor, used automatically by the C compiler to transform programs before compilation and is thus also always needed.
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Overview.html#Overview

gcc-c++ is the C++ compiler.

libstdc++(-devel) are the C++ counterparts of the packages above. Whether you will need them depends on what kind of software you're planning to create / compile.
If you're going to compile and use Open Source programs, it is rather probable that you will need the C++ stuff, if you're planning to develop your own software you should know better than I whether you will program in C++ or not.
http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/G_002b_002b-and-GCC.html#G_002b_002b-and-GCC

libgomp is an API library for multi-platform shared-memory parallel programming in C/C++ and Fortran.
Sometimes needed with Open Source software - whether you're going to use it in own pojects is your decision.
Since it's only ca. 120 KB in size I'd recommend installing it so it will be there if needed.
http://gcc.gnu.org/onlinedocs/libgomp/index.html#Top

IBM's toolbox is practically as good as perzl.org, but the latter generally has the newer versions and  its website usually gives hints on prerequisites and possible pitfalls, so you can plan your installation instead of just reacting on rpm's complaints about e.g. missing prerequisites or the like.

Btw. >> I am not exactly sure what GCC is ... << - please look here: http://en.wikipedia.org/wiki/GNU_Compiler_Collection


Hope I could help you a bit.

Cheers

wmp
0
 

Author Comment

by:assistunix
ID: 34174821
Thank you for that clarification.
One last clarification that i needed was about
gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection
from  http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html

it seems if that fileset is a Compiler Collection , includes all or most of the individual filesets that aer available at perl.org
can you confirm that ?

Also,
i uninstalled all the filesets from perl.org and installed this one GNU Compiler Collection
and ran the helloworld.c test and it worked. Does that also indicate that GNU Compiler Collection contains the needed filesets in one fileset.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 61

Expert Comment

by:gheist
ID: 34175781
perl sometimes conflicts with package manager in general, since this does not happen on your system, you have gcc installed.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34175897
I feel a bit confused by your "perl.com" or "perl.org". Do you mean "perzl.org", or are you talking about something completely different?
And all this has absolutely nothing to do with Perl, the "Practical Extraction and Report Language"!

Anyway, issue "rpm -qa" and check what's installed.






0
 

Author Comment

by:assistunix
ID: 34177401
sorry about the confusion, my apologies. by perl.com and perl.org , i meant perzl.org

my question is that your helloword.c test worked after installing all the filesets from perzl.org as you suggested and it also worked with fileset
 gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection
from  http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html

question is

does gcc compiler Collection fileset from ibm = all filesets from perzl.org
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34177453
rpm -qa
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34186440
I fear it's not quite clear what I'm trying to tell you.

rpm -qa will show you all installed RPMs.

Using this command you will see that GCC from the toolbox is only gcc and nothing else.

One difference is there, though, which can be seen with rpm -ql gcc-4.2.0-3.aix5.3.ppc.rpm
You will notice that there is "cpp" in addition to gcc: IBM's package contains the preprocessor which is in "gcc-cpp" at perzl.org.

And that's why you have been able to compile your helloworld.c program.
The cpp contained in gcc (IBM) resolved the "#include" directive, and because the only function you use ("printf()") is in /usr/lib/libc.a(stdio) which is part of AIX there is no need for libgcc and all the other packages.

Now, if you're planning to compile only such simple programs you should well be able to get along with gcc (including cpp) alone, but if you're going to write more sophisticated things or if you're going to compile Open Source programs gcc alone will fail.

You should re-read my comment  #34171300 above, because all I wrote there is also valid for the toolbox version of GCC - OK, except for the word "always" in the "libgcc" part.

Hope I could clarify things a bit.

wmp
0
 

Author Comment

by:assistunix
ID: 34202872
Thank you very much, that really clarifies it.
I have another question though.

 THe format in which i had GCC Compiler in was RPM. However the RPM in my system is of an older version which does not install the GCC Compiler version i try to install.
And i do not want to Upgrade the RPM version intsalled in my AIX.

Is there another way of Installing GCC, without it being in an RPM format?

I had downloaded the RPM version gcc     4.2.0 (5.3)     License     RPM     Source     GNU Compiler Collection
from  http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html

..

I downloaded the GCC from the source through that link, in the format of .tar.bz2
but can i install gcc in that version?
can i install gcc in .tar version after uncompressing it.

or do i have to untar the file and install from with in it.

Can i use installp for installation?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34204221
The GCC source as obtained from ftp.gnu.org (I assume that's where you downloaded it from) must be compiled and linked.
Now that you have a gcc compiler installed via rpm you could of course use this compiler to build a newer version from source.
The method is as usual - run "configure", "make", "make test" and "make install", if I remember well.
But attention - installation paths will be different from the ones the RPM version uses - it will require a bit of effort to clean things up.
I, personally, would not recommend installing from source here, only to get a slightly newer version of gcc.

installp is only for bff packages, and afaik the only bff packages for GCC around (since bullfreeware ceased to build/offer them) are the ones from pWare, the newest being 4.3.5.0: http://pware.hvcc.edu/download/aix53/
You should deinstall the RPM version you have beforehand, because the pWare paths are also different from the RPM paths.

By the way, the GCC packages from GNU and pWare have all the stuff I mentioned in my former post above, e.g. libgcc, gcc-c++, libstdc++ and so on, and are thus true "collections".

wmp

0
 

Author Comment

by:assistunix
ID: 34276599
hello wmp

turns out it might not be the actual rpm version that's causing the problem, but the AIX-rpm version.
these two may or may not be related, but the issue i am getting is installing gcc on my aix 5.3.

IN AIX 5.3
The following errors occurred during installation:
rpm -ivh gcc-4.2.0-3.aix5.3.ppc.rpm
error: failed dependencies:
AIX-rpm >= 5.3.0.0 is needed by gcc-4.2.0-3

My rpm version is
# rpm --version
RPM version 3.0.5

and when i run rpm -qa | grep AIX , i get an output of AIX-rpm less than 5.3.0.0 (don't remember the exact number, and currently unable to access it to verify the number)

I need help in figuring out, how can i update my AIX-rpm to greater than 5.3.0.0.
would upgrading my # rpm --version   help ?
                                   RPM version 3.0.5

.....
IN AIX 6.1
also, i tried to generate a similar error of AIX-rpm version not being compatible enough to install gcc, and i was able to generate the following error on it, by installing 5.3 gcc version gcc-4.2.4-2.

[root@server] /perzl/5 # rpm -ivh gcc-4.2.4-2.aix5.3.ppc.rpm
error: failed dependencies:
        AIX-rpm < 5.4.0.0 is needed by gcc-4.2.4-2   <note in this installation it is requiring a smaller version AIX-rpm

although i do not need this gcc version of 5.3 to be installed on aix 6.1, however i would like to learn how can i downgrade the AIX-rpm version? as needed in this case.

Do note, that 6.1 gcc version gcc-4.2.4-2 was successfully installed and also 5.3 gcc version gcc-4.2.0-3 was also successfully installed.

my aix 6.1 server information:

[root@server] / # rpm --version
RPM version 3.0.5
[root@server] / # rpm -qa | grep AIX
AIX-rpm-6.1.0.0-7
[root@server] / #

..........
My urgency is on resolving the installation on aix 5.3, which is requiring an upgrade of AIX-rpm to a version higher than 5.3.0.0

Please provide your insight on it.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 34281177
Hi,

see my comment in your Q  http://www.experts-exchange.com/OS/Unix/Q_26656739.html

Essentially there are no such things like "actual rpm version" and "AIX rpm version".
rpm for AIX is contained in a fileset called "rpm.rte", the actual rpm package in there is called "AIX-rpm", but finally the rpm binary deep inside is just the well-known Open Source "rpm" which can also be found under Linux and other UNIXes.
--> It should never happen that rpm is installed twice on a system! This would lead to a terrible mess in your library directories /usr/lib and /usr/local/lib!

The confusing part of this all is that AIX-rpm has a version number following the AIX "Version-Release-Modification-Fixpack" scheme which gets "counted up" along with the AIX level, whereas rpm.rte as well as the rpm binary itself carry a version number as assigned from Open Source development.

Example: lslpp for rpm.rte could show "3.0.5.51" , "rpm --version" could show "RPM version 3.0.5" but "rpm -qa | grep rpm" would show "AIX-rpm-5.3.0.40-4".

In the other thread I told you where to get the newest AIX 5.3 rpm installp package (that's where I got the above version numbers from).
ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/INSTALLP/ppc/rpm.rte
Up to now I couldn't find a version suitable for AIX 6.1 which you could download. It's only on the AIX 6.1 installation media - which you could of course download as ISO images from IBM's Entitled Software Support pages, if you have an appropriate contract with IBM: https://www-05.ibm.com/servers/eserver/ess

As for downgrading: Please don't! rpm.rte always contains bzip2, gettext, info and zlib, which would be downgraded along with rpm.
Particularly gettext is important, because it contains libintl.a (and the shared object part "libintl.so" within), a library that provides native language support to programs. This library is widely used in various programs, and downgrading it would certailnly lead to many of these programs not working properly any more.


wmp
0
 

Author Comment

by:assistunix
ID: 34298264
This is the current setting in my system-

root / >
# oslevel -s
5300-07-02-0806

root / >
# rpm -qa | grep AIX
AIX-rpm-5.2.0.40-1

root / >
# lslpp -h rpm.rte
Fileset Level Action Status Date Time
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
rpm.rte
3.0.5.41 COMMIT COMPLETE 05/01/09 17:41:15

Path: /etc/objrepos
rpm.rte
3.0.5.41 COMMIT COMPLETE 05/01/09 17:41:22
 
....
I tried installing an older version of gcc-3.3.2-5.aix5.3.ppc.rpm, but it gave me the same error i had gotten when i tried installing gcc-4.2.0-3.aix5.3.ppc.rpm and both versions gave me the following error. of needing an AIX-rpm greater than 5.3.0.0 .

+-----------------------------------------------------------------------------+
RPM Error Summary:
+-----------------------------------------------------------------------------+
The following errors occurred during installation:
error: failed dependencies:
AIX-rpm >= 5.3.0.0 is needed by gcc-3.3.2-5



So the issue to me, as it seems is that, the gcc versions are for aix 5.3 and although the current level of my aix is 5300-07-02-0806, but my AIX-rpm version states AIX-rpm-5.2.0.40-1(and needs to be updated) . According to you and the search i did online, it seems as the AIX-rpm "version" should show the current oslevel version which is 5300-07-02-0806.

Is that correct?

From my online search i came across this link, which states on how to update your AIX-rpm version. http://www.coolcommands.com/index.php?option=com_cc&task=display&id=789

It is mentioned to to update bos.rte and than use the following command /usr/sbin/updtvpkg to update AIX-rpm. Can you please provide your insight on that? is updating bos.rte neccesary, when the oslevel is already at 5300-07-02-0806, which is higher the 5.2.0.40-1 (the version, AIX-rpm reads).

Please assist with getting gcc installed on this system. Thank you.
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 34299131
Run

/usr/sbin/updtvpkg

to get the versions of AIX and AIX-rpm in sync.

I found a neat explanation of the purpose of AIX-rpm (see atttachment). Maybe it's better understandable than my rudimentary English.
It's from here: ftp://aix.boulder.ibm.com/aix/freeSoftware/aixtoolbox/FAQ.txt

Please look at your "RPM" thread for further details!

wmp
---- The "AIX-rpm" package doesn't actually

     install anything, and in general you can just ignore it (but DO NOT

     deinstall it!).  It is a "virtual package", created by /usr/sbin/updtvpkg

     when rpm.rte itself is installed.  It is also regenerated any time you

     rerun updtvpkg.  So what is it for?  Rpm keeps a database of every

     installed package and the files provided by each package.  However, rpm

     has no knowledge about the installp-format installed images, meaning it

     is not naturally aware of the files that make up the AIX operating system

     itself.  This presents a dependency problem: most binary rpm packages

     depend on basic AIX libraries like libc.a, but rpm is not aware that these

     libraries are available because they are not provided by any rpm package.

     AIX-rpm solves this problem.  The updtvpkg script scans all installed

     installp-format images for available shared libraries and shells, and then

     it creates the AIX-rpm package which tells rpm that these libraries are

     indeed available.  Thus, rpm thinks that AIX-rpm provides libc.a, though

     technically it is provided by AIX itself.  Then when an rpm package is

     being installed that requires libc.a (as most do), rpm knows that the

     requirement is met because it finds it in AIX-rpm.  If you are curious to

     see everything AIX-rpm "provides" on behalf of the AIX system, you can

     run "rpm -q --provides AIX-rpm".

Open in new window

0
 

Author Closing Comment

by:assistunix
ID: 34336586
Thank you for your help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now