Error when trying to use GNU profiler on AIX

Hello,

I'm trying to compile my code with �-pg' option in order to use GNU profiler as follows:

gcc example1.c -pg -o example1 -O2 -lc

But I'm getting this error :

collect2: gcrt0.o: cannot open as COFF file

I'm working on AIX 5.3

Thanks in advance for your help

AIX XCOFF and COFF format files, but does support the older format, COFF. I think that file is in another format.

Try the file command on gcrt0.o - file /path/to/gcrt0.o See what it tells you. This is just a start. Please post the output.

I do not know enough AIX to know if there are gcc options on AIX to handle this problem. By default .o files from gcc compilation are COFF. I dunno what you have there.

Hello Jim thanks for your reply

Apparently I don't have the gcrt0.o file in my system, I used the file command :

file /usr/lib/gcrt0.o

and I got this error:

/usr/lib/gcrt0.o: cannot open

any suggestions ?

Check /lib and /usr/ccs/lib.

I checked the two directories butI didn't find it :confused:

Note:
when I use gprof command I got this result :

ksh: gprof:  not found

Maybe it's not installed?

What does this output (if anything)?

lslpp -ha bos.adt.prof

or

lslpp -w "*gprof*"
1 Like

with this command:

lslpp -ha bos.adt.prof

I got :

lslpp: Fileset bos.adt.prof not installed

and this one :

lslpp -w "*gprof*"

displays the following :

  File                                        Fileset                          Type
  ----------------------------------------------------------------------------
  /usr/share/man/info/EN_US/a_doc_lib/cmds/aixcmds2/gprof.htm
                               infocenter.man.EN_US.commands                   File

It's not installed.

seeing that I'm still being new working on AIX could you please give me a link to a tutorial or something that can help me to install lt ?
thanks in advance

It's a long time since I installed any OS packages on AIX, but this looks promising.

1 Like

Installing software on AIX is straightforward (i suppose you have just the package there, no NIM-server to use, etc.). You have to do everything that follows as root:

put the package file to a new directory. If it has dependencies (see below) put them there too. At last change to this directory:

# mkdir /tmp/myinst
# cp pkg.file.1 /tmp/myinst
# cp pkg.file.2 /tmp/myinst
...
# cd /tmp/myinst

call the "inutoc" utility to create an inventory file. The file "./.toc" is created:

# inutoc .
# ls .toc
.toc

You can even inspect the file, it is plain text. Now use SMITty to install the package(s). It can be done from commandline too, but you might find it easier to do it from a menu:

# smitty install_all

in the upcoming menu select "." as the installation directory and in the following mask select "accept all license agreements", deselect "view license agreements", select "commit software" and deselect "overwrite same or newer versions".

Check "preview only" to see if everything would do OK, once you are satisfied with the results deselect that field to do the installation in real.

If you get prerequisite failures copy the respective package files to the same directory, run "inutoc" again and try again.

I hope this helps.

bakunin

1 Like

Hello CarloM & Bakunin,
Thanks a lot for your help, but the problem is that I can't find the Gnu profiler package !! I looked for it on perzl and on IBM web site but I didn't find it ...
any direct link to download it ?
Thanks in advance

No. Your immediate problem, as you described it, is that the package "bos.adt.prof" is not installed. This is part of standard AIX (though it is not installed per default) and should be on your installation sources (your installation CD, the lpp_source of your NIM-Server, ...).

I hope this helps.

bakunin

1 Like

I'm pretty sure it is bundled with the GNU C compiler in the "AIX tool box for linux"..

You can do the google stuff ;0)

Thanks dukessd for your reply, but I looked there and didn't find it, apparently I have to get the installation CD :confused:

If you have your license details then you should be able to download the ISO from the IBM site.

1 Like

IBM AIX Toolbox for Linux Applications - Alphabetical Listing

1 Like

thanks dukessd but it's not available in this link ..