R install packages looking in wrong place

Viewed 97

Trying to install FFTW and feel like I have been going in circles. I need it for an R package (poisbinom) and I think I have it installed right (I'm on a cluster and don't have sudo privileges. I followed the instructions here: http://micro.stanford.edu/wiki/Install_FFTW3 )

The problem I'm running into is this:

g++ -std=gnu++14 -shared -L/usr/local/lib64 -o poisbinom.so RcppExports.o init.o   poisbinom.o -lfftw3 -lm  
/usr/bin/ld: cannot find -lfftw3  
collect2: error: ld returned 1 exit status  

I have a feeling it is because I did not install FFTW under usr/local/lib64, its under $HOME/usr/. My R install is under $HOME/R/lib64/R. I am not sure what variable to change to make it look in the right place, as I cant change this g++ call as it is part of an R install.packages call. I've been going in circles with this for two days now. Let me know if theres anything else I can provide to help.

I already ran install.packages("fftw") and that was successful and used LFFTW3 without issue because it looked in the right place. I mostly just need to know if I can point this gcc call to the right folder with an environment variable or something.

2 Answers

In case you have pkg-config on your system and your installation produced the required configuration files (e.g. fftw3.pc): Define the environment variable PKG_CONFIG_PATH to (also) include the directory with these configuration files for FFTW3.

Otherwise, you can define FFTW_CFLAGS and FFTW_LIBS:

fftw$ ./configure --help
[...]
  FFTW_CFLAGS C compiler flags for FFTW, overriding pkg-config  
  FFTW_LIBS   linker flags for FFTW, overriding pkg-config
[...]

I ended up having to add the variables to my bashrc file:

export PATH=$HOME/fftw_folder/bin:$PATH  
export LD_LIBRARY_PATH=$HOME/fftw_folder/lib:$LD_LIBRARY_PATH  
export LIBRARY_PATH=$HOME/fftw_folder/lib:$LIBRARY_PATH  
export PKG_CONFIG_PATH=$HOME/_folder/lib/pkgconfig:$PKG_CONFIG_PATH  

As laid out here: http://hpc.loni.org/docs/faq/installation-details.php And now things seem to be moving forward smoothly. Thanks for the help!

Related