library not found for -lgfortran

Mark Brethen mark.brethen at gmail.com
Tue Jul 8 18:36:45 PDT 2014


On Jul 8, 2014, at 8:21 PM, Mark Brethen <mark.brethen at gmail.com> wrote:

> 
> On Jul 8, 2014, at 7:46 PM, Sean Farley <sean at macports.org> wrote:
> 
>> Try setting 'configure.ld ${configure.fc}' in the pre-configure stage
>> and see if that works. It might not but is worth a shot.
> 
> :debug:configure Backtrace: invalid command name "configure.ld"
>    while executing
> "proc-pre-org.macports.configure-configure-2 org.macports.configure"
>    ("eval" body line 1)
>    invoked from within
> "eval $pre $targetname"
> :info:configure Warning: targets not executed for freecad: org.macports.build org.macports.configure
> :notice:configure Please see the log file for port freecad for details:
>    /opt/local/var/macports/logs/_Users_marbre_ports_cad_freecad/freecad/main.log
> 
> This workaround was mentioned in the freecad forum (homebrew):
> 
>    # Enable Fortran
>    libgfortran = `$FC --print-file-name libgfortran.a`.chomp
>    ENV.append 'LDFLAGS', "-L#{File.dirname libgfortran} -lgfortran"
>    inreplace "CMakeLists.txt", "if(CMAKE_COMPILER_IS_GNUCXX)\nENABLE_LANGUAGE(Fortran)\nendif(CMAKE_COMPILER_IS_GNUCXX)", 'ENABLE_LANGUAGE(Fortran)'
> 
> 
> Mark
> 
> 
> 
> 

The patch applies to this block in 'CMakeLists':

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    set(CMAKE_COMPILER_IS_CLANGXX TRUE)
endif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
    # Needed for salomesmesh
    ENABLE_LANGUAGE(Fortran)

    include(cMake/ConfigureChecks.cmake)
    configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
    add_definitions(-DHAVE_CONFIG_H)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-write-strings")
    INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
    # get linker errors as soon as possible and not at runtime e.g. for modules
    if(UNIX)
    #    SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
    endif(UNIX)
endif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)

Mark






More information about the macports-dev mailing list