- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Ron, but unfortunately nothing changes, I still have ld: library not found for -llibfparser.a.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks mecej4, it works!
ifort -L/usr/local/lib/ -I/usr/local/include/fparser-v1.1/ -lfparser test.f90
Eva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page