Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static linking with XLF



Since the Mac OS X linker searchs dynamic libraries first, e.g., libx.dylib first and then libx.a, dynamic libraries are used by default. In order to link the archive libraries, one would need to make sure dynamic libraries are not used by the linker in resolving symbols.

There can be many ways to achieve this.  One way to accomplish this is:

$ ln -sf /opt/ibmcmp/xlf/8.1/lib/libxlf90.a /opt/ibmcmp/xlf/8.1/lib/libxlf90_s.a

$ ln -sf /opt/ibmcmp/xlf/8.1/lib/libxlf90_r.a /opt/ibmcmp/xlf/8.1/lib/libxlf90_r_s.a

$ ln -sf /opt/ibmcmp/xlf/8.1/lib/libxlfmath.a /opt/ibmcmp/xlf/8.1/lib/libxlfmath_s.a

$ ln -sf /opt/ibmcmp/xlsmp/1.4/lib/libxlsmp.a /opt/ibmcmp/xlsmp/1.4/lib/libxlsmp_s.a

$ ln -sf /opt/ibmcmp/xlsmp/1.4/lib/libxlomp_ser.a /opt/ibmcmp/xlsmp/1.4/lib/libxlomp_ser_s.a

Now you need to modify the XL Fortran configuration file so that the symbolic links to the archive libraries are used in place of the dynamic libraries. The configuration file should be in the file /etc/opt/ibmcmp/xlf/8.1/xlf.cfg if the compiler was installed in the default installation location. In the configuration file, add the following text just before the "Common definitions" section:

* Fortran 90 compiler using archive libraries
xlf90_s:  use        = DEFLT
          libraries  = -lxlf90_s,-lxlopt,-lxlomp_ser_s,-lxl,-lxlfmath_s
          gcc_libs     = -lm,-lc,-lgcc,-lSystem
          options    = -qxlf90=noautodealloc:nosignedzero,-qfree=f90

Therefore, libxlf90_s, libxlomp_ser, libxlfmath_s will be used. You can do the same to other commands accordingly. Specifically, copy the stanzas for the xlf commands that are being used and add _s to the name of the stanza, and to each of xlf90, xlf90_r, xlfmath, xlsmp, and xlomp_ser that appears in the stanza.

Please see this section in the Users Guide which describes the configuration file if you need assistance with this:
http://publib.boulder.ibm.com/infocenter/macxhelp/topic/ com.ibm.xlf81m.doc/pgs/ug21.htm#HDRHU00457


When compile/link an application, use the following command:

$ xlf90 -F:xlf90_s test.f

The -F option tells the compiler to use the specified stanza in the configuration file instead of the default stanza for the command specified.

The resulting executable does not have any dependency on XLF dynamic run-time libraries.

-------------
Scott Campbell
Absoft Technical Support
email@hidden
http://www.absoft.com/support.html




----- Original Message ----- From: "Craig Hunter" <email@hidden>
To: <email@hidden>
Sent: Monday, January 03, 2005 1:49 PM
Subject: Static linking with XLF




Has anyone come up with a good way to force static linking with IBM XLF?

I

remember that we can hide one of XLF's library directories to get a

similar

effect, but I wonder if there's a more graceful way to do it.  In addition
to being a hassle for software distribution, XLF's dynamic linking is even
causing us headaches when transferring executables among machines with
slightly different revisions of XLF.  I still can't believe they don't

offer

a compiler flag for static linking!

Thanks,
Craig

--
Dr. Craig Hunter
NASA Langley Research Center
AAAC/Configuration Aerodynamics Branch
email@hidden  (new!!)
(757) 864-3020
(Dual G4 - OS X)


_______________________________________________ Do not post admin requests to the list. They will be ignored. Fortran-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/fortran-dev/email@hidden

This email sent to email@hidden







!DSPAM:41dacda2157741199417861!

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Fortran-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/fortran-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.