library not found for -lgfortran

Mark Brethen mark.brethen at gmail.com
Mon Jul 7 21:28:34 PDT 2014


On Jul 7, 2014, at 9:25 PM, Ryan Schmidt <ryandesign at macports.org> wrote:

> 
> On Jul 7, 2014, at 9:16 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
> 
>> 
>> On Jul 7, 2014, at 8:42 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
>> 
>>> 
>>> On Jul 7, 2014, at 6:37 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
>>> 
>>>> 
>>>> On Jul 7, 2014, at 6:18 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
>>>> 
>>>>> FreeCAD port development fails to build: ld: library not found for -lgfortran.
>>>>> 
>>>>> 
>>>>> :info:build /usr/bin/clang++  -pipe -Os -arch x86_64 -stdlib=libc++  -Wno-deprecated -Wno-write-strings -D_OCC64 -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -dynamiclib -Wl,-headerpad_max_install_names  -L/opt/local/lib -Wl,-headerpad_max_install_names -o ../../../lib/libStdMeshers.so -install_name /opt/local/lib/libStdMeshers.so CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Arithmetic1D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_AutomaticLength.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_CompositeSegment_1D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Deflection1D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Distribution.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_FaceSide.cpp.o CMakeFiles/StdMeshers.dir/src/StdMes
>>>> hers/StdMeshers_Hexa_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_LayerDistribution.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_LengthFromEdges.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_LocalLength.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_MaxElementArea.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_MaxElementVolume.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_MaxLength.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_MEFISTO_2D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_NotConformAllowed.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_NumberOfLayers.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_NumberOfSegments.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Penta_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Prism_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Projection_1D.cpp.o CMakeFiles/StdMeshers.di
>>>> r/src/StdMeshers/StdMeshers_Projection_2D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Projection_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_ProjectionSource1D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_ProjectionSource2D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_ProjectionSource3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_ProjectionUtils.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Propagation.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Quadrangle_2D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_QuadranglePreference.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_QuadraticMesh.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_RadialPrism_3D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Regular_1D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_S
>>>> egmentAroundVertex_0D.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_SegmentLengthAroundVertex.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_StartEndLength.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_TrianglePreference.cpp.o CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_UseExisting_1D2D.cpp.o ../../../lib/libSMESH.so /opt/local/lib/libTKFillet.8.0.0.dylib /opt/local/lib/libTKMesh.8.0.0.dylib /opt/local/lib/libTKernel.8.0.0.dylib /opt/local/lib/libTKG2d.8.0.0.dylib /opt/local/lib/libTKG3d.8.0.0.dylib /opt/local/lib/libTKMath.8.0.0.dylib /opt/local/lib/libTKIGES.8.0.0.dylib /opt/local/lib/libTKSTL.8.0.0.dylib /opt/local/lib/libTKShHealing.8.0.0.dylib /opt/local/lib/libTKXSBase.8.0.0.dylib /opt/local/lib/libTKBool.8.0.0.dylib /opt/local/lib/libTKBO.8.0.0.dylib /opt/local/lib/libTKBRep.8.0.0.dylib /opt/local/lib/libTKTopAlgo.8.0.0.dylib /opt/local/lib/libTKGeomAlgo.8.0.0.dylib /opt/local/lib/libTKGeomBase.8.0.0.dylib /opt/local/lib/libT
>>>> KOffset.8.0.0.dylib /opt/local/lib/libTKPrim.8.0.0.dylib /opt/local/lib/libTKSTEP.8.0.0.dylib /opt/local/lib/libTKSTEPBase.8.0.0.dylib /opt/local/lib/libTKSTEPAttr.8.0.0.dylib /opt/local/lib/libTKHLR.8.0.0.dylib /opt/local/lib/libTKFeat.8.0.0.dylib /opt/local/lib/libTKCAF.8.0.0.dylib /opt/local/lib/libTKXCAF.8.0.0.dylib /opt/local/lib/libTKLCAF.8.0.0.dylib /opt/local/lib/libTKXDESTEP.8.0.0.dylib /opt/local/lib/libTKXDEIGES.8.0.0.dylib /opt/local/lib/libTKMeshVS.8.0.0.dylib /opt/local/lib/libTKAdvTools.8.0.0.dylib ../../../lib/libMEFISTO2.so ../../../lib/libDriverSTL.so ../../../lib/libDriverDAT.so ../../../lib/libDriverUNV.so ../../../lib/libSMESHDS.so ../../../lib/libSMDS.so ../../../lib/libDriver.so /opt/local/lib/libTKSTL.8.0.0.dylib /opt/local/lib/libTKFeat.8.0.0.dylib /opt/local/lib/libTKXDESTEP.8.0.0.dylib /opt/local/lib/libTKSTEP.8.0.0.dylib /opt/local/lib/libTKSTEP209.8.0.0.dylib /opt/local/lib/libTKSTEPAttr.8.0.0.dylib /opt/local/lib/libTKSTEPBase.8.0.0.dylib /opt/l
>>>> ocal/lib/libTKXDEIGES.8.0.0.dylib /opt/local/lib/libTKIGES.8.0.0.dylib /opt/local/lib/libTKOffset.8.0.0.dylib /opt/local/lib/libTKFillet.8.0.0.dylib /opt/local/lib/libTKBool.8.0.0.dylib /opt/local/lib/libTKPrim.8.0.0.dylib /opt/local/lib/libTKXSBase.8.0.0.dylib /opt/local/lib/libTKXCAF.8.0.0.dylib /opt/local/lib/libTKCAF.8.0.0.dylib /opt/local/lib/libTKBO.8.0.0.dylib /opt/local/lib/libTKLCAF.8.0.0.dylib /opt/local/lib/libTKCDF.8.0.0.dylib /opt/local/lib/libTKMeshVS.8.0.0.dylib /opt/local/lib/libTKV3d.8.0.0.dylib /opt/local/lib/libTKMesh.8.0.0.dylib /opt/local/lib/libtbb.dylib /opt/local/lib/libTKHLR.8.0.0.dylib /opt/local/lib/libTKService.8.0.0.dylib /opt/local/lib/libTKShHealing.8.0.0.dylib /opt/local/lib/libTKTopAlgo.8.0.0.dylib /opt/local/lib/libTKGeomAlgo.8.0.0.dylib /opt/local/lib/libTKBRep.8.0.0.dylib /opt/local/lib/libTKGeomBase.8.0.0.dylib /opt/local/lib/libTKG3d.8.0.0.dylib /opt/local/lib/libTKG2d.8.0.0.dylib /opt/local/lib/libTKMath.8.0.0.dylib -framework Cocoa /op
>>>> t/local/lib/libfreeimage.dylib /opt/local/lib/libfreetype.dylib /opt/local/lib/libTKAdvTools.8.0.0.dylib /opt/local/lib/libTKernel.8.0.0.dylib -lm /opt/local/lib/libtbbmalloc.dylib -lgfortran -Wl,-rpath,/opt/local/lib 
>>>>> :info:build ld: library not found for -lgfortran
>>>>> :info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>> :info:build make[2]: *** [lib/libStdMeshers.so] Error 1
>>>>> :info:build make[2]: Leaving directory `/opt/local/var/macports/build/_Users_marbre_ports_cad_freecad/freecad/work/freecad-0.14.3692'
>>>>> :info:build make[1]: *** [src/3rdParty/salomesmesh/CMakeFiles/StdMeshers.dir/all] Error 2
>>>>> :info:build make[1]: *** Waiting for unfinished jobs....
>>>>> 
>>>>> Do I need to install gfortran?
>>>>> 
>>>>> Mark
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> CMakeCache output:
>>>> 
>>>> //Fortran compiler.
>>>> CMAKE_Fortran_COMPILER:FILEPATH=/opt/local/bin/gfortran-mp-4.8
>>>> 
>>>> //Flags for Fortran compiler.
>>>> CMAKE_Fortran_FLAGS:STRING='-pipe -Os '
>>>> 
>>>> //Flags used by the compiler during debug builds.
>>>> CMAKE_Fortran_FLAGS_DEBUG:STRING=-g
>>>> 
>>>> //Flags used by the compiler during release builds for minimum
>>>> // size.
>>>> CMAKE_Fortran_FLAGS_MINSIZEREL:STRING=-Os
>>>> 
>>>> //Flags used by the compiler during release builds.
>>>> CMAKE_Fortran_FLAGS_RELEASE:STRING=-O3
>>>> 
>>>> //Flags used by the compiler during release builds with debug info.
>>>> CMAKE_Fortran_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
>>>> 
>>>> It found gfortran; I wonder why it fails to link?
>>> 
>>> libgfortran.dylib is located in /opt/local/lib/gcc48 but I don't see "-L/opt/local/lib/gcc48" in that compile line.
>>> 
>> 
>> Can I set it? i.e build.env-append 'LDFLAGS', "-L${prefix}/lib/gcc48/libgfortran.dylib -lgfortran"
> 
> Each build system is different. I don't know how freecad's build system expects additional flags to be specified.
> 
> Ideally, the build system would not require you to specify that. The developers may be able to fix it by including the output of "$CMAKE_Fortran_COMPILER -print-file-name=libgfortran.dylib" at the right place.
> 
> 

I was told that until a patch is submitted, I can just add -L/opt/local/lib/gcc48 to the LDFLAGS environment variable. So I put this in the portfile:

configure.ldflags-append "-L${prefix}/lib/gcc48"

I'm thinking that "gcc48" should be replaced by a variable, but what do I use?



Mark






More information about the macports-dev mailing list