Installing the experimental Matlab toolbox on MacOS

21 views
Skip to first unread message

Santosh Shanbhogue

unread,
Oct 31, 2025, 3:52:35 PM (6 days ago) Oct 31
to Cantera Users' Group
Hi all,

I'm looking forward to test driving the experimental matlab toolbox on my Apple M1 Pro. I compiled the latest version from source (commit # 2054d5e · ) Using the installations from readme.md to compile the matlab toolbox, I get this error below

Any suggestions would be greatly appreciated

It looks like Cantera compiled thinking my mac is x86_64, but my Matlab installed natively for the arm64 architecture

Thanks,
Santosh

Paths used in the build process:
Cantera Toolbox Root: /Users/santosh1/packages/canteraSource/interfaces/matlab_experimental
Include Directory: /Users/santosh1/packages/ct_dev_version/include
Cantera Library: /Users/santosh1/packages/ct_dev_version/lib
Output Folder: /Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera
MEX configured to use 'Xcode Clang++' for C++ language compilation.
Deleted file '/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/definectMatlab.m'.
C++ compiler set to 'Xcode Clang++'.
Definition file definectMatlab.m contains definitions for 428 constructs supported by MATLAB.
- 324 constructs are fully defined.
- 104 constructs partially defined and commented out.

To include the 104 undefined constructs in the interface, uncomment and complete the definitions in definectMatlab.m.
To build the interface, call build(definectMatlab).
Building interface file 'ctMatlabInterface.dylib' for clib interface 'ctMatlab'.
Build Log:
/usr/bin/xcrun -sdk macosx26.0 clang++ -c -fno-common -arch arm64 -mmacosx-version-min=12.0 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -fwrapv -ffp-contract=off  -fobjc-arc -std=c++14 -stdlib=libc++ -O2 -DNDEBUG   -I"/Users/santosh1/packages/ct_dev_version/include" -I"/Applications/MATLAB_R2024b.app/extern/include"  "/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/ctMatlab/ctMatlabInterface.cpp" -o "/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/ctMatlab/ctMatlabInterface.o"

/usr/bin/xcrun -sdk macosx26.0 clang++ -Wl,-twolevel_namespace  -arch arm64 -mmacosx-version-min=12.0 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk -framework Cocoa -bundle  -stdlib=libc++   "/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/ctMatlab/ctMatlabInterface.o"  "/Users/santosh1/packages/ct_dev_version/lib/libcantera_shared.3.2.0.dylib" "/Applications/MATLAB_R2024b.app/extern/bin/maca64/libMatlabDataArray.dylib"  -Wl,-rpath,@loader_path/ -O   -o "/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/ctMatlab/ctMatlabInterface.dylib" -sectcreate __TEXT us_resources "/Users/santosh1/packages/canteraSource/interfaces/matlab_experimental/cantera/ctMatlab/ctMatlab.zip"

---
Error using clibgen.internal.buildHelper (line 116)
Build failed with error:
'ld: warning: ignoring file '/Users/santosh1/packages/ct_dev_version/lib/libcantera_shared.3.2.0.dylib': found
architecture 'x86_64', required architecture 'arm64'
Undefined symbols for architecture arm64:
  "_bdry_massFraction", referenced from:
      (anonymous namespace)::FPassThrough91(void*, void (*)(void*, int, matlab::data::impl::ArrayImpl**), int,
      matlab::data::impl::ArrayImpl**, void (*)(void*, char const*, char const*)) in ctMatlabInterface.o
  "_bdry_mdot", referenced from:

Ray Speth

unread,
Oct 31, 2025, 4:30:59 PM (6 days ago) Oct 31
to Cantera Users' Group
Hi Santosh,

Can you share the build log for your Cantera compilation process? I'm wondering what compiler it's using, as I wouldn't expect it to end up compiling for x86_64. If I had to hazard a guess, I wonder if it's picking up a strange compiler, say from an old Homebrew installation, rather than the Apple-provided version of Clang.

Regards,
Ray

Santosh Shanbhogue

unread,
Oct 31, 2025, 10:27:06 PM (5 days ago) Oct 31
to canter...@googlegroups.com
Hi Ray,

I've attached the output from scons build. Scons builds using g++, and if I do g++ -v, here is what I get
Apple clang version 17.0.0 (clang-1700.3.19.1)
Target: arm64-apple-darwin24.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I tried to use cc_flags = '-target amd64-apple-darwin24.6.0' but with this, Cantera does not compile and fails after the cmath check. In the config.log, I found this useful line: "... found architecture 'arm64', required architecture 'x86_64' "

Let me know if you need anything else

Cheers,
Santosh

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cantera-users/52f816cb-18bf-41de-96e9-0d5e199576adn%40googlegroups.com.
scons_output.log

Ray Speth

unread,
Oct 31, 2025, 11:36:30 PM (5 days ago) Oct 31
to Cantera Users' Group
Hi Santosh,

Is the Python installation that you're using built for x86_64? It looks like the .whl file built for the Python module is targeting this architecture as well, based on the resulting file name (cantera-3.2.0a5-cp311-cp311-macosx_10_15_x86_64.whl). I'm surprised that that succeeds though, as no flags are being passed to the compiler to specify a target architecture, and, as you report the default for this version of Clang should be arm64.

Regards,
Ray

Santosh Shanbhogue

unread,
Nov 1, 2025, 4:57:15 PM (5 days ago) Nov 1
to canter...@googlegroups.com
Thanks Ray! That indeed was the issue. Upgrading conda to arm64 and rebuilding Cantera did the trick

Cheers,
Santosh

Reply all
Reply to author
Forward
0 new messages