[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with Fortran shared libraries on OSX/Darwin

From: Tim Jenness
Subject: Re: Problem with Fortran shared libraries on OSX/Darwin
Date: Wed, 22 Sep 2004 17:42:27 -1000 (HST)

On Sun, 5 Sep 2004, Peter O'Gorman wrote:

> Seems that my original assumptions were totally wrong :( By the way if you 
> look closely at libtool's c++ archive_cmds on darwin, you'll see that the 
> -nostdlib bit is only used to attempt to do the same thing as 
> -single_module. When the lib itself is linked -nostdlib is not there.

The -nostdlib works but should only be used when building the library not 
when linking against it.

> There are a number of things wrong here, one of them is fink's g77 package 
> (maintianer CC'ed), because g77's libraries have common symbols, it is 
> impossible to make shared libraries on darwin that use functions from them. 

It is possible. I'm doing it all the time. The -nostdlib stops all those
nasty static g2c symbols entering the shared library. It's a one line fix.
This is not a problem so long as g77 is used to link programs using these
libraries, or libg2c is used explicitly when using gcc to link against
these libraries (which is the behaviour most people expect anyway, they
don't expect to be able to link C programs against fortran libraries
without specifying the fortran runtime).

> The other problem with the static test case seems to be libtool specific, 
> libtool should be adding the F77 libs when linking cprogram. I'll keep 
> hacking at this, it may require that I actually brush up on my fortran, last 
> used more than 15 years ago :(.

Our autoconf fortran guru has sorted that out for OSX. (copied to Norman).
We are preparing patches to significantly enhance fortran 
support in autoconf/automake.

> Jeffrey, I don't know if fortran will work when the libs are built 
> -fno-common, I think I heard somewhere that fortran requires common symbols??

The g77 man page explicitly says that -fno-common will be a mistake. 
Especially if your fortran uses common blocks...

Tim Jenness
JAC software

reply via email to

[Prev in Thread] Current Thread [Next in Thread]