Error when compiling parallel netCDF - compilation

I am trying to compile and install netCDF with a parallel build of HDF5.
First I installed an up to date zlib then I installed a serial HDF5 and a parallel HDF5 so that
/scratch/mycomputername/packages/ ... contains the HDF5 and zlib lib, include, bin folders.
/scratch/mycomputername/packages_parallel ... contains the parallel HDF5 and zlib lib, include and bin folders.
***ZLIB INSTALL:
./configure --prefix=/scratch/mycomputername/packages
make
make test
make install prefix=/scratch/mycomputername/packages
&
./configure --prefix=/scratch/mycomputername/packages_parallel
make
make test
make install prefix=/scratch/mycomputername/packages_parallel
***HDF5 INSTALL:
./configure --prefix=/scratch/mycomputername/packages --enable-fortran --with-zlib=/scratch/mycomputername/packages/include,/scratch/mycomputername/packages/lib
make
make check
make install prefix=/scratch/dione/packages
&
./configure --prefix=/scratch/mycomputername/packages_parallel --enable-parallel --enable-fortran --with-zlib=/scratch/mycomputername/packages_parallel/include,/scratch/mycomputername/packages_parallel/lib
make
make check
make install prefix=/scratch/mycomputername/packages_parallel
***Then, to install the serial netCDF I used
./configure --prefix=/scratch/mycomputername/packages CPPFLAGS=-I/scratch/mycomputername/packages/include LDFLAGS=-L/scratch/computername/packages/lib
make
make check
make install prefix=/scratch/mycomputername/packages
This worked successfully.
***However, when I tried to do the same for parallel netCDF I ran into errors.
I used
./configure --prefix=/scratch/mycomputername/packages_parallel CPPFLAGS=-I/scratch/mycomputername/packages_parallel/include LDFLAGS=-L/scratch/mycomputername/packages_parallel/lib
and I get the error:
checking hdf5.h usability ... no
checking hdf5.h presence ... no
checking for hdf5.h ... no
configure: error: Compiling a test with HDF5 failed. Either hdf5.h cannot be found, or config.log should be checked for other reason
I also tried
./configure --prefix=/scratch/computername/packages_parallel --with-hdf5=/scratch/mycomputername/packages_parallel/ --with-zlib=/scratch/mycomputername/packages_parallel/lib
but I get the error message quoted above.
Does anyone know why the parallel version might be having trouble finding the HDF5 library?

Make sure that for each package you compile and install add the necessary paths to your .profile or .bashrc file. For example, you need to add this after ZLIB installation (given that install directory is /usr/local):
if [ -z "${ZLIBDIR}" ]
then
ZLIBDIR="/usr/local"; export ZLIBDIR
else
ZLIBDIR="/usr/local:${ZLIBDIR}"; export ZLIBDIR
fi
For HDF5 I always use the following:
export HDF5_LIB_DIR="/usr/local/lib"
if [ -z "${LD_LIBRARY_PATH}" ]
then
LD_LIBRARY_PATH="/usr/local/lib"; export LD_LIBRARY_PATH
else
LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH
fi
if [ -z "${LIBDIR}" ]
then
LIBDIR="/usr/local/lib"; export LIBDIR
else
LIBDIR="/usr/local/lib:${LIBDIR}"; export LIBDIR
fi
export INCLUDE=/usr/local/lib:$Include
export PATH=/usr/local/bin:$PATH
export HDF5_LIB_DIR=/usr/local/lib
export HDF5DIR=/usr/local
export HDF5_DIR=/usr/local
export CPPFLAGS="-I$HDF5_DIR/include -I/usr/local/include"
export LDFLAGS="-L$HDF5_DIR/lib -L/usr/local/lib"
Finally, after installing NetCDF I use:
export NETCDFHOME=/usr/local
export NETCDF_PREFIX=/usr/local
export NETCDF_LIB=/usr/local/lib
export NETCDF4_ROOT=/usr/local
export NETCDF4_DIR=/usr/local
export NETCDF_INC=/usr/local/include
export PATH=/usr/local/bin:$PATH
Hope this helps. Cheers, Trond

From the netcdf README file, it is suggested to specify both include paths (CPPFLAGS) and linker flags (LDFLAGS, library paths and additional libraries).
I had the same trouble as you when I included pnetcdf, and adding the paths to the hdf5 include directory to CPPFLAGS, and the path to the hdf5 lib directory as well as the path to the mpi libraries and the addition of -lmpi to LDFLAGS.
Here's all of that together in one command:
CPPFLAGS="-I/usr/local/pnetcdf/include -I/usr/local/hdf5/include -I/usr/local/mpi/include" LDFLAGS="-L/usr/local/hdf5/lib -L/usr/local/pnetcdf/lib -L/usr/local/mpi/lib -lmpi" ./configure --prefix=/usr/local/netcdf --enable-netcdf4 --enable-pnetcdf

