Fixes for building KPP on MacOSX#153
Merged
Merged
Conversation
src/Makefile.defs - Use "CC ?= gcc" (instead of "CC := gcc") so that Make will first use the value of the $CC environment variable from the shell instead of setting it to "gcc". This matters because the default gcc on MacOSX points to Clang rather than to GNU Compiler Collection. CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
docs/source/getting-started/01_installation.rst - Updated the MacOSX-specific instructions to use a path-agnostic algorithm in .bashrc to search for the GCC compiler. - Minor formatting updates CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
util/Makefile_c - Now use "CC ?= gcc" which will use the value of the CC env var if it has already been defined in the shell - Added "list" target to print compiler version info util/Makefile_f90 util/Makefile_upper_F90 - Now use "FC_GFORTRAN ?= gfortran", which will use the value of the FC env var if it has been already defined in the shell - Added "list" target to print compiler version info CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/Makefile.defs - Added an architecture-agnostic block that calls "brew --prefix flex" (if Homebrew is present) instead of hardwiring the FLEX_LIB_DIR path. - Define _BREW_PREFIX to store the value of "brew --prefix". This allows us the FLEX and BISON paths in an architecture-indepenedent way. - Updated comments CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
.ci-pipelines/ci-common-defs.sh
- Replace "gcc --version" with "${CC} --version", which will use the
C compiler defined in the shell. (Using "gcc" may point to clang").
- Replace "gfortran --version" with "${FC}" version, for the same reason
CHANGELOG.md
- Updated accordingly
Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/gen.c - In function GenerateUpdateRconst, set the UPDATE_RCONST value to zero so that it will not generate a "maybe-unassigned-variable" compiler warning with GCC 15+. CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Open
Contributor
|
As I'm not using MacOs, I will ask @HartwigHarder to review this PR. The non-MacOs-related changes (using |
HartwigHarder
approved these changes
Jul 2, 2026
HartwigHarder
left a comment
There was a problem hiding this comment.
Confirmed working; tested native and in Caaba/Mecca, MacOS Tahoe 26.5.2
Contributor
|
Thanks, @HartwigHarder! I think we're ready to merge now... |
Contributor
Author
|
Thanks @HartwigHarder and @RolfSander! I'll merge it up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the companion PR to #152 by @HartwigHarder, in which we have added several fixes for building KPP on MacOSX:
In
src/Makefile.defs-DMACOSinsrc/Makefile.defsand instead add pass a command to the C compiler to bump up the memory viaC_FLAGS.brew --prefixto obtain the root path for Homebrew-built libraries.CC = gccwithCC ?= gcc, so that Make will use the compiler specified by theCCenvironment variable before trying to use hardcoded value "gcc". This was problematic because the default gcc on MacOS points to Clang.In
util/Makefile.cCC = gccwithCC ?= gcc.make listtarget to print compiler version information.In
util/Makefile_f90andutil/Makefile_upper_F90:FC= gfortranwithFC ?= gfortranmake listtarget to print compiler version information.In
src/gen.cUPDATE_RCONSTvariable to 0 to avoid getting a "maybe-uninitialized-variable" compiler warning. This tends to happen with the newer GNU compiler versions (e.g. 14 and 15).In function
print_compiler_versions(located in `.ci-pipelines/ci-common-defs.sh):${CC} --versioninstead ofgcc --versionto ensure that we display the proper C compiler${FC} --versioninstead ofgfortran --versionto ensure that we display the proper Fortran compiler.In
docs/source/getting_started/01_installation.rst