library not found for -lgfortran

Sean Farley sean at macports.org
Tue Jul 8 17:46:20 PDT 2014


Mark Brethen writes:

> On Jul 8, 2014, at 6:31 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
>
>> 
>> On Jul 8, 2014, at 11:56 AM, Sean Farley <sean at macports.org> wrote:
>> 
>>> +gfortran
>> 
>> I get this error:
>> 
>> Error: Unable to open port: no such compiler: +gfortran
>> 
>> Mark
>> 
>> 
>> 
>> 
>
> Nevermind, can't use '+'.  I now have in the portfile
>
> compilers.choose        gfortran

gfortran is not a compiler type (e.g. cc, cxx, fc)

> compilers.setup         require_fortran
>
> if {![fortran_variant_isset]} {
>     default_variants-append +gcc48
> }
>
> configure.ldflags-append "-L${prefix}/lib/gcc48 -lgfortran"

The reason this is bad is because the compiler itself might link with
other libraries (e.g. -lm). This is why testing for this in the
configure stage is *required*.

> I did some digging in the freecad source and found this in 'CMakeLists';
>
> ################
> # Check Fortran#
> ################
> INCLUDE(CMakeDetermineFortranCompiler)
>
> This module can be found in /opt/local/share/cmake-3.0/Modules
>
> Not sure why it doesn't work. 

Just set gcc48 as before. The port group itself will take care of what
to call the variant (I forgot about that; sorry).

> The c++ compiler is used for linking.

Try setting 'configure.ld ${configure.fc}' in the pre-configure stage
and see if that works. It might not but is worth a shot.


More information about the macports-dev mailing list