Skip to content

Build a static library on macOS - #20

Merged
connorjward merged 2 commits into
mainfrom
connorjward/static
Aug 28, 2026
Merged

Build a static library on macOS#20
connorjward merged 2 commits into
mainfrom
connorjward/static

Conversation

@connorjward

Copy link
Copy Markdown
Contributor

Over the past 1/2 weeks something has gone buggy in the macOS toolchain (current suspect is gfortran 16.2 but that is a total shot in the dark).

In Firedrake this has manifested as a missing symbol error when the smoke tests are run on macOS:

 ==================================== ERRORS ====================================
  _ ERROR collecting tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py _
  ImportError while importing test module '/Users/github/actions-runner/_work/firedrake/firedrake/venv/lib/python3.14/site-packages/firedrake/_check/tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py'.
  Hint: make sure your test modules/packages have valid Python names.
  Traceback:
  /opt/homebrew/Cellar/python@3.14/3.14.7/Frameworks/Python.framework/Versions/3.14/lib/python3.14/importlib/__init__.py:88: in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py:3: in <module>
      from firedrake.supermeshing import *
  ../supermeshing.py:8: in <module>
      from firedrake.cython.supermeshimpl import assemble_mixed_mass_matrix as ammm, intersection_finder
  E   ImportError: dlopen(/Users/github/actions-runner/_work/firedrake/firedrake/venv/lib/python3.14/site-packages/firedrake/cython/supermeshimpl.cpython-314-darwin.so, 0x0002): symbol not found in flat namespace '_libsupermesh_tree_intersection_finder_set_input'

I have tracked this missing symbol error down to the following:

  1. The symbol comes from https://github.com/firedrakeproject/libsupermesh/blob/main/src/C_bindings.F90
  2. If I compile that file into an object file and run
$ nm -gU CMakeFiles/supermesh.dir/src/C_bindings.F90.o | grep tree_intersection_finder_set_input

I see

0000000000000488 T _libsupermesh_tree_intersection_finder_set_input

I.e. the symbol exists in the object file

  1. If I then link this file into the full executable and run
nm -gU libsupermesh.dylib | grep tree_intersection_finder_set_input

I see

000000000000b490 T ___libsupermesh_intersection_finder_MOD_tree_intersection_finder_set_input

the symbol is missing.

The 'fix' I have found is that the symbol appears to be correctly exported in a static library, as opposed to a shared one. I have tested Firedrake and this fixes the issue.

@connorjward
connorjward merged commit bf29872 into main Aug 28, 2026
3 checks passed
@connorjward
connorjward deleted the connorjward/static branch August 28, 2026 10:44
connorjward added a commit to firedrakeproject/firedrake that referenced this pull request Aug 28, 2026
* Use supermesh main branch

To get firedrakeproject/libsupermesh#20.

* Fix supermesh linking for static libsupermesh.a

This is likely never going to be an issue in practice because this fixes
Linux for static libraries, and the core fix is only needed for macOS,
where things work as is. However, it can't hurt.
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.

1 participant