Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld: library not found for -lAmplitude when lib exists at …/BuildProductsPath/Debug-iphoneos/Amplitude #87

Open
kadanes opened this issue Jun 26, 2021 · 5 comments

Comments

@kadanes
Copy link

kadanes commented Jun 26, 2021

I keep getting this error when building my app using xcodebuild from the command line.

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;

The app builds fine via Xcode UI. This is a react native app, and I tried a bunch of things that didn't work.

  • Setting same deployment target for Pods and App projects
  • Deleting libAmplitude.a from app project's Frameworks folder
  • Setting Build Active Architecture Only to NO
  • Embedding libAmplitude.a along with libPods-APP_NAME.a

Strangely the file it can't find actually exists in the directory. I see two failures of this type (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)

Final build failure:

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)
@kelsonpw
Copy link
Contributor

kelsonpw commented Jul 4, 2021

Is there any chance you can provide a sample app that we can use to try to reproduce?

Our SDK is just a wrapper around our iOS and Android sdks. It looks to me like there is an issue with linking.

If unable to provide a sample could you provide details such as react native version, any custom tooling you might be using for your application, xcode version, and macos version? Also does the app build correctly using react native cli?

If no demo is provided, in order to debug we will need to create a react native app/environment similar to yours.

@jarnakhimani
Copy link

@parthv21 Did you get any solution for this? I am facing the same issue.

@PujanShah22
Copy link

Any update here?

@yuhao900914
Copy link
Contributor

yuhao900914 commented Apr 18, 2022

Hi all. Can you guys provide the output of running react-native info command, that will be helpful for debugging?
Are you using the cocoapod as a manager and with Xcode 10+?

@yuhao900914
Copy link
Contributor

I did several things to make build works through the command line.

  1. run npx react-native link in the root directory.
  2. Add this in order to remove the warning of The iOS Simulator deployment targets is different than the range of supported deployment target versions during the pod install
    post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' end end end
  3. remove the Podfile.lock and re-run the pod install in the ios folder
  4. I also deleted the DerivedData rm -rf ~/Library/Developer/Xcode/DerivedData and clean the build.
  5. It will still have the ARCHIVE FAILED issue for x86_64 and i386
    Screen Shot 2022-04-18 at 10 59 00 AM But if you run arch -x86_64 react-native run-ios, you can successfull build and run the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants