Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
378 Views

MacOS X Catalina ifort linking problem

Jump to solution

Hi,

my problem is that the linker fails with:
ld: library not found for -llibfparser.a

when I use:

ifort -L/usr/local/lib/ -I/usr/local/include/fparser-v1.1/ -llibfparser.a test.f90

if I compile specifying the complete path all is OK

ifort -I/usr/local/include/fparser-v1.1/ /usr/local/lib/libfparser.a test.f90

this gives me the correct executable file.

There are two modules that are correctly seen through the -I switch what seems to not work is the -L switch.

Thanks

(sorry for my English)

0 Kudos

Accepted Solutions
Highlighted
Black Belt
378 Views

The convention used by the Linux linker ld for specifying library files is that the library file name is obtained by adding the prefix lib and adding the suffix .a to the ld argument prefixed by -l. Thus, -lmath is shorthand for libmath.a .

For more details of the -l command line option, see https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html#SEC3 .

View solution in original post

0 Kudos
9 Replies
Highlighted
Moderator
378 Views

try ordering -L and -l together like this:

ifort -I/usr/local/include/fparser-v1.1 -L/usr/local/lib -llibfparser.a test.f90

 

-L sets a library path and usually immediately preceeds the -l libraries.

 

Let me know if this works.

 

Ron

0 Kudos
Highlighted
Black Belt
379 Views

The convention used by the Linux linker ld for specifying library files is that the library file name is obtained by adding the prefix lib and adding the suffix .a to the ld argument prefixed by -l. Thus, -lmath is shorthand for libmath.a .

For more details of the -l command line option, see https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html#SEC3 .

View solution in original post

0 Kudos
Highlighted
Beginner
378 Views

Thanks Ron, but unfortunately nothing changes, I still have ld: library not found for -llibfparser.a.

 

0 Kudos
Highlighted
Beginner
378 Views

Thanks mecej4, it works!

ifort -L/usr/local/lib/ -I/usr/local/include/fparser-v1.1/ -lfparser test.f90

Eva

 

0 Kudos
Highlighted
Beginner
378 Views


Well, now from the terminal everything works but from xcode I continue to have the usual error.

In Targets --> Build Phases --> Link Binary With Libraries I have added libfparser.a and I also tried changing the name to fparser but the problem remains.

Obviously I set the directory for the .mod file and for the library:

Build Settings -->  Search Paths --> Header Search Paths --> /usr/local/include/function_parser/

Build Settings -->  Search Paths --> Library Search Paths --> /usr/local/lib/

Ideas?

Thanks Eva

 

0 Kudos
Highlighted
Black Belt
378 Views

I do not have a Macintosh and cannot help you with Xcode. I do not understand what you mean by "the usual error".

Do note that Xcode is deprecated with the current compiler release, and will be unsupported in a future release, according to https://software.intel.com/en-us/forums/intel-fortran-compiler/topic/844666 .

0 Kudos
Highlighted
Beginner
378 Views

"the usual error" is: 

ld: library not found for -llibfparser.a

Another question, if Xcode is deprecated what IDE is available for MacOS? Eclipse, Visual Studio Code ...

Thanks Eva

0 Kudos
Highlighted
Black Belt
378 Views

gragnani, eva wrote:

"the usual error" is: 

ld: library not found for -llibfparser.a

In the place where you entered "libfparser.a" in Xcode, enter "fparser". 

gragnani, eva wrote:
Another question, if Xcode is deprecated what IDE is available for MacOS? Eclipse, Visual Studio Code ...

Whatever is available for MacOS. Someone else who is a Macintosh user will have to help you on that.

0 Kudos
Highlighted
Beginner
378 Views

Thanks for the reply macej4, but the problem is that xcode has a dialog box for loading a file (that is the library) and doesn't allow you to specify a name.

0 Kudos