Building and archiving detached app iOS Mac fails

I am testing an app on IOS and for some reason every simulator except iPhone 5 works (my physical device is also IPhone5 and that does not work either). Anyone have an idea of why only iPhone 5 fails? (also receives a lot of warnings)

Deployment target 9.0
Xcode: Version 8.3.2 (8E2002)

I suspect it’s something to do with that device using a 32-bit processor, though theoretically this project should build for both 32- and 64-bit devices. What happens if you play with the “only active arch” flag (or related) in xcode?

I have tried different combinations, but same problem exist.

I managed to get it to work.

If I just play from xcode I always get the linking error. To get it to work with simulators (except iphone 5) I have to run this command:

  1. react-native run-ios (always get an error at the end)
  2. Run play from xcode

Iphone 5

  1. react-native run-ios --simulator=“iphone 5” (error this time as well)
  2. Run from xcode

Physical device

  1. npm install ios-deploy
  2. react-native run-ios --device=“my iphone”
  3. Run from xcode

This is a bit weird because “react native run-ios” is usually enough with stock react projects.

I have managed to work around this case until now that I have to run “Archive” to create a app for Appstore. Anyone have an idea of what is wriong? Are there any commands I can run to create an archive from React-native ?

ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/Amplitude-iOS’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/Analytics’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/AppAuth’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/Bolts’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/Branch’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/CocoaLumberjack’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/ExpoKit’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/FBSDKCoreKit’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/FBSDKLoginKit’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/FBSDKShareKit’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/GPUImage’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/GTMOAuth2’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/GTMSessionFetcher’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/GoogleToolboxForMac’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/React’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/Yoga’
ld: warning: directory not found for option ‘-L/Users/xxx/Projects/react/app_react_expo/ios/build/Release-iphoneos/lottie-ios’
ld: library not found for -lAmplitude-iOS
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I found that React is not built in Xcode when my app is detached (Regular react native apps react is build is first element). Isn´t that a problem?

Hi, can you try detaching a totally blank project and see if the issue appears there as well? I just tried this:

  1. Create new project
  2. detach
  3. Build for iPhone 5

And it worked for me. Xcode 8.3.2, target is an iPhone 5 simulator. So I wonder if there is something else going on with your specific project.

Hi Ben

I have tried again with a new project and I am having the same issues with this project. Linking error. I have Xcode: 8.3.2. Updated to 8.3.3 with no change. Could there be some missing info in my exp.json file or something?

Created new project in expo
expo detach
Run pod install from your project’s ios directory.

Linking error.

Hmm, what version of cocoapods do you have?

Cocoapods version is 1.2.1
react-native-cli: 2.0.1

Mac 10.12.5 (Sierra)

@ben , I can send you my Expo project if you think that can help?

i have same problem,everything fine in expo client app when i detaching my project and i run in xcode i got same error ld: library not found for -lAmplitude-iOS
clang: error: linker command failed with exit code 1 (use -v to see invocation)
.
anybody have solution !!???

Can you paste the contents of your Podfile and package.json as well? I’m still not able to reproduce this behavior with a new project.

Hope this is helpful with the linking errors. As stated before I can send you the entire project if that can help.

PODFILE:

source ‘GitHub - CocoaPods/Specs: The CocoaPods Master Repo
platform :ios, ‘9.0’

target ‘bysykkelen’ do
pod ‘ExpoKit’,
:git => “GitHub - expo/expo: An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.”,
:tag => “ios/1.16.2”,
:subspecs => [
“Core”,
“CPP”
]

pod ‘React’,
:path => “…/node_modules/react-native”,
:subspecs => [
“Core”,
“ART”,
“RCTActionSheet”,
“RCTAnimation”,
“RCTCameraRoll”,
“RCTGeolocation”,
“RCTImage”,
“RCTNetwork”,
“RCTText”,
“RCTVibration”,
“RCTWebSocket”,
“DevSupport”
]
pod ‘Yoga’,
:path => “…/node_modules/react-native/ReactCommon/yoga”

post_install do |installer|
installer.pods_project.main_group.tab_width = ‘2’;
installer.pods_project.main_group.indent_width = ‘2’;

installer.pod_targets.each do |target|

if target.pod_name == 'ExpoKit'
  target.native_target.build_configurations.each do |config|
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
    # needed for GoogleMaps 2.x
    config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
    config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
    config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
  end
