[RFC, Patch, gfortran] make -static-libgfortran work on darwin.

FX fxcoudert@gmail.com
Tue Jun 10 16:12:00 GMT 2008


> The solution is to name the libs differently (as is done elsewhere  
> in gcc).

Target libraries named differently? Which? libssp has three variants,  
which I don't really understand :)

$ ls libssp*
libssp.0.dylib      libssp.dylib        libssp_nonshared.a
libssp.a            libssp.la           libssp_nonshared.la

libgomp has shared and static libraries with the same name:

$ ls libgomp.*
libgomp.1.dylib libgomp.a       libgomp.dylib   libgomp.la       
libgomp.spec

Only libstdc++ has the naming patter you mention, as far as I can tell:

$ ls libstdc++*
libstdc++-static.a    libstdc++.6.0.4.dylib libstdc++.6.dylib

> I opted to call the static library "libgfortran_static" and to  
> leave the shared name unchanged.

I'd suggest "-static" instead of using an underscore, to follow  
libstdc++, but that's a minor point.


But more fundamentally, what is the reason that the linker can't be  
persuaded to link a static library instead of a shared one? The  
reason for that is that for darwin hosts, HAVE_LD_STATIC_DYNAMIC is  
not defined. The description for that macro is "Define if your linker  
supports -Bstatic/-Bdynamic option.". So, is there a way Darwin way  
to achieve the same goal (according to my googling, there isn't, but  
I might have missed something).

Otherwise, wrt your patch: doesn't it create three libraries:  
libgfortran.dylib, libgfortran.a and libgfortran_static.a? And, what  
happens now if you do a -static compilation, does it pick  
libgfortran_static automagically? Shouldn't we make that darwin- 
specific, in order to not change the situation on the majority of  
other systems that don't have a problem with the current situation?

Thanks,
FX

-- 
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/



More information about the Gcc mailing list