Solved

g++ 3.0 on AIX 4.3.2

Posted on 2001-08-01
50
1,589 Views
Last Modified: 2013-12-26
Our sysadmin recently installed g++3.0 on our IBM workstations at my request.

Unfortunately, all programmes which use the standard library give the following error at link time

ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

By doing some research on the web, I have discovered that this is connected to the fact that
g++ invokes the inbuilt linker.

Please give me a workaround so that I can use g++3.0 on this machine.
0
Comment
Question by:glebspy
  • 28
  • 21
50 Comments
 
LVL 1

Author Comment

by:glebspy
ID: 6341042
Config: powerpc-ibm-aix4.3.2.0-g++
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 225 total points
ID: 6341569
listening ..
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6341605
listening ..dont have this platform handy, so just can give some hints:
  - first use the native linker's -v option to get an idea what the linker uses by default
  - then use g++ -v to get the defaults used by g++
  - compare the results
  - probably you need to add some AIX-special libs to the g++ command, therfore use the -Xlinker or -Wl,  options (see man gcc)
0
 
LVL 1

Author Comment

by:glebspy
ID: 6343150
vil@leda5:~>ld -v
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.
vil@leda5:~>ld -verbose
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.
vil@leda5:~>ld -V
ld: 0706-011 The -V flag needs a parameter.
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.
hmm

vil@leda5:~>ld -Verbose
ld: 0706-027 The -V erbose flag is ignored.
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.
vil@leda5:~>ld -Version
ld: 0706-027 The -V ersion flag is ignored.
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.
vil@leda5:~>ld -version
ld: 0706-030 No processing done.  Specify at least one
        input or import file or use at least one -b ex<n> option.

vil@leda5:~>/rccp/AIX/bin/g++ -v
Reading specs from /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/specs
Configured with: ../gcc-3.0/configure --prefix=/rccp/AIX
Thread model: single
gcc version 3.0

g++ -v doesnt seem to give me any linker options, and ld -v doesnt seem to do *anything*.


0
 
LVL 30

Expert Comment

by:Axter
ID: 6343427
glebspy,
To fix your problem try the following:

Go to the command line and type "which g++"
That should return something like the following:
/home/gcc/bin/g++

Then using the above return path value modify the path by entering the following command line:
set path = ( /home/gcc/bin $path )

Then change the current directory to the directory that contains your test.c file.
Enter the following:
g++ test.c


That should compile your code.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6343556
Dear Axter,
 Thank you for trying to help me compile my code. I'd like to draw your attention to the fact that the first error message is produced by the linker, indicating a successful compile. So perhaps my path environment variables are set correctly.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6344133
> g++ -v doesnt seem to give me any linker options, and ld -v doesnt seem to do *anything*.

Of corse you need to give a full valid g++ command line, with usefull options and arguments, plus the additional option -v (same for ld).
0
 
LVL 1

Author Comment

by:glebspy
ID: 6344170
ok, thanks - I did that.

It doesn't seem to run a linker at all.. instead it runs a programme called collect2 ..

 as -u -mcom -o /tmp/ccntxqkw.o /tmp/ccubdb9Z.s
 /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/collect2 -bpT:0x10000000 -bpD:0x20000000 -btextro -bnodelcsect /lib/crt0.o -L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0 -L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../.. /tmp/ccntxqkw.o -lstdc++ -lm -lgcc_s /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/libgcc.a -lc -lgcc_s /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/libgcc.a
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6344365
.. and how about the output of AIX's proprietary compiler/linker?

If you know where AIX stores the C++ libs, you may use nm to find the lib you need to add to your linker command-line, like:

     csh
     cd <lib-dir>
     foreach l (lib*)
      nm -gop|grep '_S_max_size'|grep T
     end

then add the found lib the g++ command
0
 
LVL 1

Author Comment

by:glebspy
ID: 6344801
I have found a number of versions of libstdc++ on the system, but in each case the nm -gop command either returns a blank, or a

nm: libstdc++.a.2.10.0[cstrmain.o]: 0654-206 Cannot process the symbol table.

