Skip to content

Commit cfb5a48

Browse files
bonzinieli-schwartz
authored andcommitted
linkers: darwin: do not use -bundle for shared_modules
Both dynamic libraries and bundles these days can be dynamically loaded using the dl APIs (e.g. dlopen, dlclose). It is not possible to include bundles on a linker command line as if they were shared libraries, but that's pretty much the only difference. However, bundles fail the Apple verification for iOS: 2025-02-10 13:54:09.095 ERROR: Validation failed (409) The binary is invalid. The executable 'Runner.app/Frameworks/numpy._core._operand_flag_tests.framework/numpy._core._operand_flag_tests' has type 'BUNDLE' that is not valid. Only 'EXECUTE' is permitted. 2025-02-10 13:54:09.096 ERROR: Validation failed (409) Missing load commands. The executable at 'Runner.app/Frameworks/numpy._core._operand_flag_tests.framework' does not have the necessary load commands. Try rebuilding the app with the latest Xcode version. If you are using third party development tools, contact the provider. So switch to -dynamiclib for shared modules as well. Fixes: mesonbuild#14240
1 parent 4c52a68 commit cfb5a48

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎docs/markdown/Builtin-options.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ with `b_asneeded`, so that option will be silently disabled.
272272

273273
[[shared_module]]s will not have
274274
bitcode embedded because `-Wl,-bitcode_bundle` is incompatible with
275-
both `-bundle` and `-Wl,-undefined,dynamic_lookup` which are necessary
276-
for shared modules to work.
275+
`-Wl,-undefined,dynamic_lookup` which is necessary for shared modules to work.
277276

278277
## Compiler options
279278

‎mesonbuild/linkers/linkers.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def get_allow_undefined_args(self) -> T.List[str]:
806806
return self._apply_prefix('-undefined,dynamic_lookup')
807807

808808
def get_std_shared_module_args(self, target: 'BuildTarget') -> T.List[str]:
809-
return ['-bundle'] + self._apply_prefix('-undefined,dynamic_lookup')
809+
return ['-dynamiclib'] + self._apply_prefix('-undefined,dynamic_lookup')
810810

811811
def get_pie_args(self) -> T.List[str]:
812812
return []

0 commit comments

Comments
 (0)