end


# Build React Native with RCT_DEV enabled
next unless target.pod_name == 'React'
target.native_target.build_configurations.each do |config|
  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
  config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
end

end

end
end

PODFILE.LOCK

PODS:

  • Amplitude-iOS (3.14.1)
  • Analytics (3.6.1)
  • AppAuth (0.9.1)
  • Bolts (1.8.4):
    • Bolts/AppLinks (= 1.8.4)
    • Bolts/Tasks (= 1.8.4)
  • Bolts/AppLinks (1.8.4):
    • Bolts/Tasks
  • Bolts/Tasks (1.8.4)
  • Branch (0.14.12):
    • Branch/Core (= 0.14.12)
    • Branch/without-IDFA (= 0.14.12)
  • Branch/Core (0.14.12)
  • Branch/without-IDFA (0.14.12)
  • CocoaLumberjack (3.2.0):
    • CocoaLumberjack/Default (= 3.2.0)
    • CocoaLumberjack/Extensions (= 3.2.0)
  • CocoaLumberjack/Default (3.2.0)
  • CocoaLumberjack/Extensions (3.2.0):
    • CocoaLumberjack/Default
  • Crashlytics (3.8.4):
    • Fabric (~> 1.6.3)
  • ExpoKit/Core (1.16.2):
    • Amplitude-iOS (~> 3.8)
    • Analytics (~> 3.5)
    • AppAuth (~> 0.4)
    • Branch (~> 0.14.12)
    • CocoaLumberjack (~> 3.0)
    • Crashlytics (~> 3.8)
    • Fabric (~> 1.6)
    • FBAudienceNetwork (~> 4.22)
    • FBSDKCoreKit (~> 4.15)
    • FBSDKLoginKit (~> 4.15)
    • FBSDKShareKit (~> 4.15)
    • Google/SignIn (~> 3.0)
    • GoogleMaps (~> 2.2.0)
    • GPUImage (~> 0.1.7)
    • lottie-ios (~> 1.5.1)
  • ExpoKit/CPP (1.16.2):
    • ExpoKit/Core
  • Fabric (1.6.11)
  • FBAudienceNetwork (4.23.0)
  • FBSDKCoreKit (4.23.0):
    • Bolts (~> 1.7)
  • FBSDKLoginKit (4.23.0):
    • FBSDKCoreKit
  • FBSDKShareKit (4.23.0):
    • FBSDKCoreKit
  • FirebaseAnalytics (3.9.0):
    • FirebaseCore (~> 3.6)
    • FirebaseInstanceID (~> 1.0)
    • GoogleToolboxForMac/NSData+zlib (~> 2.1)
  • FirebaseCore (3.6.0):
    • GoogleToolboxForMac/NSData+zlib (~> 2.1)
  • FirebaseInstanceID (1.0.10):
    • FirebaseCore (~> 3.6)
  • Google/Core (3.0.3):
    • FirebaseAnalytics (~> 3.2)
  • Google/SignIn (3.0.3):
    • Google/Core
    • GoogleSignIn (~> 4.0)
  • GoogleMaps (2.2.0):
    • GoogleMaps/Maps (= 2.2.0)
  • GoogleMaps/Base (2.2.0)
  • GoogleMaps/Maps (2.2.0):
    • GoogleMaps/Base
  • GoogleSignIn (4.0.2):
    • GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)
    • GoogleToolboxForMac/NSString+URLArguments (~> 2.1)
    • GTMOAuth2 (~> 1.0)
    • GTMSessionFetcher/Core (~> 1.1)
  • GoogleToolboxForMac/DebugUtils (2.1.1):
    • GoogleToolboxForMac/Defines (= 2.1.1)
  • GoogleToolboxForMac/Defines (2.1.1)
  • GoogleToolboxForMac/NSData+zlib (2.1.1):
    • GoogleToolboxForMac/Defines (= 2.1.1)
  • GoogleToolboxForMac/NSDictionary+URLArguments (2.1.1):
    • GoogleToolboxForMac/DebugUtils (= 2.1.1)
    • GoogleToolboxForMac/Defines (= 2.1.1)
    • GoogleToolboxForMac/NSString+URLArguments (= 2.1.1)
  • GoogleToolboxForMac/NSString+URLArguments (2.1.1)
  • GPUImage (0.1.7)
  • GTMOAuth2 (1.1.4):
    • GTMSessionFetcher (~> 1.1)
  • GTMSessionFetcher (1.1.10):
    • GTMSessionFetcher/Full (= 1.1.10)
  • GTMSessionFetcher/Core (1.1.10)
  • GTMSessionFetcher/Full (1.1.10):
    • GTMSessionFetcher/Core (= 1.1.10)
  • lottie-ios (1.5.1)
  • React/ART (0.44.0):
    • React/Core
  • React/Core (0.44.0):
    • React/cxxreact
    • Yoga (= 0.44.0.React)
  • React/cxxreact (0.44.0):
    • React/jschelpers
  • React/DevSupport (0.44.0):
    • React/Core
    • React/RCTWebSocket
  • React/jschelpers (0.44.0)
  • React/RCTActionSheet (0.44.0):
    • React/Core
  • React/RCTAnimation (0.44.0):
    • React/Core
  • React/RCTCameraRoll (0.44.0):
    • React/Core
    • React/RCTImage
  • React/RCTGeolocation (0.44.0):
    • React/Core
  • React/RCTImage (0.44.0):
    • React/Core
    • React/RCTNetwork
  • React/RCTNetwork (0.44.0):
    • React/Core
  • React/RCTText (0.44.0):
    • React/Core
  • React/RCTVibration (0.44.0):
    • React/Core
  • React/RCTWebSocket (0.44.0):
    • React/Core
  • Yoga (0.44.0.React)

