Skip to content

Commit

Permalink
Use ld_classic on macOS (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 authored May 15, 2024
1 parent fbfbb87 commit 484504f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
### Removed
### Added

## [7.24.1] - 2024-05-15

### Fixed

- Fixed issue building with Clang/XCode 15 on macOS
- Add `-Wl,-ld_classic` to the HDF5 build

## [7.24.0] - 2024-04-23

### Updates
Expand Down
16 changes: 16 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ MAKEJOBS := $(if $(MAKEJOBS),$(MAKEJOBS),1)
# There is an issue with clang++ and cdo
CLANG_STDC17 := -std=c++17
export CLANG_STDC17

# We might need to add -Wl,-ld_classic to LDFLAGS but only for certain versions of macOS/XCode
# This command:
# pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | sed -n 's/version: \([0-9]*\)\..*/\1/p'
# will return the version of the Command Line Tools installed on the system and if it is 15 or greater
# then we need to add -Wl,-ld_classic to LDFLAGS
XCODE_VERSION := $(shell pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | sed -n 's/version: \([0-9]*\)\..*/\1/p')
XCODE_VERSION_GTE_15 := $(shell expr $(XCODE_VERSION) \>= 15)
ifeq ($(XCODE_VERSION_GTE_15),1)
CLANG_LD_CLASSIC := -Wl,-ld_classic
export CLANG_LD_CLASSIC
endif
endif
endif

Expand Down Expand Up @@ -350,6 +362,9 @@ verify:
@echo GFORTRAN_VERSION_GTE_10 = $(GFORTRAN_VERSION_GTE_10)
@echo MACOS_VERSION = $(MACOS_VERSION)
@echo MMACOS_MIN = $(MMACOS_MIN)
@echo XCODE_VERSION = $(XCODE_VERSION)
@echo XCODE_VERSION_GTE_15 = $(XCODE_VERSION_GTE_15)
@echo CLANG_LD_CLASSIC = $(CLANG_LD_CLASSIC)
@echo ALLOW_ARGUMENT_MISMATCH = $(ALLOW_ARGUMENT_MISMATCH)
@echo CC_IS_CLANG = $(CC_IS_CLANG)
@echo NO_IMPLICIT_FUNCTION_ERROR = $(NO_IMPLICIT_FUNCTION_ERROR)
Expand Down Expand Up @@ -546,6 +561,7 @@ hdf5.config :: hdf5/README.md szlib.install zlib.install
(cd hdf5; \
export PATH="$(prefix)/bin:$(PATH)" ;\
export LIBS="-lm" ;\
export LDFLAGS="$(CLANG_LD_CLASSIC)" ;\
./configure --prefix=$(prefix) \
--includedir=$(prefix)/include/hdf5 \
--with-szlib=$(prefix)/include/szlib,$(prefix)/lib \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.24.0
7.24.1

0 comments on commit 484504f

Please sign in to comment.