ReactNative-application.cmake links autolinked libraries to common_flags with the plain target_link_libraries signature, so a library that uses PRIVATE fails the app's CMake configure
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- cmake, react-native
- 领域
- build-system
调研方向
打开ReactAndroid/cmake-utils/ReactNative-application.cmake,找到第 97 行(0.88.1)/第 108 行(nightly)附近的foreach(autolinked_library ...)代码块,以及其正下方的${APP_CODEGEN_TARGET}链接;两者都使用简单形式的target_link_libraries,这与通过PRIVATE/PUBLIC自行链接的库冲突。阅读复现仓库中的modules/keyword-linking/android/CMakeLists.txt,了解导致失败的组合,然后在复现仓库中运行./reproduce.sh,在编辑前确认配置错误。完成标准是循环始终使用带关键字的签名,并且./gradlew :app:configureCMakeDebug[arm64-v8a]以退出码 0 结束,同时不链接任何内容或使用简单形式进行链接的库仍能正常配置。
由索引模型根据 Issue 内容生成。
描述
Description
ReactNative-application.cmake links every autolinked library to common_flags with the plain signature:
foreach(autolinked_library ${AUTOLINKED_LIBRARIES})
target_link_libraries(${autolinked_library} common_flags)
endforeach()
CMake refuses to mix the plain and the keyword signatures on one target, so an autolinked library whose own CMakeLists.txt links its target with PRIVATE, PUBLIC or INTERFACE fails the configure of every app that installs it. The app-level codegen target is linked the same way (target_link_libraries(${APP_CODEGEN_TARGET} common_flags)).
Steps to reproduce
-
Clone the reproducer and run
./reproduce.sh(react-native 0.88.1) or./reproduce.sh nightly.ReproducerAppdepends on a local library,modules/keyword-linking, whosereact-native.config.jsgives AndroidlibraryName: 'keywordlinking'andcmakeListsPath: 'CMakeLists.txt', and whoseandroid/CMakeLists.txtis:add_library(react_codegen_keywordlinking SHARED keyword-linking.cpp) target_link_libraries(react_codegen_keywordlinking PRIVATE fbjni jsi reactnative) -
The script runs
npm install, then./gradlew :app:configureCMakeDebug[arm64-v8a] -PreactNativeArchitectures=arm64-v8ainReproducerApp/android.
Expected: the app's CMake build configures, as it does when the library drops PRIVATE.
Seen: the configure fails at ReactNative-application.cmake:97 on 0.88.1 and at :108 on 0.90.0-nightly-20261113-6d587e873. The script exits 1 while this shows and 0 once the configure passes.
React Native Version
0.88.1
Affected Platforms
Runtime - Android, Build - Windows
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26300
CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor "
Binaries:
Node:
version: 26.12.1
npm:
version: 12.2.1
Languages:
Java:
version: 17.0.20.1
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.88.1
wanted: 0.88.1
Android:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
react-native 0.90.0-nightly-20261113-6d587e873
$ ./gradlew :app:configureCMakeDebug[arm64-v8a] -PreactNativeArchitectures=arm64-v8a
gradle exit 1
C/C++: CMake Error at ReproducerApp/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:108 (target_link_libraries):
C/C++: The keyword signature for target_link_libraries has already been used with
C/C++: the target "react_codegen_keywordlinking". All uses of
C/C++: target_link_libraries with a target must be either all-keyword or
C/C++: all-plain.
C/C++: The uses of the keyword signature are here:
C/C++: * ReproducerApp/node_modules/keyword-linking/android/CMakeLists.txt:7 (target_link_libraries)
C/C++: Call Stack (most recent call first):
C/C++: CMakeLists.txt:31 (include)
SUMMARY: defect: the app's CMake configure fails, as ReactNative-application.cmake links react_codegen_keywordlinking with the plain signature and its own CMakeLists uses PRIVATE (react-native 0.90.0-nightly-20261113-6d587e873)
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-autolinked-keyword-link-signature
Screenshots and Videos
No response
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.5k
- 平均合并
- 4 天 47 分钟
- 30 天内合并 PR
- 217
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react/react-native 的其他 Issue
-
ConcreteShadowNode::getConcreteSharedProps() returns a reference to a temporary可能已有人在做 @lazerg 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
react/react-native#59944 · 1 条评论 ·
维护者通常 2 天内回复
-
`yarn test-ios` exits before building RNTester: `objc-test.sh` launches the WebSocket server script #59433 deleted可能已有人在做 @lazerg 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
react/react-native#59939 ·
维护者通常 2 天内回复
-
iOS Fabric pointer-handler reset leaves the next lone touch non-primary可能已有人在做 @alleneubank 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
react/react-native#59919 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
react/react-native#59722 ·
维护者通常 2 天内回复
-
Android: new WebSocket() crashes the app for a URL that OkHttp or java.net.URI rejects可能已有人在做 @sorinc03 于 11 天前认领。 未关闭🌐Networking Needs: Author Feedback Needs: Repro Platform: Android
难度 2/5 1-3 小时 新手友好度 72/100
react/react-native#59704 · 1 条评论 ·
维护者通常 2 天内回复
查看 react/react-native 的全部 Issue
相似的 Issue
-
enhancement frontend
难度 2/5 1-3 小时 新手友好度 66/100
-
Spot Capacity Round Trips tests accept the two largest rising runs可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
intel/torch-xpu-ops#6197 ·
维护者通常 1 天内回复
-
project: hipblaslt
难度 2/5 1-3 小时 新手友好度 62/100
ROCm/rocm-libraries#15746 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复