问题描述
我在尝试构建/归档 React Native 项目时遇到以下问题:
I'm experiencing the following issue while trying to build / archive a React Native project:
ld:未找到 -l-Xlinker 的库
我发布这个问题是因为错误有点棘手,谷歌搜索也无济于事(希望这个线程能出现在未来的搜索查询中).
I'm posting this question as the error is a bit tricky and googling it won't help (hoping for this thread to show up for future search queries).
-Xlinker 不是库,而是构建期间运行的 clang 命令的参数.
这是有问题的 clang 命令行的相关部分:
-Xlinker isn't a library but an argument of the clang command ran during the build.
Here's the relevant part of the faulty clang command line:
[...] -lRNFetchBlob -lRCTImageResizer -l -Xlinker -dependency_info -Xlinker [...]
如您所见,这里只有一个 -l
,我猜这就是错误的原因.我对 Xcode 不是很熟悉,但我去检查了Link Binary With Libraries"部分,期望那里可能有一个空行,但徒劳无功.
As you can see, there's a -l
alone here, which I guess is the cause of the error. I'm not very familiar with Xcode, but I went to check the "Link Binary With Libraries" part expecting there might be a empty line there, in vain.
欢迎提供帮助或提示!
$ react-native --version0.48.0
推荐答案
所以我检查了在命令行中调用 lib 的顺序,发现它与Link Binary With Libraries"中出现的顺序相同.我确实注意到最后一个条目有一个lib.a".我刚刚从Link Binary With Libraries"中删除了它,它解决了问题.
So I checked at the order the lib were called in the command line and noticed it was the same order as what appear in "Link Binary With Libraries". I indeed noticed that the last entry there was a "lib.a". I just removed it from "Link Binary With Libraries" and it solved the problem.
这篇关于ld:找不到 -l-Xlinker 的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!