How to compile shared library on AIX

screwed

I have a simple shared library that is currently compiled on Linux using:

gcc -c -fPIC foo.c -o foo.o

gcc -shared -o foo.so foo.o

I need to relay instructions to a colleague for compiling the same on AIX. I do not know if my colleague will be using gcc on AIX or a native compiler.

Will these gcc instructions also work for AIX? If not, what modifications are necessary? Linux gcc version is 4.4.7 Can anyone provide instructions for same using native AIX compiler? xlC?

Thank you.

Tomasz Klim

On AIX you can have 3 compilers:

  • GCC
  • newer XL C/C++ Enterprise Edition
  • older VisualAge C++ Professional

For GCC since late 2.x, syntax for creating shared libraries is:

gcc -shared -Wl,-soname,your_soname -o library_name file_list library_list

Example:

gcc -fPIC -g -c -Wall a.c
gcc -fPIC -g -c -Wall b.c
gcc -shared -Wl,-soname,libmystuff.so.1 -o libmystuff.so.1.0.1 a.o b.o -lc

For the above AIX native compilers, see this page for detailed instructions:

http://www.ibm.com/developerworks/aix/library/au-gnu.html

(see section Shared libraries on AIX versus System V systems)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to create a shared library with cmake?

From Java

How to CMake compile a library as part of my app's source and not as static/shared library?

From Dev

How shared library dependencies are resolved?

From Dev

How do I cross compile zlib with shared library on MAC OSX?

From Dev

libtool don't compile Fortran to shared library

From Dev

How to compile forked library in Gradle?

From Dev

how to call atexit in a shared library?

From Dev

Compile a C program in Linux using shared library

From Dev

How to compile, create shared library, and import c++ boost module in Python

From Dev

Setting path to shared library inside a makefile for compile

From Dev

How to compile CLOGS library

From Dev

How to build glfw as a shared library?

From Dev

Shared Library won't compile, *.a file missing

From Dev

How to compile gcc with static library?

From Dev

How to compile gcc with shared library?

From Dev

Error trying to compile a C++ program that uses a shared library

From Dev

How shared library dependencies are resolved?

From Dev

how to compile, setup, and make a library .so as shared in linux

From Dev

How to use shared library

From Dev

How do I compile RHEL5 compatible shared library from RHEL6 machine with GCC 4.4.6?

From Dev

using linux shared library on AIX

From Dev

How to check if a shared library is installed?

From Dev

How to compile libusb as shared library?

From Dev

how to link shared library from non existing(in compile time) folder

From Dev

Setting path to shared library inside a makefile for compile

From Dev

How to compile CLOGS library

From Dev

how to include and compile a library in a makefile

From Dev

How to compile gcc with shared library?

From Dev

How to compile gcc with static library?

Related Related

  1. 1

    How to create a shared library with cmake?

  2. 2

    How to CMake compile a library as part of my app's source and not as static/shared library?

  3. 3

    How shared library dependencies are resolved?

  4. 4

    How do I cross compile zlib with shared library on MAC OSX?

  5. 5

    libtool don't compile Fortran to shared library

  6. 6

    How to compile forked library in Gradle?

  7. 7

    how to call atexit in a shared library?

  8. 8

    Compile a C program in Linux using shared library

  9. 9

    How to compile, create shared library, and import c++ boost module in Python

  10. 10

    Setting path to shared library inside a makefile for compile

  11. 11

    How to compile CLOGS library

  12. 12

    How to build glfw as a shared library?

  13. 13

    Shared Library won't compile, *.a file missing

  14. 14

    How to compile gcc with static library?

  15. 15

    How to compile gcc with shared library?

  16. 16

    Error trying to compile a C++ program that uses a shared library

  17. 17

    How shared library dependencies are resolved?

  18. 18

    how to compile, setup, and make a library .so as shared in linux

  19. 19

    How to use shared library

  20. 20

    How do I compile RHEL5 compatible shared library from RHEL6 machine with GCC 4.4.6?

  21. 21

    using linux shared library on AIX

  22. 22

    How to check if a shared library is installed?

  23. 23

    How to compile libusb as shared library?

  24. 24

    how to link shared library from non existing(in compile time) folder

  25. 25

    Setting path to shared library inside a makefile for compile

  26. 26

    How to compile CLOGS library

  27. 27

    how to include and compile a library in a makefile

  28. 28

    How to compile gcc with shared library?

  29. 29

    How to compile gcc with static library?

HotTag

Archive