Hello,
I am always confused about adding library path for ./configure
when compiling software under Linux Debian based OS. For example the README of the software tells
--with-boost=PATH specify directory for the boost header files
--with-mpi=PATH specify prefix directory for the installed MPI parallel computing library
--with-gtest=PATH specify prefix directory for the installed gtest library
--google sparsehash is also recommended
What I did is like:
./configure --with-boost=/usr/local/include --with-mpi=/usr/lib/openmpi
And sparsehash
is installed at /usr/include/google/sparsehash
Under directory
/usr/include/google
there are many header files including the subdirectory
/usr/include/google/sparsehash
which also has many header files.
My question is how to correctly set the PATHs for sparsehash:
/usr/include #which is one of the default searching PATHs and no need to assign explicitly??
/usr/include/google
or
/usr/include/google/sparsehash
What is the rule for those cutomized library PATHs setting on top of the environment variable LD_LIBRARY_PATH, especially it is not clear to use the headers or libraries?
Thanks a lot!
Depends what the code's including.
If they are doing #include <sparesehash-header.h> and you find it in /usr/include/sparsehash/sparsehash-header.h then you need to add that to the include path.
If they are doing #include <sparesehash/sparesehash-header.h> then you don't need to add it to the include path.
etc.
How to add it depends on the ./configure script as well. See ./configure --help.
Thanks Corona688!
The sparsehash part is clear now!
I came to openmpi
for which there are many folders containing the header mpi.h
The ./configure --help
tells to use the prefix directory of the library which seems quite vague to me.
/usr/lib/openmpi
/usr/lib64/openmpi
/usr/include/openmpi-x86_64
/usr/lib64/compat-openmpi-psm
/usr/lib64/compat-openmpi
/usr/lib64/compat-openmpi-psm
I take openmpi as blackbox for granted as I am not familiar with it at all. How do I choose the correct path for similar situation? Thanks again!
Take a look at what those folders are with ls -l. A lot of them are probably symlinks to the final location -- i.e. there could be more than one right answer. I would assume the most generic one, /usr/lib/openmpi, would be the one to stick with, but that's only a guess.
Thanks!
Most of them are symlinks.
You are right the path is /usr/lib/openmpi
where mpi.h
is located under the sub-folder /include
Thanks again!