Related

configure script cannot find libxml2 on mac

when I execute
./configure
...
checking for libxml-2.0... no
configure: error: Library libxml2 not found, install library or build without (using --disable-xml).
I installed libxml2 with brew and checked a lot of articles, but nothing helped so far.
UPDATE
./configure --help
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
libxml2_CFLAGS
C compiler flags for libxml2, overriding pkg-config
libxml2_LIBS
linker flags for libxml2, overriding pkg-config
homebrew installs libxml2 as "keg only" which means it is not symlinked to the normal /usr/local/include and /usr/local/lib directories... which means nothing can find it without help. You can get all the above info by running:
brew info libxml2
If you run:
brew ls libxml2
it will tell you the full paths to all the files in that package.
If you also run:
./configure --help
it should tell you what environment variables you need to set in order to find libxml2 So, armed with these last two pieces of info, you should be able to work out what you need to set and how.
I note there is a pkg-config file listed for libxml2 by homebrew at:
/usr/local/Cellar/libxml2/2.9.10/lib/pkgconfig/libxml-2.0.pc
which is also available via a non-version-specific symlink as:
/usr/local/opt/libxml2/lib/pkgconfig/libxml-2.0.pc
so, if you have installed pkg-config with homebrew, like this:
brew install pkg-config
the solution may be just to add the path for that to your PKG_CONFIG_PATH with:
export PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
and then to rerun your configure script.
Note: It is only after installing pkg-config (via brew) that homebrew will display pkg-config related "caveats" for many affected packages e.g. libffi:
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
Unfortunately, however, this appears not to be the case for libxml2 for some reason. (Related homebrew issue: "libxml2 install path".)

How to specify a gcc path in pip command?

I am trying to install cupy 5.0.0. cupy5.0.0 needs gcc version not more than 7. My deafault gcc is gcc-9. I cannot use conda environment. Also i dont have sudo permission to change /usr/bin/gcc to point to gcc-7. Is there any way to pass gcc path to pip command?
You can use CXX, CC and LD environment variables to specify executable names or full paths to C++ and C compilers, and the linker.
Specify the variables only for one command:
CXX=g++-7 CC=gcc-7 LD=g++-7 pip install ...
Alternatively:
export CXX=g++-7
export CC=gcc-7
export LD=g++-7
pip install ...
You can also pass extra compiler and linker options in CXXFLAGS, CFLAGS, LDFLAGS. Preprocessor options (e.g. include directories) go in CPPFLAGS.

proper linking of PATH and LD_LIBRARY_PATH after gcc-5.2 install in own directory

I just compiled and installed gcc-5.2. I did not have root access so I installed it in my own directory. I forget at the end what I am meant to link through LD_LIBRARY_PATH and PATH
setenv LD_LIBRARY_PATH /bigbang/data/username/lib/gcc-5.2/lib
setenv LD_LIBRARY_PATH /bigbang/data/username/lib/gcc-5.2/lib64:$LD_LIBRARY_PATH
setenv PATH /bigbang/data/username/lib/gcc-5.2/bin:$PATH
When I simply run ./gcc I get the following error:
gcc: error while loading shared libraries: libiconv.so.2:
Is there something wrong with how I am linking the lib paths? Thanks in advance. Also, I simple did configure with ./configure --prefix=/bigbang/data/username/lib/gcc-5.2/, what is the recommended configuration flags I should use? I'm aiming to use graph_tool.
If you have successfully installed GCC with some non-standard prefix
/my/gcc/prefix then you can use that installation without any
special preparations by passing:
-B/my/gcc/prefix
whenever you call the frontend (gcc, g++, etc). You just call the frontend with the usual command:
gcc -B/my/gcc/prefix ...
This assumes some version of GCC is installed standardly.
See 3.15 Options for Directory Search

gcc unable to find shared library libisl.so

I installed gcc version 5.1 locally on a cluster having OS as CentOS where I dont have root access (so i cant use any commands like 'sudo'). (The global gcc version installed is 4.4). I also modified the path variable to include the path to my local version at the beginning of the path variable. Before, when I was trying to install boost using the global version, it worked fine. But now, when I try to install boost, it shows the following error:
/users/home/head/cmp/soft/sft/gcc/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/cc1: error while loading shared libraries: libisl.so.10: cannot open shared object file: No such file or directory
Any ideas on how to fix this will be highly appreciated.
Follow the instructions at https://gcc.gnu.org/wiki/InstallingGCC
Specifically, don't install ISL manually in some non-standard path, because GCC needs to find its shared libraries at run-time.
The simplest solution is to use the download_prerequisites script to add the GMP, MPFR, MPC and ISL source code to the GCC source tree, which will cause GCC to build them for you automatically, and link to them statically.
I have the same issue. I solved it as follows:
Download the source code of isl available here
Unzip and install: ./configure && make && make install
cp /usr/local/lib/libisl* /usr/lib
Note: a symlink also works:
$ cd /usr/lib
$ ln -s /usr/local/lib/libisl.so.10 libisl.so.10
You can do the same in Debian distros:
apt-get install libisl-dev
Adjust the references of shared libs:
$ cp /usr/local/lib/libisl* /usr/lib
Note: a symlink also works:
$ cd /usr/lib
$ ln -s /usr/local/lib/libisl.so.10 libisl.so.10

configure: error: leptonica library missing (when building tesseract-ocr-3.01 on MinGW)

When running configure it fails with
checking for leptonica... yes
checking for pixCreate in -llept... no
configure: error: leptonica library missing
But I have leptonica 1.69 built (downloaded source and ran ./configure && make install)
Edit
I think configure: error: leptonica library missing is a bit misleading, please note that it first says checking for leptonica... yes, and then fails on checking for pixCreate in -llept... no. So maybe the problem is not that the library is missing, but something else.
I finally managed to make it compile, after reading this and this thread. The proper steps for were:
./autogen.sh
export LIBLEPT_HEADERSDIR=/local/include
./configure --with-extra-libraries=/local/lib
make install
for leptonica 1.69, lib renamed to .libs, so, parameters are
export LIBLEPT_HEADERSDIR=<your_path>/leptonica-1.69/src
./autogen.sh
./configure --prefix= --with-extra-libraries=<your_path>/leptonica-1.69/src/.libs
and so on
Maybe this could solve the issue:
export LIBLEPT_HEADERSDIR=/usr-or-other/local/include
I am working on redhat linux 7.2 . None of the solution worked for me I was getting following errors in config.log. Package lept was not found in the pkg-config search path.
Perhaps you should add the directory containing `lept.pc'
to the PKG_CONFIG_PATH environment variable PKG_CONFIG_PATH
configure script uses pkg-config utility to check for packages . It was not able to find lept package ( although i had installed leptonica seperately ) By setting PKG_CONFIG_PATH pointing to the directory where lept.pc is present , i was able to resolve the issue . export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
The FAQ addresses this issue and worked for me with tesseract 3.02.02 on Mac OSX 10.6.8.
Apart from the Leptonica library, png, jpeg, tiff libraries had to passed to the configure script with CXX and CPP flags.
To run configure as non-root -
1. LIBLEPT_HEADERSDIR=; export LIBLEPT_HEADERSDIR;
2. CXXFLAGS="-ltiff -lpng -ljpeg" CPPFLAGS="-ltiff -lpng -ljpeg" ./configure --prefix= --with-extra-libraries=
In my case, this issue was caused by a missing compiler. Searching config.log revealed the following:
./configure:17287: g++ -o conftest -I/Usr/local/include/leptonica -L/usr/local/lib conftest.cpp -llept >&5
./configure: line 2040: g++ command not found
Running apt-get install g++ solved the problem. There is an issue in the tesseract issue tracker about this.
In my case (for Ubuntu/Debian) I downloaded the latest leptonica version and the error was not fixed.
To fix it I removed the package "leptonica-dev" with sudo apt-get remove libleptonica-dev and then tesseract found the leptonica version installed from the source code.
Hope it helps!
The answer is going to be slightly different for everyone, depending on the state of your system.
At a high level, the pkg-config software needs to know that leptonica is installed. It searches paths for a .pc file that has the definition for the leptonica package. That file will be in different locations for different people.
You can find it using the Linux locate utility at the command line. locate lept.pc. (If you've done some recent installing/uninstalling, you may need to refresh the locate utilities database with the command updatedb.)
Whichever directory locate finds the file in, export PKG_CONFIG_PATH as that directory (export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig for example).
Then you can continue your configure/build.
i had a similar problem with trying to compile from source, but did not experience it with
apt-get to install tesseract
sudo apt-get install tesseract-ocr
export LIBLEPT_HEADERSDIR=$dir/letonica168/include
./autogen.sh
./configure --prefix=$anotherdir --with-extra-libraries=/$dir/letonica168/lib
make
make install

Resources