What I guess is these symbols are only defined in the latest version of  the standard library distributed with gcc 3.0, and therefore won't be found in any versions of stdlib which were preexisting on the file system. Does that sound reasonable? I wonder if there is any known remedy.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6345161
> Does that sound reasonable?
Not realy.
look at the  g++ -v   output you posted, and you'll see that it uses libs from a special gcc-lib path.
Go to that path and check the libs there with the given nm example earlier.
Also use the suggested option (annonced by the error message) to get an idea where these symbols are used. Probably it's just multiple-cross-reference problem, which can be fixed by using multible -lc options.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6345580
ok, I understand the principle but your shell script doesn't work. It says
`syntax error at line 3 : `(' unexpected'

Here's the script as I typed it:
csh
cd /rccp/AIX/bin
foreach l (lib*)
nm -gop|grep '_S_max_size'|grep T
end
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6346654
1. > syntax error at line 3 : `(' unexpected'
   unbelieveable if you have typed it on command line in csh
2. > cd /rccp/AIX/bin
   where did you get this path? Can't see it anywhere in the output of gcc -v ...
   You need to do:
        cd /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0

0
 
LVL 1

Author Comment

by:glebspy
ID: 6347284
1. > syntax error at line 3 : `(' unexpected'
             unbelieveable if you have typed it on command line in csh

Aha - I didn't type it on the command line, I catted your stuff to a script and then ran it.

           2. > cd /rccp/AIX/bin
             where did you get this path? Can't see it anywhere in the output of gcc -v ...

It says -L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../..

This is equivalent to the above, there is no funny stuff like symbolic links.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6347288
I meant lib rather than bin, sorry.  When I did it for real I used lib.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6347909
so, did you find the libs with the required symbols?
0
 
LVL 1

Author Comment

by:glebspy
ID: 6351300
Sorry for the delay, I'm online again now pretty much for good.

This sounds real lame but I'm having trouble with your script again. I emphasize I know nothing about unix.

Here's my output

>script scriptfile
>more scriptfile


Script started on Sat Aug  4 21:33:22 2001vil has logged on pts/0 from vela.

vil has logged on pts/1 from vela.
vil has logged on pts/2 from vela.
vil@leda5:~>csh^M
^M^[[3g^[[48;9H^[H^[[48;17H^[H^[[48;25H^[H^[[48;33H^[H^[[48;41H^[H^[[48;49H
^[H^[[48;57H^[H^[[48;65H^[H^[[48;73H^[H^M^Mleda5-vil[104]% cd /rccp/AIX/lib/
gcc-lib/powerpc-ibm-aix4.3.2.0/3.0
/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0
cc1*         cpp0*        jvgenmain*   libobjc.la   pthread/
cc1obj*      f771*        libg2c.a     power/       specs
cc1plus*     include/     libgcc.a     powerpc/     tradcpp0*
collect2*    jc1*         libobjc.a    ppc64/
leda5-vil[105]% foreach l (lib*)
? nm -gop|grep '_S_max_size'|grep T
? end
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
leda5-vil[106]% which nm
^M^[[3g^[[48;9H^[H^[[48;17H^[H^[[48;25H^[H^[[48;33H^[H^[[48;41H^[H^[[48;49H
^[H^[[48;57H^[H^[[48;65H^[H^[[48;73H^[H^M^M/usr/bin/nm
leda5-vil[107]% whereis nm
nm: /usr/bin/nm /usr/usg/nm /usr/ccs/bin/nm
leda5-vil[108]% foreach l (lib*)
? /usr/ccs/bin/nm -gop |grep '_S_max_size'|grep T
? end
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
leda5-vil[109]% foreach l (lib*)
? /usr/usg/nm  -gop |grep '_S_max_size'|grep T
? end
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
leda5-vil[110]% foreach l (lib*)
? /usr/bin/nm -gop |grep '_S_max_size'|grep T
? end
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...
Usage: nm [-ACfhprTv] [-B|-P] [-e|-g|-u] [-d|-o|-x|{-t [d|x|o]}]
                [-X{32|64|32_64}] [--] File ...

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6351313
arrgh, stupid AIX doesn't ignore invalid options ...
try replacing    nm -gop    by   nm -g -o
probably read man-page to (-g should print global symbols, -o should print filename for each listed symbol)
0
 
LVL 1

Author Comment

by:glebspy
ID: 6351361
Dear ahoffmann,
 Your script works with all the options, if I insert $l before the first pipe. Sorry I didn't think of trying that earlier. I told you I was lame..  

The output looks like this, what should I do now? There's no obvious proprietary compiler.. this group isn't much into c++ so I can believe it wasn't installed at the outset. The command 'c++' seems to point to the old version of g++ (2.95), which was also installed at my request.

----

Script started on Sat Aug  4 22:20:20 2001vil has logged on pts/0 from vela.

vil has logged on pts/1 from vela.
vil has logged on pts/2 from vela.
vil@leda5:~>csh^M
^M^[
leda5-vil[130]% cd rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3
 
/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4
.3.2.0/3.0
/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0
cc1*         cpp0*        jvgenmain*   libobjc.la   pthread/
cc1obj*      f771*        libg2c.a     power/       specs
cc1plus*     include/     libgcc.a     powerpc/     tradcpp0*
collect2*    jc1*         libobjc.a    ppc64/
leda5-vil[131]% foreach l (lib*)
? nm -gop $l|grep 'S_max_size' |grep T
? end
nm: libobjc.la: 0654-203 Specify an XCOFF object module.
leda5-vil[132]% cd /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../..
 
/rccp/AIX/lib
gcc-lib/                     libiberty.a
libacegr_np.a@               libstdc++.a*
libgcc_s.a                   libstdc++.la*
libgcc_s_power.a             libsupc++.a
libgcc_s_powerpc.a           libsupc++.la*
libgcc_s_ppc64.a             perl5/
libgcc_s_pthread.a           power/
libgcc_s_pthread_power.a     powerpc/
libgcc_s_pthread_powerpc.a   ppc64/
libgcc_s_pthread_ppc64.a     pthread/
leda5-vil[133]% foreach l (lib*)
? nm -gop $l|grep 'S_max_size' |grep T
? end
_ZNSs4_Rep11_S_max_sizeE T 02001141124
nm: libstdc++.la: 0654-203 Specify an XCOFF object module.
nm: libsupc++.la: 0654-203 Specify an XCOFF object module.
leda5-vil[134]% Now the directories used by the old version of gcc(2.95)
Badly placed ()'s.
leda5-vil[135]% cd /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95
/usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95
#inst.17608#*  cc1obj*        f771*          libg2c.a       powerpc/
SYSCALLS.c.X   cc1plus*       include/       libgcc.a       soft-float/
aix64/         chillrt0.o     jc1*           libobjc.a      specs
cc1*           collect2*      jvgenmain*     libstdc++.a@
cc1chill*      cpp*           libchill.a     power/
leda5-vil[136]% foreach l (lib*)
? nm -gop $l|grep 'S_max_size' |grep T
? end
nm: libstdc++.a[cstrmain.o]: 0654-206 Cannot process the symbol table.
leda5-vil[137]% cd /usr/local/lib
/usr/local/lib
aix64/               libiberty.a          powerpc/
g++-include/         libstdc++.a.2.10.0   soft-float/
gcc-lib/             power/
leda5-vil[138]%  foreach l (lib*)
?  nm -gop $l|grep 'S_max_size' |grep T
?  end
nm: libstdc++.a.2.10.0[cstrmain.o]: 0654-206 Cannot process the symbol table
.
leda5-vil[139]% exit
leda5-vil[140]% vil has logged on pts/4 from vela.
vil@leda5:~>ie^[[^[[^[[Kexit^M

script done on Sat Aug  4 22:26:01 2001
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6351393
as I see you checked with nm all libs along the path cd /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/
And you didn't find one. Sorry then I'm out of ideas.
As I read ypur posted outputs, I don't think that there is a conflict, or miss-configuration of g++ 2.95 and 3.0.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6351404
I suppose this line

_ZNSs4_Rep11_S_max_sizeE T 02001141124

Means that it found the symbol *exactly once* which means it should work.


>as I see you checked with nm all libs along the path cd /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/

Well, it felt like I didn't check the subdirectories of this directory.. do I need to, or does nm take care of that for me?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6351423
> _ZNSs4_Rep11_S_max_sizeE
oops, there is one, but unfortunately nm didn't as i expected:(
please add a
    echo $l
before the nm -gop ... line, so we can see which lib is in,
then cheeck if this lib also contains your other undefined symbols. Just to be shure ...
0
 
LVL 1

Author Comment

by:glebspy
ID: 6375541
Again sorry for the delay.

Here's the output..

One thing I don't understand. Does this indicate a clash?

leda5-vil[136]% foreach l (lib*)
? echo $l
? nm -gop $l | grep '_S_max_size' |grep T
? end
libacegr_np.a
libgcc_s.a
libgcc_s_power.a
libgcc_s_powerpc.a
libgcc_s_ppc64.a
libgcc_s_pthread.a
libgcc_s_pthread_power.a
libgcc_s_pthread_powerpc.a
libgcc_s_pthread_ppc64.a
libiberty.a
libstdc++.a
_ZNSs4_Rep11_S_max_sizeE T 02001141124
libstdc++.la
nm: libstdc++.la: 0654-203 Specify an XCOFF object module.
libsupc++.a
libsupc++.la
nm: libsupc++.la: 0654-203 Specify an XCOFF object module.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377008
something is going mad on your system. If I look at you last comment, nm says thaqt the symbol is in libstdc++.a (which makes sense), but in this comment libstdc++.a.2.10.0 is not processed. libstdc++.a usualy is a link to for example libstdc++.a.2.10.0.
Also in a previous comment we see:
     nm: libstdc++.a.2.10.0[cstrmain.o]: 0654-206 Cannot process the symbol table
which sounds like a corupted lib.
Could you please verify/clarify this? (post: find / -xdev -name libstdc++.a\* -exec ls -l {} }; )
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377017
vil@vela:~>(post: find / -xdev -name libstdc++.a\* -exec ls -l {} };)
post:: Too many arguments.
vil@vela:~>find / -xdev -name libstdc++.a\* -exec ls -l {} } ;
find: incomplete statement

Dear Ahoffmann,
  Your post wasn't lame enough for me. What am I doing wrong ..
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377022
find / -xdev -name libstdc++.a\* -exec ls -l {} \;

# sorry for typo
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377027
Not very informative I'm afraid, it took about a second to produce this:

vil@leda5:~>find / -xdev -name libstdc++.a\* -exec ls -l {} \;
find: cannot chdir to </lost+found> : Permission denied
find: cannot chdir to </audit> : Permission denied
find: cannot chdir to </dev/.SRC-unix> : Permission denied
find: cannot chdir to </etc/security> : Permission denied
find: cannot chdir to </etc/IMNSearch/dbcshelp/work> : Permission denied
find: cannot chdir to </.dt/Desktop> : Permission denied
find: cannot chdir to </.netscape> : Permission denied
vil@leda5:~>
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377031
I thought there might be some sort of cross-mounting issue so I tried this:

vil@leda5:~>find /rccp/ -xdev -name libstdc++.a\* -exec ls -l {} \;
-rwxr-xr-x   1 root     system   3996479 Aug  2 10:22 /rccp/AIX/lib/pthread/power/libstdc++.a
-rwxr-xr-x   1 root     system   4031470 Aug  2 10:21 /rccp/AIX/lib/pthread/libstdc++.a
-rwxr-xr-x   1 root     system   4031589 Aug  2 10:23 /rccp/AIX/lib/pthread/powerpc/libstdc++.a
-rwxr-xr-x   1 root     system   4315781 Aug  2 10:23 /rccp/AIX/lib/pthread/ppc64/libstdc++.a
-rwxr-xr-x   1 root     system   3795873 Aug  2 10:19 /rccp/AIX/lib/libstdc++.a
-rwxr-xr-x   1 root     system   3761290 Aug  2 10:22 /rccp/AIX/lib/power/libstdc++.a
-rwxr-xr-x   1 root     system   3796094 Aug  2 10:22 /rccp/AIX/lib/powerpc/libstdc++.a
-rwxr-xr-x   1 root     system   4076642 Aug  2 10:22 /rccp/AIX/lib/ppc64/libstdc++.a
vil@leda5:~>
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377035
and this:
vil@leda5:~>find /usr/ -xdev -name libstdc++.a\* -exec ls -l {} \;
find: cannot chdir to </usr/lost+found> : Permission denied
find: cannot chdir to </usr/lpp/X11/Xamples/programs/xbiff/bitmaps> : Permission denied
find: cannot chdir to </usr/lpp/bos.sysmgt/inst_root/var/security> : Permission denied
find: cannot chdir to </usr/lpp/IMNSearch.rte/inst_root/etc/IMNSearch> : Permission denied
find: cannot chdir to </usr/lpp/internet/server_root/admin-bin> : Permission denied
find: cannot chdir to </usr/lib/boot/network> : Permission denied
vil@leda5:~>find /usr/local/ -xdev -name libstdc++.a\* -exec ls -l {} \;
find: cannot chdir to </usr/local/lost+found> : Permission denied
lrwxrwxrwx   1 root     staff         27 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/libstdc++.a -> ../../../libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         50 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/soft-float/power/libstdc++.a -> ../../../../../soft-float/power/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         41 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/soft-float/libstdc++.a -> ../../../../soft-float/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         52 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/soft-float/powerpc/libstdc++.a -> ../../../../../soft-float/powerpc/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         50 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/soft-float/aix64/libstdc++.a -> ../../../../../soft-float/aix64/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         36 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/power/libstdc++.a -> ../../../../power/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         38 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/powerpc/libstdc++.a -> ../../../../powerpc/libstdc++.a.2.10.0
lrwxrwxrwx   1 root     staff         36 May 16 15:38 /usr/local/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95/aix64/libstdc++.a -> ../../../../aix64/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3639099 May 16 15:38 /usr/local/lib/soft-float/power/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3699461 May 16 15:38 /usr/local/lib/soft-float/powerpc/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    4124057 May 16 15:38 /usr/local/lib/soft-float/aix64/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3691045 May 16 15:38 /usr/local/lib/soft-float/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3623595 May 16 15:38 /usr/local/lib/power/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3691271 May 16 15:38 /usr/local/lib/powerpc/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    4126295 May 16 15:38 /usr/local/lib/aix64/libstdc++.a.2.10.0
-rw-r--r--   1 root     staff    3681429 May 16 15:38 /usr/local/lib/libstdc++.a.2.10.0

did I do wrong???
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377073
> did I do wrong???
No, nearly perfect.
Problem with find is the -xdev option (seems to work on AIX;-). Sounds like AIX expands -xdev to all mounted partitions, not only NFS-mounted. Sorry didn't expect that.
Should have used:
     find / -name libstdc++.a\* -exec ls -l {} \;

So, back to the topic, you find a lot of libstdc++.a. Now we need to find that one used by g++. This is done by:
    g++ -v < and all other options and arguments, see previos comments>

This must list at least one path to libstdc++.a. Compare this path to the output of the find command. It must match, excatly, somehow.
Then you can use the nm -gop to find the missing symbol in this library. If you get somthing like:
    nm: libstdc++.a[cstrmain.o]: 0654-206 Cannot process the symbol table.

you have either a corrupted library (most usual), or it might be a disk and/or NFS problem.

Are the steps to do clear, so far? Please post results ..
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377092
Here are the libraries which are explicitly included in g++ -v

-L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0 -L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../.. /tmp/ccWKldMR.o
  -lstdc++
  -lm
  -lgcc_s

Ostensibly at least, there's a match to
-rwxr-xr-x   1 root     system   3795873 Aug  2 10:19 /rccp/AIX/lib/libstdc++.a

from the output of the find command.

now I do

nm -gop /rccp/AIX/lib/libstdc++.a |grep 'S_max_size'|grep T

and

nm -gop /rccp/AIX/lib/libstdc++.a |grep 'S_terminal'|grep T


and I get:
vil@leda5:~>nm -gop /rccp/AIX/lib/libstdc++.a |grep 'S_max_size'|grep T
_ZNSs4_Rep11_S_max_sizeE T 02001141124
vil@leda5:~>nm -gop /rccp/AIX/lib/libstdc++.a | grep 'S_terminal' | grep T
_ZNSs4_Rep11_S_terminalE T 02001141130

What does this mean?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377110
> Ostensibly at least, there's a match to
> -rwxr-xr-x   1 root     system   3795873 Aug  2 10:19 /rccp/AIX/lib/libstdc++.a

How comes this?
I cannot see any   -L/rccp/AIX/lib/  or  /rccp/AIX/lib/libstdc++.a  option or argument in your g++ command.
Just try to add either of these two.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377115
-L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../..
(which you see)

is the same as -L/rccp/AIX/lib/, isn't it?

I tried
cd /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../.. ;  pwd

and it gave
/rccp/AIX/lib/
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377117
I tried what you said:

vil@leda5:~>/rccp/AIX/bin/g++ -L/rccp/AIX/lib test2.C
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
vil@leda5:~>
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377123
> -L/rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../..
(which you see)
> is the same as -L/rccp/AIX/lib/, isn't it?

It might be, but must not be, 'cause .. does not give you what you expect if there is a link.
But cd && pwd example proofed that it's ok here ;-)

So, if this lib contains the symbols, and it is used in your g++ command line, I'm out of ideas.
I only can imagine that there is a multiple cross-reference of these symbols somehow (which usualy is not within system libs).
So last suggestion try adding multiple  -lstdc++  arguments to g++
     
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377126
/rccp/AIX/bin/g++ -L/rccp/AIX/lib -lstdcc++ test2.C
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377130
Overkill

/rccp/AIX/bin/g++ -L/rccp/AIX/lib/ -lstdc++ -lstdc++ -lstdc++ -lstdc++ -lstdc++ -lstdc++ test2.C
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.


Is there any way that you can say `Only use those libraries which I specify on the command line?'

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377156
-nostdlibs

# and use the options printed by ld to see where the reference comes from
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377167
-nostdlib just gave me a whole load more undefined symbols.
vil@leda5:~>/rccp/AIX/bin/g++ -nostdlib -L/rccp/AIX/bin -lstdc++ -L /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0 -lgcc_s -lm test2.C
ld: 0711-327 WARNING: Entry point not found: __start
ld: 0711-317 ERROR: Undefined symbol: .__iso_wcsftime
ld: 0711-317 ERROR: Undefined symbol: .__iso_wcstok
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
ld: 0711-317 ERROR: Undefined symbol: .free
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
ld: 0711-317 ERROR: Undefined symbol: .malloc
ld: 0711-317 ERROR: Undefined symbol: __quous
ld: 0711-317 ERROR: Undefined symbol: .strlen
ld: 0711-317 ERROR: Undefined symbol: .memchr
ld: 0711-317 ERROR: Undefined symbol: .memmove
ld: 0711-317 ERROR: Undefined symbol: .memcpy
ld: 0711-317 ERROR: Undefined symbol: .memset
ld: 0711-317 ERROR: Undefined symbol: .fetch_and_add
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377170
The noquiet option gave me the following output, which I don't know how to interpret. I tried using the loadmap option but it said it needed a parameter..

vil@leda5:~>/rccp/AIX/bin/g++ -Wl,-bnoquiet -L/rccp/AIX/bin -lstdc++ test2.C
(ld): halt 4
(ld): setopt r/o->w
(ld): setopt nodelcsect
(ld): savename a.out
(ld): filelist 8 2
(ld): i /lib/crt0.o
(ld): i /tmp/cciSQWiI.o
(ld): lib /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../../libstdc++.a
(ld): i /tmp/ccUP77zX.o
(ld): lib /usr/lib/libm.a
(ld): lib /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/../../../libgcc_s.a
(ld): i /rccp/AIX/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.0/libgcc.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libstdc++.a[libstdc++.so.3]: 1221 symbols imported.
LIBRARY: Shared object libgcc_s.a[shr.o]: 88 symbols imported.
LIBRARY: Shared object libc.a[shr.o]: 2138 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 10 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 78 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 8
(ld): exports /tmp/cc080nO0.x
EXPORTS: Symbols exported: 33
(ld): initfini _GLOBAL__FI_a_out _GLOBAL__FD_a_out
(ld): resolve
RESOLVE: 168 of 4908 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 32 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
        The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing Symbol
 ----------------------------------------------------------------------------------------------
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_max_size
 std::string::_Rep::_S_max_size[54]    ER RW test2.C(/tmp/ccUP77zX.o)
                                   00007acc .data    R_POS    [674]   <std::string::_Rep::_S_max_size>
ld: 0711-317 ERROR: Undefined symbol: std::string::_Rep::_S_terminal
 std::string::_Rep::_S_terminal[64]    ER RW test2.C(/tmp/ccUP77zX.o)
                                   00007ae0 .data    R_POS    [684]   <std::string::_Rep::_S_terminal>
ER: The return code is 8.
collect2: ld returned 8 exit status
0
 
LVL 1

Author Comment

by:glebspy
ID: 6377182
I have one thing to add. If you don't have any idea what's wrong, I'm tempted to delete the question, since chances of anyone else helping me after this time are zilch. However that would be lousy manners, since you've taught me plenty with your comments, and it might lead to something I can ask my sytem manager about even though he is approximately as lame as I am (well perhaps that's an exaggeration). The problem is I have 0 points and I need some for another question, and I'm Knowledgepro so I don't get 5 per day.

If you think you're at the end of your tether, answer this question, it's probably real easy for you. I'll give you all the points with an A grade.

I need a script to strip the first 17 bytes from every file in a directory which contains the word `binary'. These are you guessed it, binary files.

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6377760
> -nostdlib just gave me a whole load more undefined symbols.
That's exactly what you asked for.

The undefined symbols are produced by your test2.C. Could it be that you try to use a standard c++ function with improper arguments (wrong type)?

BTW, are you used to compilers and linkers?

0
 
LVL 1

Author Comment

by:glebspy
ID: 6378297
test2.C just contains the following:
#include<string>
#include<iostream>
int main(void){
  using namespace ::std;

  string a;
  a+="dfgjgjdjd";
  cout<<a<<endl;
}

A little, not much..
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6378737
> using namespace ::std;
is that your problem?
0
 
LVL 1

Author Comment

by:glebspy
ID: 6379155
removing that line causes the programme not to compile. That's a major difference between gcc3.0 and previous versions as I understand it - that the standard library is now a namespace, and objects like string have to be explicitly brought into scope with "using namespace std::"

/rccp/AIX/bin/g++ test2.C
test2.C: In function `int main()':
test2.C:5: `string' undeclared (first use this function)
test2.C:5: (Each undeclared identifier is reported only once for each function
   it appears in.)
test2.C:5: parse error before `;' token
test2.C:6: `a' undeclared (first use this function)
test2.C:7: `cout' undeclared (first use this function)
test2.C:7: `endl' undeclared (first use this function)
vil@leda1:~>

 
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6379224
sounds that your libstdc++.a is not for g++ 3.0
Did you install the lib after installing g++ 3.0?
Is the lib realy different to that fo 2.95 (different size, different symbol with nm, not a symlink)?
0
 
LVL 1

Author Comment

by:glebspy
ID: 6379253
sysadmin says he did. I guess I should try to hunt down the install directory.. it's nowhere obvious.

The reason I believe him is that the gcc download comes with the latest stdlib.

The lib really is different, yes. I was also quite surprised. They are seriously incompatible.
0
 
LVL 1

Author Comment

by:glebspy
ID: 6388395
Sorry for trying to barter off the points which I assigned for the question. Thanks for trying
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6388905
what was the problem/solution now?
0
 
LVL 1

Author Comment

by:glebspy
ID: 6389138
Unfortunately I still don't know, but I've decided to try to find a more stable environment to work on like perhaps Linux. Hopefully this will have the added benefit that I'll be managing it myself.
0

Featured Post

Free Trending Threat Insights Every Day

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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