mapbox-navigation-ios
mapbox-navigation-ios copied to clipboard
Linker error with Xcode 12 and CocoaPods 1.9.3 — building for iOS, but linking in dylib file
Progress. I can now install v1.0.0 with cocoapods without error. However I cannot build for any iOS target other than simulator. I get the error:
ld: building for iOS, but linking in dylib file (/Users/mjc/Library/Developer/Xcode/DerivedData/test-eogwsxynjracdvgsbxwkmhvsrfzy/Build/Products/Debug-iphoneos/MapboxCommon.framework/MapboxCommon) built for iOS Simulator, file '/Users/mjc/Library/Developer/Xcode/DerivedData/test-eogwsxynjracdvgsbxwkmhvsrfzy/Build/Products/Debug-iphoneos/MapboxCommon.framework/MapboxCommon' for architecture arm64
I tested this by creating a new empty Xcode project and a new Podfile:
source 'https://github.com/CocoaPods/Specs.git'
# Uncomment the next line to define a global platform for your project
platform :ios, '12.0'
inhibit_all_warnings!
target 'test' do
use_frameworks!
pod 'MapboxNavigation', '~> 1.0'
end
Using Xcode 12.0.1 pod version 1.9.3
Hi, glad to hear your making progress. This linker error looks like CocoaPods/CocoaPods#10026. Upgrading to CocoaPods 1.10.rc.1 should fix the error. Please let us know if it persists after upgrading CocoaPods.
Confirmed, cocoa pods 1.10.rc.1 fixed the problem
@1ec5 @ehmjaysee I have the same problem, installed 1.10.0.rc.1 but I still have the same problem, can build for simulator but cannot for my device
@MarcoCarnevali, did you run pod install
or pod update
after upgrading CocoaPods? I wonder if it would make any difference one way or another. Which specific Xcode version and device model are you building for? Debug or Release configuration?
Here is what I did after I upgraded to 1.10.rc.1
- Edit Podfile and comment all lines that reference anything with MapBox
- pod install (this will remove Mapbox from the project)
- rm -rf Pods Podfile.lock
- Edit Podfile and un-command all lines that reference Mapbox
- pod install
@1ec5 yes, I even deintegrated pod and re-installed from scratch. Both debug and release scheme, Xcode 12.0.1, iPhone 8 Plus with iOS 13 @ehmjaysee thank you, I’ll try and let you know but should be no difference with what I did
Are you able to build for the “Any iOS Device” target? What are the values of the following build settings in your application target (as applicable)?
-
ARCHS
-
ONLY_ACTIVE_ARCH
-
EXCLUDED_ARCHS
-
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200
@1ec5 no, can't build for Any iOS Device
either.
Values are:
Architectures
= ARCHS_STANDARD
ONLY_ACTIVE_ARCH
= YES
EXCLUDED_ARCHS
= Any iOS Simulator SDK -> arm64
Seems that I fixed it, after several different try I was able to make it work, seems that you have to pod deintegrate, remove derived data, pod install and it should work! Thank you guys
Actually little update, I can build it for my simulator and device but I cannot archive it. odd issue, archive is successfull but I can't locate it on the finder or organizer.
Seems that I fixed it, after several different try I was able to make it work, seems that you have to pod deintegrate, remove derived data, pod install and it should work! Thank you guys
Hi, I try this workaround, still not work. My error is:
Library not loaded: @rpath/MapboxCommon.framework/MapboxCommon
Referenced from: /private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Micro Mobility
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: mach-o, but not built for platform iOS
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: stat() failed with errno=25
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: mach-o, but not built for platform iOS
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: stat() failed with errno=25
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: mach-o, but not built for platform iOS
/private/var/containers/Bundle/Application/BF61D58B-AD39-4544-8AA0-614015AAD9B0/Micro Mobility.app/Frameworks/MapboxCommon.framework/MapboxCommon: stat() failed with errno=25
Do you want also my pod file?
@lfongaroScp that error is a different one I think it's better if you open a new issue
Actually little update, I can build it for my simulator and device but I cannot archive it. odd issue, archive is successfull but I can't locate it on the finder or organizer.
@MarcoCarnevali, I have the same problem as you
https://stackoverflow.com/a/63955114
This post solved the problem for me
https://stackoverflow.com/a/63955114
@Knapiii this fixed your problem with the archive?
https://stackoverflow.com/a/63955114
This post solved the problem for me
This sounds similar to the workaround we put into #2667. I suppose it’s possible that CocoaPods fails to apply the workaround sometimes, in which case it might work to deintegrate and reintegrate as in https://github.com/mapbox/mapbox-navigation-ios/issues/2674#issuecomment-703074011.
Actually little update, I can build it for my simulator and device but I cannot archive it. odd issue, archive is successfull but I can't locate it on the finder or organizer.
That’s quite strange. Does Xcode print out anything to the system console or build log related to the archive?
@1ec5 nothing there and the archive is successful. I can find it on finder but when I open it : The archive could be corrupted or unreadable
Same problem here with Cocoapods 1.10.0.rc.1 framework not found MapboxCommon
when attempting to build on the sim. Is there any way to get Mapbox to work with Cocoapods & Xc 12? Specifying the pre-release version (that supposedly has as fix) also didn't work (even after deintegrating and clearing Derived Data): pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v1.1.0-beta.1' pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v1.1.0-beta.1'
- When I try a new project with a podfile with just one entry:
pod 'MapboxNavigation', '~> 1.0'
it fails. - When I downgrade from Cocoapods 1.10.0.rc.1 to 1.9.3 for the same new project, it fails (in that case I get
framework not found MapboxMobileEvents
). - When I try to exclude arm64 it fails to build for simulator and device.
The archive could be corrupted or unreadable
By way of an update, this issue was resolved in #2677 by removing a build phase that was incompatible with CocoaPods.
When I downgrade from Cocoapods 1.10.0.rc.1 to 1.9.3 for the same new project, it fails (in that case I get
framework not found MapboxMobileEvents
).
This is expected, because of CocoaPods/CocoaPods#10026.
When I try a new project with a podfile with just one entry:
pod 'MapboxNavigation', '~> 1.0'
it fails.
This is unexpected. 😕 https://github.com/mapbox/mapbox-navigation-ios/issues/2674#issuecomment-702950955 lists some build settings; if you provide that information about your project here, it might be clearer whether the workaround is being applied correctly.
The same struggle here. The app was compiling, archiving, and working alright. Last working build is still available on Testflight https://testflight.apple.com/join/1TpdHGJ4
Then I changed package manager, from Carthage to Cocoapod.
It works in the simulator. As soon as I try the real device, I get tons of weird errors.
I have CocoaPods 1.10.rc.1
I got this:
building for iOS, but linking in dylib file Build/Products/Debug-iphoneos/MapboxCommon.framework/MapboxCommon) built for iOS Simulator, file Build/Products/Debug-iphoneos/MapboxCommon.framework/MapboxCommon' for architecture arm64
I tried this: https://stackoverflow.com/questions/24993752/os-x-framework-library-not-loaded-image-not-found
And this https://stackoverflow.com/questions/2718246/xcode-warning-multiple-build-commands-for-output-file
And this https://stackoverflow.com/questions/34433818/xcode-7-2-successful-archives-will-not-show-in-organizer-but-will-show-in-archi/45925542#45925542
@byvalentino, what Xcode version are you using, and which device were you building for? What are your values for the build settings listed in https://github.com/mapbox/mapbox-navigation-ios/issues/2674#issuecomment-702950955? For what it’s worth, we’ve gotten fewer reports of problems with Carthage, provided that you use the workaround in #2676.
what Xcode version are you using,
Xcode Version 12.0.1 (12A7300)
and which device were you building for?
iPhone 8, iOS 13.7
What are your values for the build settings listed in #2674 (comment)?
Standard architectures - $(ARCHS_STANDARD)
as for
@1ec5 no, can't build for
Any iOS Device
either. Values are:Architectures
=ARCHS_STANDARD
ONLY_ACTIVE_ARCH
=YES
EXCLUDED_ARCHS
=Any iOS Simulator SDK -> arm64
I think the workaround we applied in the podspec is supposed to clear out EXCLUDED_ARCHS
, replacing it with EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200
. My own test project ends up with:
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8
This project builds without errors in Xcode 12.0.1 and runs on an iPhone 8 device running iOS 13.7 in both the Debug and Release configurations. These are some of the cases we tested before landing the workaround in #2667, so I wonder if the issue is that the workaround isn’t being applied. Have you also tried deinit
ing and reinstall
ing the project using CocoaPods like the others above?
This linker error looks like CocoaPods/CocoaPods#10026. Upgrading to CocoaPods 1.10.rc.1 should fix the error.
If anyone has been holding off to avoid using a prerelease version of CocoaPods, v1.10.0 just came out and it includes the fix for CocoaPods/CocoaPods#10026.
My iPhone iOS devices are not working with my account please help me my iPhone 11 iPhone pro Max
Update your Xcode to 12.2 (if you are using macOS Big Sur) and install cocoapods version 1.10.rc.1. It will fix the error.
Problem alive and kicking for me. It started with Xcode 12, macOS Catalina, Cocoapods 1.10.rc.1, and Mapbox for native iOS (thanks @1ec5). https://github.com/mapbox/mapbox-navigation-ios/issues/2674#issuecomment-708057307
Then, it continued with Xcode 12.2, macOS Big Sur, Cocoapods --pre, and Mapbox for Native React. https://github.com/CocoaPods/CocoaPods/issues/10135#issuecomment-730722345
Tried all these https://stackoverflow.com/questions/34433818/xcode-7-2-successful-archives-will-not-show-in-organizer-but-will-show-in-archi/45925542#45925542
Now the project compiles and runs only on a real device, not on iOS simulator. Builds are successful when archiving; however, the generated archive is corrupted and it does not show in the Organizer, thus the App can't be distributed on Appstore.
Just removing the following link from Podfile fixes the problem of corrupted Archives, but the App results amputated, as it no longer includes the Map.
pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps'
If you’re using CocoaPods and your application target has a custom value for the EXCLUDED_ARCHS
build setting in any configuration, chances are that that build setting is causing any linker errors you’re seeing (and presumably any missing bits in the archive). In https://github.com/mapbox/mapbox-gl-native-ios/pull/549#issuecomment-732638768, I found that even having the build setting set to a blank value is problematic, because it overwrites the build setting that the podspec tries to apply. If this build setting is specified but you don’t remember needing to tweak it for application-specific reasons, try deleting the build setting.
We just hotfixed the map SDK v6.2.2 and v6.3.0 podspecs on CocoaPods trunk to address another linker error that could occur, but you may need to wipe your CocoaPods caches to obtain the fix: https://github.com/mapbox/mapbox-gl-native-ios/pull/549#issuecomment-733822435.
I found a fix that is an abomination, but it works. At the same time, since it works, the problem seems simple. How to fix it? https://stackoverflow.com/questions/64933102/xcode-builds-successfully-a-corrupted-archive-not-showing-in-organizer-as-soon/64989153#64989153