M2
M2 copied to clipboard
building M2 on Apple silicon MacOS Sonoma
This issue will contain my experiments for compiling M2 on Apple silicon, on MacOS Sonoma, and with different compilers, cmake/autotools, etc. I have found a number of issues, and now I want to be systematic about this.
My use of this as an issue is experimental (for me!)
Here is the first list to try
- [ ] cmake build, apple clang
- [x] configure
earlier, I needed to install brew packages msolve and texinfo (for install-info)
I also need to add in
-DBUILD_NATIVE=off, perhaps this should be done automatically?-DCMAKE_PREFIX_PATH="`brew --prefix tbb@2020`;`brew --prefix`" - [x] executable
ninja M2-core - [x] examples
ninja install-packagesQuestion: How do I tell what the default target forninjais? - [ ] package tests One test in RunExternalM2 fails. Also, with one package left, the process appears to hang (it is either done with SpecialFanoFourfolds, or hanging during that).
- [ ] M2 tests
- [x] configure
earlier, I needed to install brew packages msolve and texinfo (for install-info)
I also need to add in
- [ ] cmake build, llvm clang
- [ ] cmake build, gcc14
@d-torrance @mahrud When compiling on appleclang, on MacOS Sonoma (maybe others too), I get the following problem during ctest. This same problem happens with every test in the normal directory.
Try
ctest -R normal/000-core.m2 -V
Running this gives on my apple M1 mac:
4155: Test command: /Users/mike/src/M2-current-branches/M2-development/M2/BUILD/mike/builds.tmp/cmake-appleclang/usr-dist/arm64-Darwin-macOS-14.6.1/bin/M2 "-q" "--stop" "--silent" "--no-debug" "--no-randomize" "-e" "errorDepth=1" "-e" "debugLevel=0" "-e" "gbTrace=" "-e" "path=join(path,{"/Users/mike/src/M2-current-branches/M2-development/M2/Macaulay2/tests/","/Users/mike/src/M2-current-branches/M2-development/M2/packages/"})" "-e" "input("/Users/mike/src/M2-current-branches/M2-development/M2/Macaulay2/tests/normal/000-core.m2")" "-e" "exit 0"
4155: Working Directory: /Users/mike/src/M2-current-branches/M2-development/M2/Macaulay2/tests/normal
4155: Environment variables:
4155: GC_MAXIMUM_HEAP_SIZE=400M
4155: Test timeout computed to be: 900
4155: currentString:2:0:(3):[2]: error: syntax error at '-*end of file*-'
4155: ../../m2/startup.m2.in:619:14:(0): --backtrace: parse error--
1/1 Test #4155: normal/000-core.m2 ...............***Failed 0.34 sec
0% tests passed, 1 tests failed out of 1
On a branch that I have where development was last merged into it a month or two ago (I think July, but I can check), the ctest's work fine.
Perhaps some recent change to startup.m2.in is involved?
Seems like a file system problem almost. Have you tried this on the main branch?
- Question: How do I tell what the default target for
ninjais?
Run ninja -t browse. It'll list the targets that ninja all will run, and you can click through to see the subtargets.
I see this sort of ctest errors on the current branch on a x86_64 Linux system.
UpdateCTestConfiguration from :/home/dima/software/M2/M2/BUILD/build/DartConfiguration.tcl
Parse Config file:/home/dima/software/M2/M2/BUILD/build/DartConfiguration.tcl
Test project /home/dima/software/M2/M2/BUILD/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 4433
Start 4433: normal/000-core.m2
4433: Test command: /home/dima/software/M2/M2/BUILD/build/usr-dist/x86_64-Linux-Gentoo-2.17/bin/M2 "-q" "--stop" "--silent" "--no-debug" "--no-randomize" "-e" "errorDepth=1" "-e" "debugLevel=0" "-e" "gbTrace=" "-e" "path=join(path,{"/home/dima/software/M2/M2/Macaulay2/tests/","/home/dima/software/M2/M2/packages/"})" "-e" "input("/home/dima/software/M2/M2/Macaulay2/tests/normal/000-core.m2")" "-e" "exit 0"
4433: Working Directory: /home/dima/software/M2/M2/Macaulay2/tests/normal
4433: Environment variables:
4433: GC_MAXIMUM_HEAP_SIZE=400M
4433: Test timeout computed to be: 900
4433: currentString:2:0:(3):[2]: error: syntax error at '-*end of file*-'
4433: ../../m2/startup.m2.in:622:15:(0): --backtrace: parse error--
1/1 Test #4433: normal/000-core.m2 ...............***Failed 0.34 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.41 sec
The following tests FAILED:
4433 - normal/000-core.m2 (Failed)
Errors while running CTest
Output from these tests are in: /home/dima/software/M2/M2/BUILD/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
(there are quite a few other tests which error out like this)
@mahrud - so this is not macOS-specific, it's cmake/ctest
I see it again, and wonder why m2/startup.m2.in is even involved. That's a templated file for autotools only, no?
Both build systems use startup.m2.in.
OK, but why does it pop up in tests? Normally speaking one tests the results of a build, not unprocessed sources.
startup.m2.in is a little funny. During the build, the various templated things get replaced, and then it's stored inside the M2 binary as a string. This string is the first bit of top-level code that's run at startup.
When M2 runs into an error, it always prints the line of code where the error occurred. And if this line of code happens to be from this string, it prints the location as startup.m2.in.
so the actual error is from startup.m2, not startup.m2.in? perhaps this ought to be fixed
startup.m2 isn't actually ever run -- it's shipped with M2 for reference. The actual error is occurring in the string inside the M2 binary.
yes, but this string is made from startup.m2, right?
Kind of. Both the string and startup.m2 are generated from startup.m2.in. If you make changes to startup.m2, then nothing will happen -- any changes would need to be made to startup.m2.in before recompiling M2.
What is the string containing startup.m2 doing in M2 executable? Is it there to skip reading these commands from a file, so that the interpreter is running commands in this string?