Jump to content
  • Advertisement
Sign in to follow this  
FreJa

linux environment variables doubt

This topic is 4486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I downloaded a fortran compiler (gfortran), and I wanted to make gfortran accessible everywhere so I edited .profile, adding: export PATH=$PATH:/path/to/gfortran/bin/ however, for gfortran to work it needs some libs, so I added: export PATH=$PATH:/path/to/gfortran/lib/ and it needed more stuff so I kept adding the folders to the file.... But there has to be a better way to do this... right? I tried something like: export PATH=$PATH:/path/to/gfortran/* but no luck... :( any help? huge thanks

Share this post


Link to post
Share on other sites
Advertisement
Probably the easiest thing to do, since it apparently requires a few dependencies, is to just copy the binaries and libraries into the /usr/local/bin and /usr/local/lib, respectively. I'm kind of confused why a binary package wouldn't do this in the first place. What format did you download it in?

Share this post


Link to post
Share on other sites
Quote:
Original post by bytecoder
Probably the easiest thing to do, since it apparently requires a few dependencies, is to just copy the binaries and libraries into the /usr/local/bin and /usr/local/lib, respectively. I'm kind of confused why a binary package wouldn't do this in the first place. What format did you download it in?


tar.bz2

Share this post


Link to post
Share on other sites
It's very likely that there's a package of gfortran for whatever distribution you're using. Use that. gfortran is part of the GCC, so every self-respecting distribution should have it.

As for the libraries: good luck. The GCC stuff has a rather greebly setup in that department. Adding libraries to the PATH variable won't help. You'll need to add the path to your /etc/ld.so.conf and run ldconfig afterwards. That might help.

Share this post


Link to post
Share on other sites
$PATH is the wrong variable for anything except lanching executable programs.

To pick up libraries at compile time, you will need to instruct the link phase on where to find them (this is the same for all and every compiler on every platform, it is not unique to GCC). For this, you use the command-line switch -L. You can add this to you Makefile (or Makefile.am and configure.ac, depending on your desired level of build sophistication).

To pick up libraries at run time, you need to either instruct runtime loader (ld.so, via /etc/ld.so.conf) where to find the libraries, if they're shared libraries (.so files) or just set the environment variable $LD_LIBRARY_PATH using the colon-separated syntax like you used for $PATH.

There is no better way to customize your configuration. Either you put everything in a place the toolchain and runtime loader look by default, or you have to instruct them explicitly using some mechanism such as Makefiles or environment variables. This is as true for GCC/gfortran as it is for Visual Studio on Windows.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!