Skip to content

Commit

Permalink
Add SYSTEM_ZLIB option (#199)
Browse files Browse the repository at this point in the history
* Add SYSTEM_ZLIB option

* Update changelog
  • Loading branch information
mathomp4 authored Jun 24, 2024
1 parent ace5c96 commit a1ac086
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

- Added `autoreconf -f -v -i` to many config steps. This is needed for newer hardware (like Graviton3 and GraceHopper)
- For `antlr2` we instead copy a new `config.guess` as `autoreconf` didn't seem to work
- Add new `SYSTEM_ZLIB` variable which, if set to `YES`, does not build zlib and uses the system version.
This was shown to be needed in testing NVHPC on bucy. Not sure why yet as no other compiler cares.
- Manifested as a `/usr/lib64/libxml2.so: undefined reference to `gzopen64@ZLIB_1.2.3.3'` error in ESMF linking

### Fixed

Expand Down
40 changes: 32 additions & 8 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,24 @@ ifeq ($(findstring ifx,$(notdir $(FC))),ifx)
SUBDIRS := $(filter-out SDPToolkit,$(SUBDIRS))
endif

# NVHPC and ESMF seem to have issues with zlib in Baselibs
# So we need to filter it out. We will use a special
# build variable to do this
ifeq ('$(SYSTEM_ZLIB)','YES')
SUBDIRS := $(filter-out zlib,$(SUBDIRS))
ZLIB_INSTALL =
WITH_ZLIB =
WITH_ZLIB_SHORT =
CURL_ZLIB = --without-zlib
# We also need to filter out zlib from INC_SUPP
INC_SUPP := $(filter-out -I$(prefix)/include/zlib,$(INC_SUPP))
else
ZLIB_INSTALL = zlib.install
WITH_ZLIB := --with-zlib=$(prefix)/include/zlib,$(prefix)/lib
WITH_ZLIB_SHORT := --with-zlib=$(prefix)
CURL_ZLIB := $(WITH_ZLIB_SHORT)
endif

TARGETS = all lib install

download: gsl.download szlib.download cdo.download hdfeos.download hdfeos5.download SDPToolkit.download
Expand All @@ -354,6 +372,12 @@ verify:
@echo CC_IS_CLANG = $(CC_IS_CLANG)
@echo NO_IMPLICIT_FUNCTION_ERROR = $(NO_IMPLICIT_FUNCTION_ERROR)
@echo LIB_EXTRA = $(LIB_EXTRA)
@echo SYSTEM_ZLIB = $(SYSTEM_ZLIB)
@echo ZLIB_INSTALL = $(ZLIB_INSTALL)
@echo WITH_ZLIB = $(WITH_ZLIB)
@echo WITH_ZLIB_SHORT = $(WITH_ZLIB_SHORT)
@echo CURL_ZLIB = $(CURL_ZLIB)
@echo INC_SUPP = $(INC_SUPP)
@echo NAG_FCFLAGS = $(NAG_FCFLAGS)
@echo FC_FROM_ENV = $(FC_FROM_ENV)
@echo CC_FROM_ENV = $(CC_FROM_ENV)
Expand Down Expand Up @@ -523,7 +547,7 @@ jpeg.config: jpeg/configure
CFLAGS="$(CFLAGS)" CC=$(CC) CXX=$(CXX) FC=$(FC) )
@touch $@

hdf4.config: hdf4/README.md jpeg.install zlib.install szlib.install
hdf4.config: hdf4/README.md jpeg.install $(ZLIB_INSTALL) szlib.install
@echo Configuring hdf4
@(cd hdf4; \
export PATH="$(prefix)/bin:$(PATH)" ;\
Expand All @@ -535,14 +559,14 @@ hdf4.config: hdf4/README.md jpeg.install zlib.install szlib.install
--includedir=$(prefix)/include/hdf \
--with-jpeg=$(prefix)/include/jpeg,$(prefix)/lib \
--with-szlib=$(prefix)/include/szlib,$(prefix)/lib \
--with-zlib=$(prefix)/include/zlib,$(prefix)/lib \
$(WITH_ZLIB) \
--disable-netcdf \
--enable-hdf4-xdr \
$(HDF4_ENABLE_FORTRAN) \
CFLAGS="$(CFLAGS) $(NO_IMPLICIT_FUNCTION_ERROR) $(NO_IMPLICIT_INT_ERROR)" FFLAGS="$(NAG_FCFLAGS) $(NAG_DUSTY) $(ALLOW_ARGUMENT_MISMATCH)" CC=$(CC) FC=$(FC) CXX=$(CXX) )
touch $@

hdf5.config :: hdf5/README.md szlib.install zlib.install
hdf5.config :: hdf5/README.md szlib.install $(ZLIB_INSTALL)
echo Configuring hdf5
(cd hdf5; \
export PATH="$(prefix)/bin:$(PATH)" ;\
Expand All @@ -551,7 +575,7 @@ hdf5.config :: hdf5/README.md szlib.install zlib.install
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/hdf5 \
--with-szlib=$(prefix)/include/szlib,$(prefix)/lib \
--with-zlib=$(prefix)/include/zlib,$(prefix)/lib \
$(WITH_ZLIB) \
--disable-shared --disable-cxx\
--enable-hl --enable-fortran --disable-sharedlib-rpath \
$(ENABLE_GPFS) $(H5_PARALLEL) $(HDF5_ENABLE_F2003) \
Expand Down Expand Up @@ -697,7 +721,7 @@ zlib.config : zlib/configure
touch $@


curl.config : curl/configure.ac zlib.install
curl.config : curl/configure.ac $(ZLIB_INSTALL)
@echo "Configuring curl"
@(cd curl; \
export PATH="$(prefix)/bin:$(PATH)" ;\
Expand All @@ -707,7 +731,7 @@ curl.config : curl/configure.ac zlib.install
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/ \
--libdir=$(prefix)/lib \
--with-zlib=$(prefix) \
$(WITH_ZLIB_SHORT) \
--disable-ldap \
--enable-manual \
--disable-shared \
Expand Down Expand Up @@ -736,7 +760,7 @@ cdo.config: cdo.download cdo/configure netcdf.install udunits2.install
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/cdo \
--with-szlib=$(prefix) \
--with-zlib=$(prefix) \
$(WITH_ZLIB_SHORT) \
--with-hdf5=$(prefix) \
--with-netcdf=$(prefix) \
--with-udunits2=$(prefix) \
Expand Down Expand Up @@ -872,7 +896,7 @@ SDPToolkit.config: SDPToolkit.download SDPToolkit/configure hdfeos5.install
autoreconf -f -v -i;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/SDPToolkit \
--with-zlib=$(prefix)/include/zlib,$(prefix)/lib \
$(WITH_ZLIB) \
--with-szlib=$(prefix)/include/szlib,$(prefix)/lib \
--with-hdf4=$(prefix)/include/hdf,$(prefix)/lib \
--with-hdf5=$(prefix)/include/hdf5,$(prefix)/lib \
Expand Down

0 comments on commit a1ac086

Please sign in to comment.