[netcdfgroup] Problem using my own zlib (libz)

  • To: "netcdfgroup@xxxxxxxxxxxxxxxx" <netcdfgroup@xxxxxxxxxxxxxxxx>
  • Subject: [netcdfgroup] Problem using my own zlib (libz)
  • From: Bart Brashers <bbrashers@xxxxxxxxxxx>
  • Date: Fri, 7 Feb 2020 20:12:57 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ramboll.com; dmarc=pass action=none header.from=ramboll.com; dkim=pass header.d=ramboll.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EwQNcG+80t7DZGgPW6QlFD3Yu2F9Mqzx77Le4HvGS3Q=; b=PvFq4RdZq2EWWUZAyJ1ZL9Ccs1XftBC1XeVrTluvCkaYTiPpFoLdagUGlrq4p82Hr/g6B5hrRYYx0YGJ6txRi4wxwoM6LoMv4SeBOMXLGetvLnzfWD1hG5g1NMv6aOC1Css7VsOX9HY3RYjqGvYL4FL7YiroYIHA3oYjTasK8yP59uWzgpR13Y1UhwEAfurfbCQqGDZ6GGhDKUV1mIWzWh07cOhRvJaKgvcCSyOzo3B/ACyxjpjxIHqWddCT1J9n7thNcMUGOIz9UKqcgvjLhjBYLl4dq0amwN6tJaIW34R8Ea4LxwDyeUaP4GrDt4fbhGo9yCN7TWTqZkVFjIABYQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hs2GIzIfUZ2FAEC1xjI0oTYlLEEDiivN+VBC99RO/qwrLJvD3g+9tB3R26hazM/8O5manzVy/mDJMYdVxIkjUFf5ss3HIaeOnJ7bDYac2BeNlZQqczAhc8mdKHQrgFMvlfqhP9T9Nca8R9mMfWLY12+cPb2NH08tXTQSewdDXo5lAzFIR5VRV12L0RovfgXDY5NU5x7hH93pkXM3NVQKIzCbMQHtTgCBca0q9GymZnII+2Hc1BLANF8F9WhIYT80gIdfiy612p+o2cUgTE5GMMUiu32kyNvVAtpP9uYCgRdNmHd+jiW6qNKAMLaO8/eecegfzqJVCdmNz9kJpbYLQQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=bbrashers@xxxxxxxxxxx;
I'm a WRF modeler, and have a memory leak in one of the pre-processors 
(metgrid.exe) that I'm trying to track down. As part of that, I'd like to use 
my own (updated) compilations of various libraries, including zlib (AKA libz).

Below I've included my configure scripts for zlib, hdf5, netcdf-c, and 
netcdf-fortran. I have also included several /etc/profile.d/ files that set 
$LD_LIBRARY_PATH, etc.

After compilation, if I use /usr/bin/ldd to check which version of zlib an 
executable is going to use, it shows the gcc one, not the one I told it to use.


# ldd hdf5-1.8.20.pgi/bin/h5copy | grep libz

        libz.so.1 => 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libz.so.1 
(0x00007f62bbc77000)



# ldd netcdf-c-4.7.2.pgi/build/bin/ncgen | grep libz

        libz.so.1 => 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libz.so.1 
(0x00007effdfcbf000)



# ldd wrf/WPS-4.1/metgrid.exe | grep libz

        libz.so.1 => 
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libz.so.1 
(0x00007f0ce30a7000)

If anyone can see my error, or give me some hints, or tell me that /usr/bin/ldd 
is unreliable, I would be very appreciative.


# cat /etc/centos-release

CentOS Linux release 7.4.1708 (Core)



# echo $LD_LIBRARY_PATH | tr : "\n"

/opt/ohpc/pub/compiler/gcc/7.3.0/lib64

/usr/local/src/zlib-1.2.11/lib

/usr/local/src/hdf5-1.8.20.pgi/lib

/usr/local/src/libpng-1.6.37/lib

/usr/local/src/netcdf-c-4.7.2.pgi/build/lib

/usr/local/pgi/linux86-64/2019/lib

/usr/local/pgi/linux86-64/2019/libso

/usr/local/src/szip-2.1.1/lib



# cat zlib-1.2.11/my.configure

#!/bin/csh -f



make distclean >& /dev/null



setenv FC pgfortran

setenv CC pgcc



setenv FFLAGS "-tp=istanbul"

setenv CFLAGS "-tp=istanbul"



./configure \

    --prefix=`pwd`  \

    --libdir=`pwd`/lib \

    >&! my.configure.out



make >&! make.out

make install >&! make.install.out



# cat hdf5-1.8.20.pgi/my.configure

#!/bin/csh -f



# compile hdf5-1.8.20



make distclean >& /dev/null



setenv FC pgfortran

setenv CC pgcc



setenv FFLAGS  "-tp=istanbul"

