Skip to content

Enhance Windows compatibility and update CI configurations#212

Open
hkmoon wants to merge 176 commits intobertiniteam:developfrom
hkmoon:develop
Open

Enhance Windows compatibility and update CI configurations#212
hkmoon wants to merge 176 commits intobertiniteam:developfrom
hkmoon:develop

Conversation

@hkmoon
Copy link
Copy Markdown

@hkmoon hkmoon commented Mar 28, 2026

This pull request introduces significant improvements to the build system and release workflow for the project, especially focusing on cross-platform compatibility and automated Python package publishing. The main highlights include the addition of a comprehensive GitHub Actions workflow for building and publishing Python wheels to PyPI/TestPyPI, enhancements for Windows compatibility, and updates to documentation and changelogs to reflect these changes.

Automated Build and Release Workflow:

  • Added a new GitHub Actions workflow (.github/workflows/build-and-publish-to-pypi.yml) to automate building Python wheels for Linux, macOS, and Windows, and to publish them to PyPI, TestPyPI, and GitHub Releases. This workflow includes environment setup, dependency installation, platform-specific build steps, artifact uploading, and release signing.

Windows Compatibility Improvements:

  • Updated CMake modules (cmake/FindGMP.cmake, cmake/FindMPFR.cmake, cmake/FindMPC.cmake) to correctly locate and link against Windows-specific library filenames, improving build reliability on Windows. [1] [2] [3]
  • Modified core/CMakeLists.txt to set appropriate build flags and shared library options for MSVC, and improved Boost/Eigen3 detection and linking for cross-platform builds. [1] [2] [3] [4]

Documentation and Changelog Updates:

  • Added a detailed CHANGELOG.md documenting recent changes, release preparations, and platform-specific notes, including new contributor acknowledgments.
  • Updated the README.md with clear installation instructions for Linux, macOS, and Windows, and clarified wheel/platform support.

CMake Modernization and Refactoring:

  • Refactored the top-level CMakeLists.txt to use modern CMake practices, improved project metadata, integrated jrl-cmakemodules for streamlined dependency management, and added options for documentation and testing.
  • Temporarily disabled the addition of the python subdirectory in the build to avoid issues during the transition.

These changes collectively streamline the build, test, and release process, making it easier to maintain and distribute the package across all major platforms.

References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Check the github workflow: https://github.com/hkmoon/b2/actions/runs/23671693162

Use https://pypi.org/manage/project/pybertini/release/1.0.9/ for testing.

image

hkmoon and others added 30 commits May 6, 2025 14:03
There are some compiling errors while being compiled in windows

* `size_t` is translated into `unsigned long` in linux, mac while `unsigned long long` in windows 10: `core/include/bertini2/eigen_extensions.hpp` and `core/test/classes/start_system_test.cpp` are modified
* use `clang` of LLVM in Windows since MSVC has different compiling way for `template`
* use `--no-isolation` for `scikit-build` in Windows

For linux wheel naming convention, we cannot use x86_64, x86_i386 anymore for pypi repository. https://peps.python.org/pep-0600/

* use `auditwheel` for it

Co-authored-by: HongKee Moon <moon@mpi-cbg.de>
the default branch is changed to 'develop'
additionally, fix ctest folder
additionally, fix ctest folder
* chore: test for win32

* chore: use Release libraries for linking in windows

* chore: use 1e-14 instead of 1e-15

* 1e-15 doesn't work in windows

* chore: remove docker-compose.yml

* chore: revert test list

---------

Co-authored-by: HongKee Moon <moon@mpi-cbg.de>
Copilot AI review requested due to automatic review settings March 28, 2026 00:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the project’s packaging/build system to improve cross-platform (especially Windows) builds and adds automation for building and publishing Python wheels/releases.

Changes:

  • Added a GitHub Actions workflow to build wheels on Linux/macOS/Windows and publish to TestPyPI/PyPI + GitHub Releases.
  • Updated CMake configuration and custom Find modules to improve Windows builds/linking and modernize dependency discovery.
  • Updated Python packaging metadata/versioning and added Windows DLL search-path handling for runtime imports.

Reviewed changes

Copilot reviewed 24 out of 28 changed files in this pull request and generated 30 comments.

Show a summary per file
File Description
python_bindings/include/mpfr_export.hpp Whitespace/formatting-only adjustments.
python_bindings/CMakeLists.txt Windows-oriented build/link changes; Boost/Python/Eigen handling updates.
python/examples/solve_system.py Fixes indentation/formatting in example.
python/bertini/windows_dll_manager.py New helper for locating/adding DLL directories on Windows.
python/bertini/_version.py Bumps package version to 1.0.9.
python/bertini/__init__.py Adds Windows DLL directory setup during import.
pyproject.toml Renames project to pybertini, updates version and Python version range, adjusts scikit-build settings.
environment.yml Adds a conda environment spec (Linux).
environment-win.yml Adds a conda environment spec (Windows).
core/test/classic/classic_test.cpp Disables BOOST_TEST_DYN_LINK define.
core/test/classes/start_system_test.cpp Adjusts tests for Windows size_t/literal portability; formatting changes.
core/test/classes/class_test.cpp Disables BOOST_TEST_DYN_LINK define; adjusts tolerance.
core/test/blackbox/blackbox.cpp Disables BOOST_TEST_DYN_LINK define.
core/include/bertini2/trackers/base_tracker.hpp Whitespace/formatting-only adjustments.
core/include/bertini2/system/system.hpp Exposes EIGEN_MAKE_ALIGNED_OPERATOR_NEW under public.
core/include/bertini2/system/straight_line_program.hpp Attempts to gate precision checks for Windows; formatting tweaks.
core/include/bertini2/mpfr_extensions.hpp Removes Eigen 3.2.x workaround comment/code and documents Eigen>=3.3 requirement.
core/include/bertini2/logging.hpp Disables BOOST_LOG_DYN_LINK define.
core/include/bertini2/endgames/cauchy.hpp Large comment/whitespace formatting adjustments.
core/include/bertini2/eigen_extensions.hpp Replaces uint with unsigned int in APIs for portability.
core/CMakeLists.txt Substantial build system updates: MSVC flags, Boost/Eigen discovery, install rules, test definitions.
cmake/FindMPFR.cmake Updates Windows library name search.
cmake/FindMPC.cmake Updates Windows library name search.
cmake/FindGMP.cmake Updates Windows library name search.
README.md Updates installation instructions focusing on pybertini wheels and platforms.
CMakeLists.txt Refactors top-level CMake to use jrl-cmakemodules and related configuration.
CHANGELOG.md Adds a changelog documenting release preparations and platform notes.
.github/workflows/build-and-publish-to-pypi.yml New CI workflow for building/publishing wheels and creating signed GitHub releases.
Comments suppressed due to low confidence (2)

core/include/bertini2/system/straight_line_program.hpp:512

  • #ifndef BERTINI_DISABLE_PRECISION_CHECKS && _WIN32 is invalid preprocessor syntax (#ifndef only accepts a single macro name). This will not compile; use #if !defined(BERTINI_DISABLE_PRECISION_CHECKS) && defined(_WIN32) (or equivalent).
#ifndef BERTINI_DISABLE_PRECISION_CHECKS && _WIN32
			if (!std::is_same<NumT,dbl_complex>::value && Precision(variable_values)!=this->precision_){
				std::stringstream err_msg;
				err_msg << "variable_values and SLP must be of same precision.  respective precisions: " << Precision(variable_values) << " " << this->precision_ << std::endl;
				throw std::runtime_error(err_msg.str());

core/include/bertini2/system/straight_line_program.hpp:542

  • Same issue as above: #ifndef BERTINI_DISABLE_PRECISION_CHECKS && _WIN32 is not valid. Replace with an #if !defined(...) && defined(_WIN32) style conditional so the file compiles.
#ifndef BERTINI_DISABLE_PRECISION_CHECKS && _WIN32
			if (Precision(time)!= DoublePrecision() && Precision(time)!=this->precision_){
				std::stringstream err_msg;
				err_msg << "time value and SLP must be of same precision.  respective precisions: " << Precision(time) << " " << this->precision_ << std::endl;
				throw std::runtime_error(err_msg.str());
			}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(BUILD_SHARED_LIBS TRUE)
target_compile_options(bertini2
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>)
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSVC compile options are spelled with / (e.g. /bigobj, /MP). Using -bigobj -MP under CXX_COMPILER_ID:MSVC can fail with cl.exe. Update these flags to the MSVC forms (and if you also support clang-cl, consider branching on CXX_SIMULATE_ID/CMAKE_CXX_COMPILER_FRONTEND_VARIANT).

Suggested change
PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj -MP>)
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/bigobj /MP>
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_FRONTEND_VARIANT:MSVC>>:-bigobj -MP>)

Copilot uses AI. Check for mistakes.
Comment on lines +660 to +661
add_test(NAME test_classic COMMAND ${CMAKE_BINARY_DIR}/core/test_classic)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding ${CMAKE_BINARY_DIR}/core/test_classic in add_test can fail on multi-config builds (Debug/Release subdirs) and if runtime output dirs are customized. Use $<TARGET_FILE:test_classic> (or the target name) instead.

Copilot uses AI. Check for mistakes.
Comment on lines +715 to +716
add_test(NAME test_nag_datatypes COMMAND ${CMAKE_BINARY_DIR}/core/test_nag_datatypes)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_test(... COMMAND ${CMAKE_BINARY_DIR}/core/test_nag_datatypes) hardcodes the executable path; this will fail in multi-config generators (Debug/Release subdirs). Use $<TARGET_FILE:test_nag_datatypes> or the target name.

Copilot uses AI. Check for mistakes.
Comment on lines 505 to 507
void SetVariableValues(Eigen::MatrixBase<Derived> const& variable_values) const{
using NumT = typename Derived::Scalar;

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using NumT = typename Derived::Scalar; is declared twice in this function (here and again a few lines below). Re-declaring the same alias in the same scope is a compile error; keep a single NumT alias and remove the duplicate.

Copilot uses AI. Check for mistakes.
Comment on lines +433 to +441
install(
TARGETS bertini2
EXPORT ${TARGETS_EXPORT_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bertini2 is installed via install(TARGETS bertini2 ...) here, and then again a few lines later in another install(TARGETS bertini2 ...) call. Installing the same target twice with different destinations/components is error-prone and can lead to duplicate/contradictory install rules; consolidate into a single install(TARGETS ...) block (using GNUInstallDirs variables).

Copilot uses AI. Check for mistakes.
Comment on lines +649 to +650
add_test(NAME test_blackbox COMMAND ${CMAKE_BINARY_DIR}/core/test_blackbox)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test command hardcodes ${CMAKE_BINARY_DIR}/core/test_blackbox, which is fragile across multi-config generators and custom output dirs. Use $<TARGET_FILE:test_blackbox> (or the target name) as the command for add_test.

Copilot uses AI. Check for mistakes.

find_library(GMP_LIBRARIES gmp PATHS $ENV{GMP_LIB} ${LIB_INSTALL_DIR})
if(WIN32)
find_library(GMP_LIBRARIES libgmp.dll.a PATHS $ENV{GMP_LIB} ${LIB_INSTALL_DIR})
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows, hardcoding the import library name to libgmp.dll.a is likely to fail for MSVC/clang-cl toolchains where conda packages typically provide .lib import libs (and CMake can already handle prefixes/suffixes). Consider using find_library(... NAMES gmp libgmp libgmp-10 ...) (or just gmp) rather than a single .dll.a filename to support both MSVC and MinGW layouts.

Suggested change
find_library(GMP_LIBRARIES libgmp.dll.a PATHS $ENV{GMP_LIB} ${LIB_INSTALL_DIR})
find_library(GMP_LIBRARIES
NAMES gmp libgmp libgmp-10
PATHS $ENV{GMP_LIB} ${LIB_INSTALL_DIR}
)

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +33
if (MSVC)
add_compile_options(/bigobj)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(BUILD_SHARED_LIBS TRUE)
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set(CMAKE_BUILD_TYPE Release) inside the MSVC branch overrides user choice and breaks multi-config generators (Visual Studio / Ninja Multi-Config), where CMAKE_BUILD_TYPE is ignored. Prefer not forcing the build type here; let the generator/configuration control it (or set defaults only when NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE).

Copilot uses AI. Check for mistakes.
Comment on lines +679 to +680
add_test(NAME test_endgames COMMAND ${CMAKE_BINARY_DIR}/core/test_endgames)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_test(... COMMAND ${CMAKE_BINARY_DIR}/core/test_endgames) hardcodes a build-tree path that isn't portable to multi-config generators. Prefer $<TARGET_FILE:test_endgames> for the test command.

Copilot uses AI. Check for mistakes.
Comment on lines +692 to +693
add_test(NAME test_generating COMMAND ${CMAKE_BINARY_DIR}/core/test_generating)

Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This add_test hardcodes ${CMAKE_BINARY_DIR}/core/test_generating, which can break on multi-config generators (and if output paths change). Use $<TARGET_FILE:test_generating> (or the target name) as the command.

Copilot uses AI. Check for mistakes.
@ofloveandhate
Copy link
Copy Markdown
Contributor

I have been playing with compiling at top level (without going through pip). i'm using mamba for package management. it's correctly finding eigenpy (if i remove it via mamba, cmake errors and can't find it; on the other hand, with it installed, I can compile Bertini 2). But, cmake reports that eigenpy was not found. See this screenshot:

Screenshot 2026-03-31 at 10 26 35

@hkmoon
Copy link
Copy Markdown
Author

hkmoon commented Mar 31, 2026

@ofloveandhate

Please, get the latest version of the repo and follow the below steps:
If you want to just update the dependencies with new environment file, use:
mamba env update -n b2-windows -f environment-win.yml --prune

micromamba env create --file environment-win.yml
micromamba activate b2-windows

$env:CMAKE_PREFIX_PATH="$env:CONDA_PREFIX\Library"

# Patch boost header to fix clang-cl linker error
$boostHeader = "$env:CONDA_PREFIX\Library\include\boost\archive\archive_exception.hpp"
(Get-Content $boostHeader).Replace('public virtual std::exception', 'public std::exception') | Set-Content $boostHeader

Remove-Item -Recurse -Force build
cmake  -S . -B build -G Ninja -DENABLE_UNIT_TESTING=ON -DCMAKE_CXX_COMPILER=clang-cl
cmake --build build --target all --config Release -j
ctest --test-dir build/core

I was overwhelmed by the warnings I'm not responsible for, coming from Boost, MPFR, etc.  I cannot fix those.  But, I CAN fix the warnings from my own software.  So, by marking the external libraries as SYSTEM, the warnings don't appear.

Also, explicitly include mpfr headers, they were missing.  also, be target specific.
I was able to compile on my mac with Python 3.14.
@ofloveandhate
Copy link
Copy Markdown
Contributor

I'm having test failures on MacOS at this time.

make test
Running tests...
/opt/homebrew/bin/ctest 
Test project /Users/amethyst/repo/b2_bertiniteam/build
      Start  1: test_classes
 1/10 Test  #1: test_classes .....................***Failed    0.52 sec
      Start  2: test_blackbox
 2/10 Test  #2: test_blackbox ....................***Failed    0.47 sec
      Start  3: test_classic
 3/10 Test  #3: test_classic .....................   Passed    0.35 sec
      Start  4: test_endgames
 4/10 Test  #4: test_endgames ....................   Passed   17.00 sec
      Start  5: test_generating
 5/10 Test  #5: test_generating ..................   Passed    0.37 sec
      Start  6: test_nag_algorithms
 6/10 Test  #6: test_nag_algorithms ..............***Failed    0.45 sec
      Start  7: test_nag_datatypes
 7/10 Test  #7: test_nag_datatypes ...............   Passed    0.37 sec
      Start  8: test_pool
 8/10 Test  #8: test_pool ........................   Passed    0.34 sec
      Start  9: test_settings
 9/10 Test  #9: test_settings ....................   Passed    0.38 sec
      Start 10: test_tracking_basics
10/10 Test #10: test_tracking_basics .............***Failed    0.38 sec

60% tests passed, 4 tests failed out of 10

Total Test time (real) =  20.63 sec

The following tests FAILED:
	  1 - test_classes (Failed)
	  2 - test_blackbox (Failed)
	  6 - test_nag_algorithms (Failed)
	 10 - test_tracking_basics (Failed)
Errors while running CTest

Here's the output from running test_classes:

(b2_testing) b2_bertiniteam/build pr/212 $ ./core/test_classes 
Running 426 test cases...
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "complex_multiprecision_class/complex_serialization": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:530: last checkpoint: "complex_serialization" test entry
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:867: error: in "complex_multiprecision_class/complex_get_from_stream_parens_with_comma": check z.real() == bertini::mpfr_float("0.1234") has failed [0 != 0.1234]
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:868: error: in "complex_multiprecision_class/complex_get_from_stream_parens_with_comma": check z.imag() == bertini::mpfr_float("-4.12397") has failed [0 != -4.12397]
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:880: error: in "complex_multiprecision_class/complex_get_from_stream_parens_no_comma": check z.real() == bertini::mpfr_float("-3.651263418976498712e-2") has failed [0 != -0.0365126]
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:893: error: in "complex_multiprecision_class/complex_get_from_stream_no_parens": check z.real() == bertini::mpfr_float("-3.651263418976498712e-2") has failed [0 != -0.0365126]
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:907: error: in "complex_multiprecision_class/float_get_from_stream_parens_with_comma": check z == bertini::mpfr_float("0.1234") has failed [0 != 0.1234]
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "miscellaneous_complex_tests_out_of_place/mpfr_float_serialization": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:1078: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "miscellaneous_complex_tests_out_of_place/mpfr_float_serialization2": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/complex_test.cpp:1110: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "system_class/clone_system_new_variables_evaluation": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/system_test.cpp:1049: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/serialize_variable": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:69: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/serialize_float": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:96: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/serialize_complicated_expression": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:121: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/system_serialize_scopes": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:160: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/system_serialize_scopes_via_parsing": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:221: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/system_serialize_scopes_using_subfunctions_via_parsing": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:275: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/system_clone": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:328: last checkpoint
test_classes(48378,0x201dfb100) malloc: *** error for object 0x201e068e8: pointer being freed was not allocated
test_classes(48378,0x201dfb100) malloc: *** set a breakpoint in malloc_error_break to debug
unknown location:0: fatal error: in "node_serialization/clone_griewank_osborn": signal: SIGABRT (application abort requested)
/Users/amethyst/repo/b2_bertiniteam/core/test/classes/node_serialization_test.cpp:365: last checkpoint

@hkmoon
Copy link
Copy Markdown
Author

hkmoon commented Mar 31, 2026

@ofloveandhate
It looks that you used different boost libraries.
Can you try with this?

cmake -DENABLE_UNIT_TESTING=ON -G Ninja -B build -S .
cmake --build build --target all
ctest --test-dir build/core

❯ ctest --test-dir build/core
Internal ctest changing into directory: /Users/moon/Projects/git-projects/Harrington/b2/build/core
Test project /Users/moon/Projects/git-projects/Harrington/b2/build/core
      Start  1: test_classes
 1/10 Test  #1: test_classes .....................   Passed    0.46 sec
      Start  2: test_blackbox
 2/10 Test  #2: test_blackbox ....................   Passed    0.20 sec
      Start  3: test_classic
 3/10 Test  #3: test_classic .....................   Passed    0.17 sec
      Start  4: test_endgames
 4/10 Test  #4: test_endgames ....................   Passed   17.51 sec
      Start  5: test_generating
 5/10 Test  #5: test_generating ..................   Passed    0.20 sec
      Start  6: test_nag_algorithms
 6/10 Test  #6: test_nag_algorithms ..............   Passed   68.58 sec
      Start  7: test_nag_datatypes
 7/10 Test  #7: test_nag_datatypes ...............   Passed    0.26 sec
      Start  8: test_pool
 8/10 Test  #8: test_pool ........................   Passed    0.19 sec
      Start  9: test_settings
 9/10 Test  #9: test_settings ....................   Passed    0.20 sec
      Start 10: test_tracking_basics
10/10 Test #10: test_tracking_basics .............   Passed    0.39 sec

100% tests passed, 0 tests failed out of 10

Total Test time (real) =  88.17 sec

By the way, I use the below packages:

boost
boost-python3
eigen
eigen@3
eigenpy
gmp
libmpc
mpfr
python-setuptools

The steps are:

brew install gmp
brew install mpfr
brew install libmpc
brew install eigen@3
brew install eigenpy
brew install boost
brew install boost-python3
brew install python-setuptools
          
python3 -m venv venv
source venv/bin/activate
pip install numpy scipy wheel build
export CMAKE_PREFIX_PATH="/opt/homebrew/opt/boost@1.85:$CMAKE_PREFIX_PATH"
cmake -DENABLE_UNIT_TESTING=ON -G Ninja -B build -S .
cmake --build build --target all
ctest --test-dir build/core

@ofloveandhate
Copy link
Copy Markdown
Contributor

We found together that without using care, with both homebrew installed and a mamba environment active, cmake is mixing together packages from both mamba and homebrew.

Solution 1: Not using a mamba environment, but just brew, worked like a charm.

Outstanding problem: nonetheless, we would like to be able to use mamba on a computer that also has homebrew.

@ofloveandhate
Copy link
Copy Markdown
Contributor

Solution 2: take care when using cmake on a computer with both Homebrew and Mamba active. I'm on MacOS when doing this.

Before running cmake, do this

export CMAKE_PREFIX_PATH="$CONDA_PREFIX:$CMAKE_PREFIX_PATH"                                      
export PATH="$CONDA_PREFIX/bin:$PATH"
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="$CONDA_PREFIX/lib:$DYLD_LIBRARY_PATH"
export PKG_CONFIG_PATH="$CONDA_PREFIX/lib/pkgconfig:$CONDA_PREFIX/share/pkgconfig:$PKG_CONFIG_PATH"

Then, when running cmake, let it know where it should install things.

cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX  ../

It worked like a charm. Unit tests passing.

@ofloveandhate
Copy link
Copy Markdown
Contributor

It would be nice if CMake detected potentially problematic setups -- in particular, those where a conda/mamba environment is active, but pieces are found in other places. This seems difficult.

@hkmoon
Copy link
Copy Markdown
Author

hkmoon commented Mar 31, 2026

It's awesome you found the way to do the tests and founded the ground for all the upgrades of dependencies!

@ofloveandhate
Copy link
Copy Markdown
Contributor

On Ubuntu 25.04, using micromamba to install packages, inside virtualbox on my Mac, I was able to compile. Not all tests are passing in the core.

/usr/bin/ctest --force-new-ctest-process 
Test project /home/amethyst/code/b2/build
     Start  1: test_classes
1/10 Test  #1: test_classes .....................***Failed    0.05 sec
     Start  2: test_blackbox
2/10 Test  #2: test_blackbox ....................   Passed    0.01 sec
     Start  3: test_classic
3/10 Test  #3: test_classic .....................   Passed    0.00 sec
     Start  4: test_endgames
4/10 Test  #4: test_endgames ....................   Passed   14.10 sec
     Start  5: test_generating
5/10 Test  #5: test_generating ..................   Passed    0.01 sec
     Start  6: test_nag_algorithms
6/10 Test  #6: test_nag_algorithms ..............   Passed   33.27 sec
     Start  7: test_nag_datatypes
7/10 Test  #7: test_nag_datatypes ...............   Passed    0.01 sec
     Start  8: test_pool
8/10 Test  #8: test_pool ........................   Passed    0.01 sec
     Start  9: test_settings
9/10 Test  #9: test_settings ....................   Passed    0.01 sec
     Start 10: test_tracking_basics
10/10 Test #10: test_tracking_basics .............***Exception: SegFault  1.10 sec
cd core/
(b2) amethyst@ubuntu25:~/code/b2/build/core$ ./test_tracking_basics 
Running 81 test cases...
unknown location(0): fatal error: in "amp_criteria_tracking_basics/AMP_criteriaB_double": memory access violation at address: 0xbd90f6b4de90: no mapping at fault address
/home/amethyst/code/b2/core/test/tracking_basics/amp_criteria_test.cpp(163): last checkpoint: "AMP_criteriaB_double" test entry

@ofloveandhate
Copy link
Copy Markdown
Contributor

Fixed the failing test by using explicit types. (Eigen expression templates, lazy evaluation, and auto don't play well together). All unit tests passing in Ubuntu 25.04 using micromamba for packages, in my virtual machine on my mac.

@ofloveandhate
Copy link
Copy Markdown
Contributor

All core tests passing in Ubuntu, if in debug mode. In release mode, still getting a few failures:

/home/amethyst/code/b2/core/test/classes/function_tree_test.cpp(1410): error: in "function_tree_class/manual_construction_x_pow_lnum1_times_num2l": check fabs(N->Eval<dbl>().real() - exact_dbl.real() ) < threshold_clearance_d has failed
/home/amethyst/code/b2/core/test/classes/function_tree_test.cpp(1411): error: in "function_tree_class/manual_construction_x_pow_lnum1_times_num2l": check fabs(N->Eval<dbl>().imag() - exact_dbl.imag() ) < threshold_clearance_d has failed
/home/amethyst/code/b2/core/test/classes/function_tree_transform.cpp(814): error: in "function_tree/transform/simplify/complicated": check n->Eval<dbl>() == a*b has failed [(-0.336111,-0.217866) != (-0.336111,-0.217866)]

*** 3 failures are detected in the test module "Bertini 2 Class Testing"

I think these are due to arithmetic compiler optimization, and could be corrected via slightly relaxing the tolerances.

ofloveandhate and others added 6 commits April 1, 2026 16:03
several tests were failing on Ubuntu (so gcc) when using compiler optimization, so relaxing the tolerances.  In particular `manual_construction_x_pow_lnum1_times_num2l` produces noise in the last 2-3 digits.  i added comments for what i got for "exact" values from vpa in Matlab.  I also note that both of the tests I modified involve `pow` for complex numbers.
to prevent case fallthrough and evaluation of the system twice
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants