Project

General

Profile

configure: error: C preprocessor ":" fails sanity check

Added by Ahmed Shaaban about 1 year ago

All,

I am working on installing cdo-2.1.1 on fedora 35 and gcc version 11.3.1 20220421 (Red Hat 11.3.1-3) (GCC).
Libs4cdo-0.0.11 has been installed successfully. Yet, I get the following error with cdo-2.1.1:

configure: error: C preprocessor ":" fails sanity check

when trying
./configure
or
./configure --with-szlib=/usr/local/ --with-hdf5=/usr/local/ --with-netcdf=/usr/local/ --with-proj=/usr/local/

I attached config.log
any ideas.
Thanks


Replies (13)

RE: configure: error: C preprocessor ":" fails sanity check - Added by Estanislao Gavilan about 1 year ago

Hi Ahmed,

Upon looking the config.log, I spot some errors.

conftest.c:29:2: error: #error "OpenMP not supported"

I think Ralph once said that cdo was not supported by openmpi. Ralph or Uwe will know for sure.

conftest.cpp:25:10: fatal error: ac_nonexistent.h: No such file or directory
25 | #include <ac_nonexistent.h>

I am not sure about this error, we need a proficient user to understand this one.

Now, I noticed you are compiling with proj. Many users have reported issues with this library. Devs recommend to build without proj.

Finally, if you are still having problems, I recommend you to install cdo via anaconda
conda install cdo

regards

Estanislao

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Hi Estanislao,

Thanks, I found that compiling with or without proj yields the same errors. Using anaconda will be, for sure, my last shot.

In the config.log, I found a few errors at the beginning that indicate that the compiler can not understand compiling options or flags

105 :gcc: error: unrecognized command-line option '-V'
110: gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?

Is this is normal?
Thanks

RE: configure: error: C preprocessor ":" fails sanity check - Added by Estanislao Gavilan about 1 year ago

Hi Ahmed,

I am not sure if that is the real problem. Can you also specify your flags? Lets see if someone can find the problem.

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Hi Estanislao,

I am not sure if I get your point. I did not tune any flags, I just used configure without any modifications to the flag.

I just get surprised when I found that GCC is not able to recognize some options like -V and -qversion. Actually, those options seem to be obsolete.

Thanks

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Hello,

Finally, I overcame the following error:

configure : error : C++ preprocessor "/lbi/cpp" fails sanity check

by installing gcc-c++ using yum install gcc-c++
as illustrated here https://askubuntu.com/questions/509663/c-preprocessor-lib-cpp-fails-sanity-check

Thanks

RE: configure: error: C preprocessor ":" fails sanity check - Added by Estanislao Gavilan about 1 year ago

thats fantastic. I do not understad well the solution though. Your original config file was able to find the compiler g++ for c++.Probably there is something that I am missing.

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Thanks,

Actually, I spent a few days working on installing CDO on Oracle Linux and Fedora workstations, and I just wanted to share my experience. Not sure if this is the right place to do that.

1- To avoid the following errors :
configure: error: C compiler cannot create executables
and/or
configure: error : C++ preprocessor "/lbi/cpp" fails sanity check

Install gcc-c++ using yum as :
yum install gcc-c++

Also, I found that m4 is also required later in the installation.
yum install m4

2- Also, I found that I need to add the path of the build directory to the LD_LIBRARY_PATH to my .bashrc (or in the terminal)
export LD_LIBRARY_PATH=/home/homename/libs4cdo-0.0.11/build/lib/:$LD_LIBRARY_PATH

3- Zlib is not installed by default in the libs4cdo, yet it is not installed by default in the Fedora workstation/ Oracle Linux
cd zlib-1.2.3/
./configure --prefix=/home/ahmed/libs4cdo-0.0.11/build/
make
make install

Nevertheless, I did not find zlib in the list of libraries used by h5d or ncdump when I run ldd h5d or ldd ncdump.

I hope those steps are useful.
I wonder if users using different Linux distributions can share their experiences installing CDO.
Thanks

RE: configure: error: C preprocessor ":" fails sanity check - Added by Estanislao Gavilan about 1 year ago

Hi Ahmed,

I think I have found out why your compile g++ was failing. cdo needs C++17 and C11. So you needed to adjust the g++ flags to -std=17. Anyways, I hope your cdo is running smoothly now.

Kind regards,

Estanislao

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Thanks,
I succeeded in installing CDO, and I will begin to try and use it in the next few days. I hope everything goes smoothly.
Thanks for your patient

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ralf Mueller about 1 year ago

hi Ahmed!

just wanted to mention: libs4cdo-0.0.11 is very out-dated. I created this package years ago for cross-compiling older versions of CDO. Current linux distros ship much more recent versions of all the libraries.

cheers
ralf

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Hi Ralf,

Thanks for the note.
Since the current lib4cdo is old, and in case there are no plans (I am not sure?) to update the lib4cdo package, I wonder if it is possible to provide a simple script that helps the community install the packages needed by the CDO.
The script may contain configure, make, make install commands with the best flags/options needed for the CDO. This also could save a lot of time in searching for the best combinations of packages (NetCDF, HDF, zlip, ...) that may work together and best with the CDO.

The Makefile created with the lib4cdo is a really awesome and creative idea. Still, I am unsure if maintaining and updating this Makefile is time-consuming compared to a simple script with the configure/make options.
Do you think providing a simple configuration script for only one Linux distro could encourage the community to tune it based on their Linux distro if needed, which ultimately help too many users installtalling the new and continuously updating libcdo?

Not sure if this makes sense.
Thanks

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ralf Mueller about 1 year ago

hey Ahmed!

The problem is the large number of dependencies of CDO. This made the maintenance of libs4cdo very time consuming. This task is better suited for a real package manager like conda or spack. That's why I stopped putting effort into it. Many distros come with packages for netcdf, hdf5 or the other libraries anyway.

My current recommendation is:

  • (linux) use conda if you want to have an easy fully featured installation without lengthy compilation
  • (linux) use spack if you want full control of the build process
  • (windows) use the windows linux subsystem for the easiest installation (check this talk)
  • (windows) use cygwin this for a more recent version of CDO

Several Linux distros already provide pre-built CDO packages. see Linux_Platform for more. A general script is not necessary IMO - this problems is already solved by other people.

RE: configure: error: C preprocessor ":" fails sanity check - Added by Ahmed Shaaban about 1 year ago

Hi Ralf,

Thanks for the tips, I tried to use conda and spack to install CDO, yet I failed. Conda and spack are pretty good package managers, but in case of failuar to install the package, the raised errors are challenging to fix.
I did not know that SUSE and Fedora now provide CDO. I will try that.

Thanks

    (1-13/13)