Summary
On macOS the paclet library fails to link (compilation succeeds):
[ 47%] Linking CXX shared library .../MacOSX-ARM64/libHypergraphRewriting.dylib
Undefined symbols for architecture arm64:
"_WSNewPacket", referenced from: _performRewriting in hypergraph_ffi.cpp.o ...
"_WSNextPacket", ...
"_WSPutFunction", ...
"_WSPutString", ...
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1
make: *** [paclet] Error 2
Root cause
In paclet_source/CMakeLists.txt, the WSTP block has three platform branches.
The Windows and Linux branches each link the WSTP library
(wstp64i4.lib / libWSTP64i4.so), but the Darwin branch only sets
HAVE_WSTP=1 and adds the include directory — it never links libWSTPi4.a.
So hypergraph_ffi.cpp is compiled with the WSTP code path enabled
(WSNewPacket/WSNextPacket/WSPutFunction/WSPutString, used for progress
reporting) but those symbols are never resolved at link time.
Reproduce
./build_all_platforms.sh on macOS (Apple silicon, Wolfram 14+).
Fix
Link the macOS WSTP static library in the Darwin branch
(libWSTPi4.a, which additionally needs -framework Foundation — already added
in the Darwin linker block).
Related problems found while fixing this (also addressed in the PR)
cmake/FindMathematica.cmake does not search
/Applications/Wolfram.app/Contents — the install name used by Wolfram 14+
on macOS — so the kernel is only found if MATHEMATICA_HOME is set manually.
build_all_platforms.sh aborts the entire multi-platform run when the
Windows-ARM64 configure step fails (it can only succeed on a Windows/WSL host
with the Windows SDK). On macOS this kills the run before the macOS libraries
are even built. It should skip host-impossible targets, not fail.
- There is no native macOS build path — the script routes macOS through
OSXCross even when running on macOS, where Apple clang can target both
arches natively.
A PR addressing all of the above follows.
Summary
On macOS the paclet library fails to link (compilation succeeds):
Root cause
In
paclet_source/CMakeLists.txt, the WSTP block has three platform branches.The Windows and Linux branches each link the WSTP library
(
wstp64i4.lib/libWSTP64i4.so), but the Darwin branch only setsHAVE_WSTP=1and adds the include directory — it never linkslibWSTPi4.a.So
hypergraph_ffi.cppis compiled with the WSTP code path enabled(
WSNewPacket/WSNextPacket/WSPutFunction/WSPutString, used for progressreporting) but those symbols are never resolved at link time.
Reproduce
./build_all_platforms.shon macOS (Apple silicon, Wolfram 14+).Fix
Link the macOS WSTP static library in the Darwin branch
(
libWSTPi4.a, which additionally needs-framework Foundation— already addedin the Darwin linker block).
Related problems found while fixing this (also addressed in the PR)
cmake/FindMathematica.cmakedoes not search/Applications/Wolfram.app/Contents— the install name used by Wolfram 14+on macOS — so the kernel is only found if
MATHEMATICA_HOMEis set manually.build_all_platforms.shaborts the entire multi-platform run when theWindows-ARM64 configure step fails (it can only succeed on a Windows/WSL host
with the Windows SDK). On macOS this kills the run before the macOS libraries
are even built. It should skip host-impossible targets, not fail.
OSXCross even when running on macOS, where Apple clang can target both
arches natively.
A PR addressing all of the above follows.