setenv FCFLAGS "-tp=istanbul"

setenv CFLAGS  "-tp=istanbul"



setenv ZLIB /usr/local/src/zlib-1.2.11



setenv CPPFLAGS "-I$ZLIB/include"

setenv LDFLAGS "-L$ZLIB/lib"

setenv LD_LIBRARY_PATH $ZLIB/lib:$LD_LIBRARY_PATH



echo $LD_LIBRARY_PATH | tr : "\n"



./configure \

    --prefix=`pwd` \

    --enable-fortran \

    --with-zlib=/usr/local/zlib-1.2.11 \

    >&! my.configure.out



sed -i "s|-L/usr/local/src/zlib-1.2.11/lib|-L/usr/local/src/zlib-1.2.11/lib 
-lz|g" Makefile

sed -i "s|-lz -ldl -lm|-ldl -lm|g" Makefile



make >&! make.out

make install >&! make.install.out



# cat netcdf-c-4.7.2.pgi/my.configure

#!/bin/csh -f



setenv CC  pgcc

setenv CXX pgc++

setenv FC  pgfortran

setenv F77 pgf77

setenv F90 pgfortran



setenv FFLAGS "-tp=istanbul"

setenv CFLAGS "-fPIC -tp=istanbul"



set HDF5 = /usr/local/src/hdf5-1.8.20.pgi

set ZLIB = /usr/local/src/zlib-1.2.11



setenv LD_LIBRARY_PATH $HDF5/lib:$LD_LIBRARY_PATH

setenv CPPFLAGS "-I$ZLIB/include -I$HDF5/include"

setenv LDFLAGS "-L$HDF5/lib  -lhdf5_hl -lhdf5 -lm -L$ZLIB/lib -lz -ldl"



make distclean >& /dev/null

if (-e config.cache) rm config.cache

if (-e build) rm -r build



echo $LD_LIBRARY_PATH | tr : "\n"



./configure \

    --prefix=`pwd`/build \

    --enable-shared \

    --enable-netcdf-4 \

    --enable-hdf5 \

    --disable-dap \

    --disable-doxygen \

    >&! my.configure.out



make >&! make.out

make install >&! make.install.out



# cat netcdf-fortran-4.5.2.pgi/my.configure

#!/bin/csh -f



set NETCDF = /usr/local/src/netcdf-c-4.7.2.pgi/build



setenv FC  pgfortran

setenv F77 pgf77

setenv F90 pgfortran

setenv CC  pgcc

setenv CXX pgCC



setenv LD_LIBRARY_PATH $NETCDF/lib:$LD_LIBRARY_PATH

setenv LDFLAGS  "-L$NETCDF/lib"

setenv CPPFLAGS "-I$NETCDF/include"

setenv FFLAGS "-tp=istanbul"

setenv CFLAGS "-tp=istanbul"



make distclean >& /dev/null



./configure \

    --prefix=$NETCDF \

    >&! my.configure.out



make install >&! make.install.out



# cat /etc/profile.d/hdf5.csh

setenv HDF5      /usr/local/src/hdf5-1.8.20.pgi

setenv HDF5_DIR  /usr/local/src/hdf5-1.8.20.pgi

setenv HDF5_path /usr/local/src/hdf5-1.8.20.pgi

setenv HDF5_VERSION 1.8.20



if ( "${path}" !~ *${HDF5}/bin* ) then

    set path = ( $path ${HDF5}/bin )

endif



if !($?LD_LIBRARY_PATH) then

    setenv LD_LIBRARY_PATH $HDF5_DIR/lib

else

    if ( "$LD_LIBRARY_PATH" !~ *$HDF5_DIR/lib* ) then

        setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$HDF5_DIR/lib

    endif

endif



# cat /etc/profile.d/netcdf.csh

#

setenv NETCDF     /usr/local/src/netcdf-c-4.7.2.pgi/build

setenv NETCDFHOME $NETCDF

setenv NETCDF_DIR $NETCDF



if ( "${path}" !~ *${NETCDF}/bin* ) then

    set path = ( ${NETCDF}/bin $path )

endif



if !($?LD_LIBRARY_PATH) then

    setenv LD_LIBRARY_PATH $NETCDF_DIR/lib

else

    if ( "$LD_LIBRARY_PATH" !~ *$NETCDF_DIR/lib* ) then

        setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$NETCDF_DIR/lib

    endif

endif



# cat /etc/profile.d/zlib.csh

#

setenv ZLIB /usr/local/src/zlib-1.2.11



if !($?LD_LIBRARY_PATH) then

    setenv LD_LIBRARY_PATH $ZLIB/lib

else

    if ( "$LD_LIBRARY_PATH" !~ *$ZLIB/lib* ) then

        setenv LD_LIBRARY_PATH $ZLIB/lib:${LD_LIBRARY_PATH}

    endif

endif


- Bart

  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: