代码之家  ›  专栏  ›  技术社区  ›  Parth

ld:当lib存在于…/BuildProductsPath/Debug iphoneos/Amplitude时,找不到-lAmplitude的库

  •  1
  • Parth  · 技术社区  · 5 年前

    我在使用构建应用程序时不断收到此错误 xcodebuild 从命令行。

    xcodebuild -workspace ios/APP_NAME.xcworkspace -scheme APP_NAME clean archive -sdk iphoneos -configuration Debug -UseModernBuildSystem=NO -archivePath $PWD/APP_NAME CODE_SIGNING_ALLOWED=NO;
    

    该应用程序通过Xcode UI构建良好。这是一个react原生应用程序,我尝试了这里列出的一些东西- Xcode - ld: library not found for -lPods ,那没用。

    • 为Pods和App项目设置相同的部署目标
    • 正在删除 libAmplitude.a 来自应用程序项目的Frameworks文件夹
    • 背景 Build Active Architecture Only 至NO
    • 嵌入 libAmplitude。一 随着 libPods-APP_NAME.a

    奇怪的是,它找不到的文件实际上存在于目录中。我看到两个这种类型的故障(arm64和armv7)。

    ld: warning: directory not found for option '-L-L/Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/BuildProductsPath/Debug-iphoneos/Amplitude'
    ld: library not found for -lAmplitude
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    最终生成失败:

    The following build commands failed:
            Ld /Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/IntermediateBuildFilesPath/APP_NAME.build/Debug-iphoneos/APP_NAME.build/Objects-normal/arm64/APP_NAME normal arm64
            Ld /Users/Parth/Library/Developer/Xcode/DerivedData/APP_NAME-atzumsqdaojeyaaukpzreucvvlja/Build/Intermediates.noindex/ArchiveIntermediates/APP_NAME/IntermediateBuildFilesPath/APP_NAME.build/Debug-iphoneos/APP_NAME.build/Objects-normal/armv7/APP_NAME normal armv7
    (2 failures)
    

    随振幅提交的问题- https://github.com/amplitude/Amplitude-ReactNative/issues/87

    编辑

    更改后,这可能是问题的根本原因 other linker flags 到 ${inherited} ,我看到两次提到振幅。

    1. -l“振幅”
    2. -l“固有振幅反应”

    linker flags

    0 回复  |  直到 5 年前
        1
  •  0
  •   Parth    5 年前

    更改此设置后,我开始工作 -UseModernBuildSystem=YES .

    xcodebuild -workspace ios/APP_NAME.xcworkspace -scheme APP_NAME clean archive -sdk iphoneos -configuration Debug -UseModernBuildSystem=YES -archivePath $PWD/APP_NAME CODE_SIGNING_ALLOWED=NO;
    

    我还必须:

    1. 更新对iOS 11的最低支持
    2. 将链接器标志设置为 仅 ${inhereted}
    3. 设置 Build Active Architecture Only 到 YES .