Skip to content

Commit b41fcbc

Browse files
committed
Add SDK main include path to compiler flags for C header access
Issue: Still getting "Checking for C++ header file cmath... no" even though we're passing -I<SDK>/usr/include/c++/v1. Root cause: C++ standard library headers often include C headers (e.g., <cmath> includes <math.h>, <cstdlib> includes <stdlib.h>). These C headers are in the SDK's main include directory, not the c++/v1 subdirectory. Solution: Add both include paths to cc_flags and cxx_flags: 1. -I<SDK>/usr/include (for C headers) 2. -I<SDK>/usr/include/c++/v1 (for C++ headers) This ensures scons' test compile can find both C and C++ headers.
1 parent 6837356 commit b41fcbc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packaging/homebrew/mfc.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ def install
5555

5656
# Run scons, explicitly passing compiler flags as Cantera scons variables
5757
# Cantera uses cc_flags/cxx_flags, not CCFLAGS/CXXFLAGS
58-
# Include C++ header path directly in cxx_flags for scons' configuration checks
59-
cxx_flags_with_includes = "#{ENV.fetch("CXXFLAGS", nil)} -I#{cxx_inc_path}"
58+
# Include both SDK include path and C++ header path for scons' configuration checks
59+
sdk_inc_path = "#{sdk_path}/usr/include"
60+
cxx_flags_with_includes = "#{ENV.fetch("CXXFLAGS", nil)} -I#{sdk_inc_path} -I#{cxx_inc_path}"
6061
system venv/"bin/python", "-m", "SCons", "build",
6162
"CC=#{ENV.cc}",
6263
"CXX=#{ENV.cxx}",
63-
"cc_flags=#{ENV.fetch("CFLAGS", nil)}",
64+
"cc_flags=#{ENV.fetch("CFLAGS", nil)} -I#{sdk_inc_path}",
6465
"cxx_flags=#{cxx_flags_with_includes}",
6566
"python_package=y",
6667
"f90_interface=n",

0 commit comments

Comments
 (0)