DEPENDENCIES:

  • ExpoKit/Core (from http://github.com/expo/expo.git, tag ios/1.16.2)
  • ExpoKit/CPP (from http://github.com/expo/expo.git, tag ios/1.16.2)
  • React/ART (from ../node_modules/react-native)
  • React/Core (from ../node_modules/react-native)
  • React/DevSupport (from ../node_modules/react-native)
  • React/RCTActionSheet (from ../node_modules/react-native)
  • React/RCTAnimation (from ../node_modules/react-native)
  • React/RCTCameraRoll (from ../node_modules/react-native)
  • React/RCTGeolocation (from ../node_modules/react-native)
  • React/RCTImage (from ../node_modules/react-native)
  • React/RCTNetwork (from ../node_modules/react-native)
  • React/RCTText (from ../node_modules/react-native)
  • React/RCTVibration (from ../node_modules/react-native)
  • React/RCTWebSocket (from ../node_modules/react-native)
  • Yoga (from ../node_modules/react-native/ReactCommon/yoga)

EXTERNAL SOURCES:
ExpoKit:
:git: GitHub - expo/expo: An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.
:tag: ios/1.16.2
React:
:path: …/node_modules/react-native
Yoga:
:path: …/node_modules/react-native/ReactCommon/yoga

CHECKOUT OPTIONS:
ExpoKit:
:git: GitHub - expo/expo: An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.
:tag: ios/1.16.2

SPEC CHECKSUMS:
Amplitude-iOS: 4a3c8807b2ea5369dc11e87e23825bff01e5a922
Analytics: 32f2d1e0e5499c493450192726b0b42d43606b82
AppAuth: f7d9a2ce4ffe79a62a8b0c1d0938e88d9809b846
Bolts: 8a7995239dbe724f9cba2248b766d48b7ebdd322
Branch: f63d9cf82ac09747349a73184a0b739d28781c4d
CocoaLumberjack: 9b4aed7073d242f29cc2f62068d995faf67f703a
Crashlytics: 79e236942ca1e7fc641df1feb9a275360a78ab6a
ExpoKit: ca3a4d22ba57fb01c9e03da55d48eb62bfd72cb6
Fabric: 5911403591946b8228ab1c51d98f1d7137e863c6
FBAudienceNetwork: 20a0e3d20e377dbb6708365e4c6d0711bf08ca97
FBSDKCoreKit: d7829f5a69901cd7296105328e4c3c3fc7da6518
FBSDKLoginKit: 6b92bd65f319d669d2b0730e49db495ef1660566
FBSDKShareKit: 65751c3b9937ab9d594e6c37611ecc115ceeb448
FirebaseAnalytics: e5fe8486efc01bec33f6bf82e2fa9fce4b124052
FirebaseCore: 9691ee2ade70c098d7cf92440f4303f16d83ca75
FirebaseInstanceID: b9eedd6846fb5e1f0f7279e1deaa7a7e4cf8392e
Google: 813c467362eabc11385f5a5cc9ad0cb651a58f4e
GoogleMaps: 104c418d61ab8a05dff06ed0784c25ea9d37da45
GoogleSignIn: d7ad83f13480e1f30453471d00d19b5293ac46af
GoogleToolboxForMac: 8e329f1b599f2512c6b10676d45736bcc2cbbeb0
GPUImage: 733a5f0fab92df9de1c37ba9df520a833ccb406d
GTMOAuth2: 7fc9c10f5c745f4d9850419ea88889fe3baa6b7d
GTMSessionFetcher: 30d874b96d0d76028f61fbd122801e3f030d47db
lottie-ios: f680a7c4cb7a567ecf258fde0f967913aff111b8
React: d2077cc20245ccdc8bfe1fdc002f2003318ae8d8
Yoga: a92a5d8e128905bf9f29c82f870192a6e873dd98

PODFILE CHECKSUM: 4c66ebadff4b448d43463a51605ba49477bfcf88

COCOAPODS: 1.2.1

PACKAGE.JSON

{
“name”: “bysykkel”,
“version”: “0.0.0”,
“description”: “Hello Expo!”,
“author”: null,
“main”: “main.js”,
“scripts”: {
“test”: “node node_modules/jest/bin/jest.js”
},
“jest”: {
“preset”: “jest-expo”
},
“dependencies”: {
@expo/ex-navigation”: “~3.0.0”,
@expo/react-native-fade-in-image”: “^1.0.0”,
@expo/react-native-image-gallery”: “^1.0.4”,
@expo/react-native-read-more-text”: “^1.0.0”,
@expo/react-native-touchable-native-feedback-safe”: “^1.0.0”,
@expo/samples”: “~1.0.3”,
@expo/vector-icons”: “^5.0.0”,
“axios”: “^0.16.1”,
“days”: “^1.0.2”,
“expo”: “17.0.0”,
“geolib”: “^2.0.22”,
“immutable”: “^3.8.1”,
“lodash”: “^4.16.6”,
“moment”: “^2.16.0”,
“react”: “16.0.0-alpha.6”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-17.0.0.tar.gz”,
“react-native-actionsheet”: “^2.1.0”,
“react-native-communications”: “^2.2.1”,
“react-native-scrollable-tab-view”: “GitHub - ptomasroos/react-native-scrollable-tab-view: Tabbed navigation that you can swipe between, each tab can have its own ScrollView and maintain its own scroll position between swipes. Pleasantly animated. Customizable tab bar”,
“react-native-swiper”: “^1.5.3”,
“react-native-vector-icons”: “~3.0.0”,
“react-redux”: “^5.0.4”,
“redux”: “^3.6.0”,
“redux-thunk”: “^2.2.0”,
“sentry-expo”: “^1.0.0”,
“time-js”: “0.0.5”
},
“devDependencies”: {
“jest-expo”: “0.4.0”
}
}

same issue:
Cocoapods version is 1.2.1

error: linker command failed with exit code 1 (use -v to see invocation)

Anyone working on this issue?

Make sure that you are opening proper xcode file .xcworkspace

Regards

this problem doesn’t seem to be resolved- i am getting the exact same Apple Mach-O Linker (Id) Linker command failed error. Please respond if anyone has resolved the issue

Hello! Sadly “linker command failed error” is just a generic message which indicates that any number of things could have failed when Xcode tried to link your project. Without other information, we have no way of knowing if anybody in this thread is reporting the same issue, or a variety of different issues that happen to all break the linker.

I’m going to close this particular thread since it’s very old, full of a variety of potentially unrelated problems, and more likely to cause confusion than to help anybody.

As a generic hint, here’s what I would try:

  • Make sure you’ve already run pod install and you are opening the xcworkspace file rather than the xcodeproj file.
  • Make sure you’re familiar with how Xcode works and understand where to look for your build logs. (this step is not specific to Expo.)
  • Read the rest of the build output prior to “linker command failed error”, since there will typically be a reason given in your Xcode build log.
  • Check Issues · expo/expo · GitHub for any recent, active reports similar to yours.
  • If you think you have a new problem not covered by any of the above, open a new forum thread or issue and make sure to paste your Podfile and any other error output besides the message “linker command failed”.
1 Like