bug-libtool
[Top][All Lists]
Advanced

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

Re: Problem with Fortran shared libraries on OSX/Darwin


From: Peter O'Gorman
Subject: Re: Problem with Fortran shared libraries on OSX/Darwin
Date: Sun, 05 Sep 2004 20:41:57 +0900
User-agent: Mozilla Thunderbird 0.7.3 (Macintosh/20040803)

Tim Jenness wrote:

On Fri, 3 Sep 2004, Peter O'Gorman wrote:


I don't believe that you'll get working executables this way.



Except it all works fine. I'm not building executables with that patch,
I'm just building the libraries. Executables include their own libgcc.a
during the link phase. With the above patch I can build shared libraries
that can link into exectuables (this is with 3 million lines of fortran so
it's not a small project). Saying that, I'm happy to find out that I was
fluking a fix that wasn't correct.

I note that g++ seems to have the -nostdlib option for darwin though (that's what gave me the idea).


The problem is actually the -single_module flag. It is needed to make c++ static constructors work better on darwin up to 7.x. The reason it fails on g77 (and on fsf gcc actually) is that Apple's gcc uses __private_extern__ symbols in libgcc and libstdc++. __private_extern__ symbols are magic, they are available in the static archive to resolve undefined symbols until they are linked whereupon they turn into local symbols. Fink's f77 libs don't have that magic.



Thanks.


Anyway, I'll fix the darwin commands to work with fsf gcc before libtool-2.0. Thanks for the report, I keep forgetting about this bug.



That's great. I can live with my hack and I await libtool 2.0. (I'll keep an eye on the dev track for your patch).

I modified libtool's f77demo test case <http://www.pogma.com/misc/f77demo-1.0.tar.gz> and it now fails both static and shared :(

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.

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. 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 :(.

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??

Peter

--
Peter O'Gorman - http://www.pogma.com




reply via email to

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