Skip to content

M2/Macaulay2/e/CMakeLists.txt: Build shared library libM2-engine#4319

Draft
mkoeppe wants to merge 7 commits into
Macaulay2:developmentfrom
passagemath:shared-lib
Draft

M2/Macaulay2/e/CMakeLists.txt: Build shared library libM2-engine#4319
mkoeppe wants to merge 7 commits into
Macaulay2:developmentfrom
passagemath:shared-lib

Conversation

@mkoeppe
Copy link
Copy Markdown

@mkoeppe mkoeppe commented May 18, 2026

No description provided.

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 18, 2026

/usr/bin/ld: Macaulay2/e/mathicgb/libmathicgb.a(TypicalReducer.cpp.o): warning: relocation against `_ZN3mgb14TypicalReducer10insertTailENS_12NewConstTermERKNS_4PolyE' in read-only section `.text'
/usr/bin/ld: Macaulay2/e/memtailor/libmemtailor.a(Arena.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTISt9bad_alloc@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC

@mahrud
Copy link
Copy Markdown
Member

mahrud commented May 18, 2026

Ah, -fPIC issues are the bane of my existence. It's almost like they cannot be fixed on all platforms simultaneously!

@mahrud mahrud added the Engine Macaulay2/e label May 18, 2026
@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 18, 2026

Well it is building these libs static despite the -DBUILD_SHARED_LIBS=ON.

[19/427] Linking CXX static library Macaulay2/e/memtailor/libmemtailor.a

@mahrud
Copy link
Copy Markdown
Member

mahrud commented May 18, 2026

This is fine for testing, but I presume you're planning on making pull requests on https://github.com/Macaulay2/mathic, etc. eventually?

@mkoeppe

This comment was marked as outdated.

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 18, 2026

The build on Ubuntu works:

[424/427] Linking CXX executable usr-dist/x86_64-Linux-Ubuntu-24.04/bin/M2-binary
-- Linked libraries:
	linux-vdso.so.1 (0x00007fed5fc43000)
	libM2-engine.so => /home/runner/work/M2/M2/M2/BUILD/build/Macaulay2/e/libM2-engine.so (0x00007fed5ec00000)
	libmathicgb.so => /home/runner/work/M2/M2/M2/BUILD/build/Macaulay2/e/mathicgb/libmathicgb.so (0x00007fed5fb19000)
	libmathic.so => /home/runner/work/M2/M2/M2/BUILD/build/Macaulay2/e/mathic/libmathic.so (0x00007fed5fafc000)
	libmemtailor.so => /home/runner/work/M2/M2/M2/BUILD/build/Macaulay2/e/memtailor/libmemtailor.so (0x00007fed5faf7000)
...

https://github.com/Macaulay2/M2/actions/runs/26052591173/job/76592810597?pr=4319#step:10:784

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 18, 2026

On macOS, there is a problem:

Undefined symbols for architecture arm64:
  "_TS_Get_Local", referenced from:
      system_interrupted() in interrupted.cpp.o
  "_interrupts_interruptedFlag_id", referenced from:
      system_interrupted() in interrupted.cpp.o
ld: symbol(s) not found for architecture arm64

https://github.com/Macaulay2/M2/actions/runs/26052591173/job/76592810598?pr=4319#step:10:514

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 18, 2026

These symbols are defined by M2-supervisor, which is linked only into M2-interpreter, but not into M2-engine

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 19, 2026

/usr/bin/ld: Macaulay2/system/CMakeFiles/M2-supervisor.dir/tests.cpp.o: warning: relocation against `interrupts_interruptedFlag_id' in read-only section `.text'
/usr/bin/ld: Macaulay2/system/CMakeFiles/M2-supervisor.dir/supervisor.cpp.o: relocation R_X86_64_PC32 against symbol `interpThread' can not be used when making a shared object; recompile with -fPIC

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 19, 2026

[21/428] Linking CXX shared library Macaulay2/system/libM2-supervisor.dylib
FAILED: [code=1] Macaulay2/system/libM2-supervisor.dylib 
: && /opt/homebrew/opt/ccache/libexec/clang++ -nostdinc++ -isystem /Applications/Xcode_16.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -isystem /Applications/Xcode_16.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -O3 -DNDEBUG -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -L/opt/homebrew/lib     -L/opt/homebrew/opt/libomp/lib     -L/opt/homebrew/opt/readline/lib -g -L/Users/runner/work/M2/M2/M2/BUILD/build/usr-host/lib -o Macaulay2/system/libM2-supervisor.dylib -install_name @rpath/libM2-supervisor.dylib Macaulay2/system/CMakeFiles/M2-supervisor.dir/supervisor.cpp.o Macaulay2/system/CMakeFiles/M2-supervisor.dir/m2file.cpp.o Macaulay2/system/CMakeFiles/M2-supervisor.dir/tests.cpp.o  /opt/homebrew/lib/libgc.dylib && :
Undefined symbols for architecture arm64:
  "_stdio0_newDefaultFileOutputSyncState", referenced from:
      _M2File_GetState in m2file.cpp.o
  "_thread_prepare_list", referenced from:
      SupervisorThread::threadEntryPoint() in supervisor.cpp.o
ld: symbol(s) not found for architecture arm64

@mkoeppe
Copy link
Copy Markdown
Author

mkoeppe commented May 19, 2026

These symbols are defined in the interpreter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Macaulay2/e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants