Skip to content

Commit d0d7af3

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: #14240 (cherry picked from commit cfb5a48)
1 parent e2bb43a commit d0d7af3

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

docs/markdown/Builtin-options.md

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

258258
[[shared_module]]s will not have
259259
bitcode embedded because `-Wl,-bitcode_bundle` is incompatible with
260-
both `-bundle` and `-Wl,-undefined,dynamic_lookup` which are necessary
261-
for shared modules to work.
260+
`-Wl,-undefined,dynamic_lookup` which is necessary for shared modules to work.
262261

263262
## Compiler options
264263

mesonbuild/linkers/linkers.py

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

797797
def get_std_shared_module_args(self, options: 'KeyedOptionDictType') -> T.List[str]:
798-
return ['-bundle'] + self._apply_prefix('-undefined,dynamic_lookup')
798+
return ['-dynamiclib'] + self._apply_prefix('-undefined,dynamic_lookup')
799799

800800
def get_pie_args(self) -> T.List[str]:
801801
return []

0 commit comments

Comments
 (0)