LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-21-2008, 07:48 PM   #1
mkrems
Member
 
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?

FC=/opt/gcc-4.2.0/bin/gfortran
FFLAGS=-L/opt/acml2.5.0/gnu32/lib -lacml -Wl,-rpath,/opt/gcc-4.2.0/lib /usr/lib/libg2c.so.0


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

Rep: Reputation: 36
Quote:
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?

FC=/opt/gcc-4.2.0/bin/gfortran
FFLAGS=-L/opt/acml2.5.0/gnu32/lib -lacml -Wl,-rpath,/opt/gcc-4.2.0/lib /usr/lib/libg2c.so.0


Thanks!
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 libacml.so 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/libg2c.so.0" 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.

bgoodr
 
  


Reply


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 01:35 PM
g++ compiler error on iostream method .flags() sadarax Programming 2 04-12-2007 06:20 PM
How do you set compiler flags in SuSE? Thaidog SUSE / openSUSE 0 12-26-2006 11:04 PM
How to rebuild glibc with compiler flags designed for my system davidas Debian 1 04-20-2004 12:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:24 PM.

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