Home > emacs, Fortran, Linux > eMarch 4: Compilation environment variable

eMarch 4: Compilation environment variable

I sometime use improved library like mkl, in my code, the later need to have their path added to the LD_LIBRARY_PATH, in order to be accessed during compilation. Eventually, this may prevent the very handful M-x compile command to work with emacs. The fix I found on stackoverflow

(let ((path (shell-command-to-string ". ~/.bashrc; echo -n $PATH")))
(setenv "PATH" path)
 (setq exec-path
 (append
 (split-string-and-unquote path ":")
 exec-path)))
 (let ((ld_library_path (shell-command-to-string ". ~/.bashrc; echo -n $LD_LIBRARY_PATH")))
 (setenv "LD_LIBRARY_PATH" ld_library_path)
 (setq exec-path
 (append
 (split-string-and-unquote ld_library_path ":")
 exec-path)))
Advertisements
Categories: emacs, Fortran, Linux
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: