Fix macOS install issue #265
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix macOS install failure (MH_BUNDLE vs MH_DYLIB)
This PR fixes the macOS CI failure during “Install package verbosely” where linking the
Pyfhelextension failed due to an incorrect Mach-O file type for theAfhellibrary.Root cause
-bundlefor “shared” builds, which produces an MH_BUNDLE, not an MH_DYLIB.libAfhel.dylibas if it were a real dynamic library; the linker rejects MH_BUNDLE inputs for this step, causing the failure.Changes
Scope: macOS-only. Linux and Windows builds remain unchanged.
setup.pySuperBuildClib.build_shared_libAfhelas a proper SHARED library (i.e., MH_DYLIB).-Wl,-install_name,@loader_path/<lib_file>to ensure the dylib is loadable at runtime from the extension’s directory.-bundleto-dynamiclib, but this path is no longer taken (kept as a safety net).Why this works:
add_library(<name> SHARED ...)reliably produces MH_DYLIB on macOS.install_nameguarantees the extension can loadlibAfhel.dylibvia@loader_path.Validation & compatibility
setup.pyorpyproject.toml.Afhelnow builds as MH_DYLIB; the subsequent link step forPyfhelsucceeds.