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.
On AIX you can have 3 compilers:
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.
Comments