diff --git a/.changeset/clear-peas-fly.md b/.changeset/clear-peas-fly.md new file mode 100644 index 00000000..32da5927 --- /dev/null +++ b/.changeset/clear-peas-fly.md @@ -0,0 +1,5 @@ +--- +"cmake-rn": patch +--- + +Fix auto-linking failures due to lack of padding when renaming install name of libraries, by passing headerpad_max_install_names argument to linker. diff --git a/packages/cmake-rn/src/platforms/apple.ts b/packages/cmake-rn/src/platforms/apple.ts index c61c1e81..cb2e7f1b 100644 --- a/packages/cmake-rn/src/platforms/apple.ts +++ b/packages/cmake-rn/src/platforms/apple.ts @@ -278,6 +278,8 @@ export const platform: Platform = { CMAKE_SYSTEM_NAME: CMAKE_SYSTEM_NAMES[triplet], CMAKE_OSX_SYSROOT: XCODE_SDK_NAMES[triplet], CMAKE_OSX_ARCHITECTURES: APPLE_ARCHITECTURES[triplet], + // Passing a linker flag to increase the header pad size to allow renaming the install name when linking it into the app. + CMAKE_SHARED_LINKER_FLAGS: "-Wl,-headerpad_max_install_names", }, { // Setting the output directories works around an issue with Xcode generator diff --git a/scripts/init-macos-test-app.ts b/scripts/init-macos-test-app.ts index 7d3abd1e..1f80b1a7 100644 --- a/scripts/init-macos-test-app.ts +++ b/scripts/init-macos-test-app.ts @@ -104,6 +104,10 @@ async function patchPackageJson() { APP_PATH, path.join(ROOT_PATH, "packages", "host"), ), + "weak-node-api": path.relative( + APP_PATH, + path.join(ROOT_PATH, "packages", "weak-node-api"), + ), ...Object.fromEntries( Object.entries(otherDependencies).filter(([name]) => transferredDependencies.has(name),