StupidAIX
StupidAIX

Reputation:

Help on Compiling on AIX

Is there a site where I can find the symbols used in a particular library and its version. For e.g. I m trying to compile some code on AIX using gcc, and it throws me a lot of undefined symbol errors For example, here is an output:

ld: 0711-317 ERROR: Undefined symbol: .__fixdfdi
ld: 0711-317 ERROR: Undefined symbol: .__divdi3
ld: 0711-317 ERROR: Undefined symbol: .__moddi3
ld: 0711-317 ERROR: Undefined symbol: .__floatdidf
ld: 0711-317 ERROR: Undefined symbol: .__umoddi3
ld: 0711-317 ERROR: Undefined symbol: .__udivdi3
ld: 0711-317 ERROR: Undefined symbol: .__fixunsdfdi

Where do I go to find where these symbols are. If I run the same gcc command on Linux, it runs fine.

I tried including -lgcc also but then again it throws undefined symbols for some register_frame ...blah blah... and I m getting sick of AIX.

Any help on this would be appreciated..and please don't bother Googling on this issue. You will end up no where.

Many have asked this kind of questions but no answers.

Thanks

Upvotes: 1

Views: 3016

Answers (5)

Alexander Ushakov
Alexander Ushakov

Reputation: 5399

Listed external symbols are from libgcc so add of -lgcc is correct. And register_frame also is part of libgcc but only for 32-bit. Check if you use the same bit depth mode for you compiler, linker and libraries.

Upvotes: 0

This is because you used the gcc to compile a library you want to link to a code compiled with xlc. Or at least is my case

You have 2 options:

  1. use the xlc instead of gcc for all the compilation (don't mix gcc and xlc)
  2. compile with xlc but calling also the gcc libraries, for instance:
sudo  find  / -name libgcc.a
/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/libgcc.a

/opt/IBM/xlC/13.1.0/bin/xlC -g  -o MyBIN MyBIN.o  -L/usr/etctera -
 L/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/ -lgcc -letcetera

Upvotes: 1

John Grieggs
John Grieggs

Reputation: 236

Those are math symbols. Try adding -lm to your link line.

Upvotes: 2

Jonathan Leffler
Jonathan Leffler

Reputation: 753695

Mostly questions:

  • Which version of GCC?
  • Which version of AIX are you on?
  • Which version of AIX was your copy of GCC built for?
  • What exactly is the link line you are using?

I've seen that sort of error when using a version of GCC compiled on a down-version of AIX. For example, if the GCC was compiled for AIX 4.3.3 and is being run on AIX 5.x. Usually, if GCC was compiled on an up-version of AIX, it won't run on the down-version, so that is unlikely to be the problem.

One other (rather unlikely) possibility: is your GCC installed where it was compiled to expect to be installed? When you build it, you specify (possibly implicitly) the install location (by default, under /usr/local). If you have your copy installed somewhere else, but there's an old GCC in /usr/local and your copy expects to be installed in /usr/local, then you can run into this sort of problem. This is much less likely than version mismatching.

Upvotes: 0

Gordon Thompson
Gordon Thompson

Reputation: 4834

It's been a long time since I compiled anything on AIX (thankfully) and I do feel your pain having spent a good year or so trying to get our company's JNI and other software libraries built on AIX.

I do seem to remember that GCC never worked particularly well as it always came up with similar errors. Is there any option to use the native compiler (xlC)?

Failing that I would check the ordering of your libraries, it plays a big part in making stuff work properly..

I take it that you have use the nm utility to iterate through every library in /usr/lib (etc) to find where the missing symbols are located?

Upvotes: 1

Related Questions