(RESOLVED) Zlib-1.2.12 fails to Make
Not sure what I am doing wrong. I have done this process from the .Tar file hundreds of times with 1.2.11. I have exported my terminal output in the attached file. Maybe someone can see what is going on
Why is it compiling with -DPIC instead of -fPIC?
Why is it compiling with
-DPICinstead of-fPIC?
I have no idea, I'm doing the same process from 1.2.11 and not changing any compile code.
I just tried reproducing this on my Mac and it passed both parameters, so for some reason it's not setting -fPICfor you. Can you share more info about your environment? Starting with Linux distribution, compiler version and configure.log?
see attached Untitled Document 1.txt
The only time it works is when I build it within the $HOME directory. If I try to install zlib-1.2.12 in a sub-folder it fails every time.
This is the code I'm using when it fails
export HOME=cd;pwd
mkdir $HOME/WRF
cd $HOME/WRF
mkdir Downloads
mkdir Libs
mkdir Libs/grib2
mkdir Libs/NETCDF
mkdir Libs/MPICH
cd Downloads wget -c https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz export DIR=$HOME/WRF/Libs export CC=gcc export CXX=g++ export FC=gfortran export F77=gfortran
cd $HOME/WRF/Downloads tar -xvzf v1.2.12.tar.gz cd zlib-1.2.12/ ./configure --prefix=$DIR/grib2 make
There's something about setting $CC and $CXX that trips up the configure script. It even causes it to use different optimisation flags. Can you unset these?
Alternatively, can you use Cmake instead? Replace the configure and make steps from your repro case with:
cmake -B build_release -S . -DCMAKE_INSTALL_PREFIX=$DIR/grib2
cmake --build build_release/
cmake --install build_release/
This doesn't fix the problem, but rather it's just a workaround.
It looks like this commit in the develop branch might resolve the issue too: https://github.com/madler/zlib/commit/05796d3d8d5546cf1b4dfe2cd72ab746afae505d
Going to leave this open for now, unless repo author wants to close it.
Two options to fix this issues:
-
Remove CC & CXX in configure file only. tar -xvzf v1.2.12.tar.gz cd zlib-1.2.12/ CC= CXX= ./configure --prefix=$DIR/grib2 make make install
-
Utilize cmake cmake -B build_release -S . -DCMAKE_INSTALL_PREFIX=$DIR/grib2 cmake --build build_release/ cmake --install build_release/
If https://github.com/madler/zlib/commit/05796d3d8d5546cf1b4dfe2cd72ab746afae505d doesn't fix this, then please request this be reopened.