January 03, 2005

:: XLF Static Linking on OSX (1)

In Apple's FORTRAN forum, Dr. Craig Hunter brought up a long-time problem of compiling program on MacOS X with IBM XL Fortran. Actually, if you take a look carefully on gcc based compilers linking MacOS X's Mach-O binaries, you will find similar problem. By the way, XL compiler on MacOS X is also a gcc-based compiler. Basically the gcc (I should say, libc ? libSystem or libm, according to AbSoft Technical Support) shipped with Xcode doesn't do static build, period. However at least you can do gcc -static-gcc to 'static' build your binary with dynamic crt1.o ....

For XL FORTRAN, you probably can only do this as Pooch website mentioned, to remove several dynamic library files. (Or, also described in my blog article) By the way, my friend Bryan and I were talking about the gcc static linking problem last month, that's why I got a better chance to review the problem. So I did a small test...

Here is a test fortran file:

      print *,"test"
      end
This is what I did:
$ xlf -O2 -qarch=g5 -c test.f
$ gcc -O3 -fast -static-libgcc -L/opt/ibmcmp/xlf/8.1/lib/ -lxl -lxlf90 -o test.exe \
      test.o
$ ./test.exe
 test

By mjhsieh at January 3, 2005 03:18 PM | Monthly Archives
Feedbacks

Then we can make an alias 'linker' as 'gcc -static-libgcc -L/opt/ibmcmp/xlf/8.1/lib/ -lxl -lxlf90' .....

mjhsieh
January 3, 2005 04:16 PM
#

Following the discussion of static linking (as described in the last post), the technical support of AbSoft joined the discussion. This technical support person explained why "-Wl,-static-libgcc" option doesn't work. That is because the XL Fortran driv...
Read more in IBM XLF Static Linking on Darwin (2) »

Mengjuei - Blog
January 4, 2005 06:14 PM

Post a comment