Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-21-2008, 06:48 PM   #1
Registered: Jan 2008
Distribution: Ubuntu
Posts: 31

Rep: Reputation: 15
compiler flags

could someone please tell me (or at least make an educated guess) as to what all of these compiler flags do?

FFLAGS=-L/opt/acml2.5.0/gnu32/lib -lacml -Wl,-rpath,/opt/gcc-4.2.0/lib /usr/lib/

Old 04-22-2008, 12:53 AM   #2
Registered: Dec 2006
Location: Oregon
Distribution: RHEL[567] x86_64, Ubuntu 17.10 x86_64
Posts: 221

Rep: Reputation: 36
Originally Posted by mkrems View Post
could someone please tell me (or at least make an educated guess) as to what all of these compiler flags do?

FFLAGS=-L/opt/acml2.5.0/gnu32/lib -lacml -Wl,-rpath,/opt/gcc-4.2.0/lib /usr/lib/

Given the spaces in the FFLAGS variable, it looks like they were taken out of some Makefile. I don't have a clue about the FC variable, but the options in the FFLAGS look like what you might find when linking an executable with GCC. Hmmm, maybe that "gfortran" reference is for the Fortran frontend in the GCC compiler collection?

The "-L" specifies a directory from which to search for archive files or shared libraries when linking (the library path). That way, libraries can be specified in a shorthand form with the "-l" option. For "-lacml", certain files named in special ways are looked for in the library path. Here I believe libacml.a and/or are looked for in the library path, and if it can't find it, the link will fail.

The "-Wl" option means to feed the options directly to the linker (GNU ld). So, I believe "-Wl,-rpath,/opt/gcc-4.2.0/lib" means that the frontend passes the following directly to the linker command line: "-rpath /opt/gcc-4.2.0/lib".

IIRC, the "-rpath" linker option says to hardcode the "/opt/gcc-4.2.0/lib" path into the linked executable so that shared libraries can be found at runtime. Typically I think that is done for security reasons, but I never have liked that practice because then it locks the executables to only be workable in a root directory structure referenced by the rpath value, and that means they can't be moved around or expected to be executed from NFS mount points. Hmmm, I may have to take that back a bit: it might be the case that executables can have the "rpath" embedded in them, but that path can still be overridden by the users LD_LIBRARY_PATH environment variable. Don't know for sure. I think it better to just have a wrapper shell script that sets LD_LIBRARY_PATH before invoking the binary.

I don't know why "/usr/lib/" is tacked onto the end like that ... sounds suspicious to me. They probably should have expressed that like this: "-L/usr/lib -lg2c", but then again, maybe the ".0" parts of shared library names are ignored, and then they gave up and just hardcoded the path.

I would look at the Info manuals for GNU LD and GCC for more/better info.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
checking for C compiler default output... configure: error: C compiler cannot create fiorejm Linux - Software 6 11-12-2009 12:35 PM
g++ compiler error on iostream method .flags() sadarax Programming 2 04-12-2007 05:20 PM
How do you set compiler flags in SuSE? Thaidog SUSE / openSUSE 0 12-26-2006 10:04 PM
How to rebuild glibc with compiler flags designed for my system davidas Debian 1 04-19-2004 11:12 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration