9

We have installed GCC and libgcc on AIX 6.1 using the RPM files.

What I would like to know is why "libgcc_s.a" was not created under the following folder?

/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/

There is a libgcc.a in that folder but not libgcc_s.a and the linker seems to want that libgcc_s.a file there

Reason I ask is if I try create a simple "hello world" type shared lib on AIX 6.1 it complains and says someting like "cannot find libgcc_s.a".

I have run a command like:

find / -name '*libgcc*' -print 2>/dev/null

to try find libgcc_s.a on tha machine but there is nothing ;-(

Any idea how I can get libgcc_s.a onto the AIX machine?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Lynton Grice
  • 1,435
  • 3
  • 29
  • 45
  • 3
    It seems that `libgcc_s.a` does not exist: only the shared version does: `libgcc_s.so`. Same for `libgcc.a`, which only exists in static version. See also: http://stackoverflow.com/questions/4547384/difference-between-lgcc-s-and-gcc – Ciro Santilli OurBigBook.com Jun 08 '15 at 11:26

2 Answers2

3

You might try to compile using the option -static-libgcc.

alk
  • 69,737
  • 10
  • 105
  • 255
  • Hi there, i did that on my C library but now it says undefined symbol: .main any ideas? – Lynton Grice Oct 19 '11 at 07:00
  • @Lynton Grice: So at least you are one step further now ... ;-) - which other options did you use? A lib normally has no main() hasn't it? – alk Oct 19 '11 at 08:21
  • How can one achieve the effect of `-static-libgcc` without using `-static-libccc`? I have tired `gcc hello.c libc.a libgcc.a -Wl,-Bstatic -lc -lgcc` but it says "cannot file -lgcc_s". – Z boson Oct 10 '14 at 10:33
  • @Zboson: I say you cannot. Any background on why you want to "switch on the light without using the switch to do do"? – alk Oct 10 '14 at 10:49
  • oppps, I mean I think I can do it by doing `gcc -c hello.c` and then using `ln ...` I just need to figure out the ... now. – Z boson Oct 10 '14 at 11:01
  • How should `ln` help here? You meant `ld`? @Zboson – alk Oct 10 '14 at 11:08
  • sorry, yeah, I mean `ld`. – Z boson Oct 10 '14 at 11:08
  • Something like `ld -o hello libgcc.a libc.a hello.o`. But that does not work. – Z boson Oct 10 '14 at 11:09
  • You are on AIX? @Zboson – alk Oct 10 '14 at 11:14
  • No, why do you ask? I'm just trying to understand the gears in the blackbox. – Z boson Oct 10 '14 at 11:16
  • Because this question referred to gcc **on AIX**. You might liek to consider asking your own question on your specific problem. @Zboson – alk Oct 10 '14 at 11:17
  • Yes,that's what I'll have to do though I think AIX is a red herring here. – Z boson Oct 10 '14 at 11:20
0

Probably you may want to build gcc with --enable-shared option.

Vijay Nag
  • 101
  • 1
  • 2