zlib icon indicating copy to clipboard operation
zlib copied to clipboard

(RESOLVED) Zlib-1.2.12 fails to Make

Open ghost opened this issue 3 years ago • 7 comments

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

zlib-1.2.12 error.txt ?

ghost avatar May 02 '22 11:05 ghost

Why is it compiling with -DPIC instead of -fPIC?

Mr-Clam avatar May 02 '22 17:05 Mr-Clam

Why is it compiling with -DPIC instead of -fPIC?

I have no idea, I'm doing the same process from 1.2.11 and not changing any compile code.

ghost avatar May 02 '22 18:05 ghost

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?

Mr-Clam avatar May 03 '22 07:05 Mr-Clam

see attached Untitled Document 1.txt

ghost avatar May 03 '22 18:05 ghost

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

ghost avatar May 04 '22 22:05 ghost

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

Mr-Clam avatar May 05 '22 08:05 Mr-Clam

Going to leave this open for now, unless repo author wants to close it.

Two options to fix this issues:

  1. 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

  2. Utilize cmake cmake -B build_release -S . -DCMAKE_INSTALL_PREFIX=$DIR/grib2 cmake --build build_release/ cmake --install build_release/

ghost avatar May 07 '22 00:05 ghost

If https://github.com/madler/zlib/commit/05796d3d8d5546cf1b4dfe2cd72ab746afae505d doesn't fix this, then please request this be reopened.

madler avatar Oct 06 '22 01:10 madler