After update to Xcode 12 project would no longer build.
undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DDLog", referenced from:
objc-class-ref in Bouncer.o
ld: symbol(s) not found for architecture x86_64
DDLog is defined in CocoaLumberjack. which is a dependency of FrameworkA which is a dependency of FrameworkB (the Test Project)
Podspec extract FrameworkA:
Pod::Spec.new do |s|
[...]
s.default_subspec = 'Core'
s.subspec 'Core' do |co|
co.source_files = 'FrameworkA_Objc_DependencyIssue/Classes/**/*'
co.dependency 'CocoaLumberjack', '~> 3.1'
end
end
Podspec extract FrameworkB:
Pod::Spec.new do |s|
[...]
s.source_files = 'FrameworkB_Objc_DependencyIssue/Classes/**/*'
s.dependency 'FrameworkA_Objc_DependencyIssue/Core', '~> 0.1.2'
# s.dependency 'CocoaLumberjack' # Adding direkt dependency fixes problem!
end
This setup does compile with Xcode 11.
It seems that it was a "bug" that this would compile in Xcode 11. Adding the dependency to FrameworkB solves the issue (see comment in podspec extract FramworkB of updated question)
First Way: To do that, navigate to Build Settings of your project and add Any iOS Simulator SDK with value arm64 inside Excluded Architecture
or
If you are using custom XCConfig files, you can simply add this line for excluding simulator architecture.
EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64
Second Way :
You can manually add the Excluded Architecture in your Pod project's Build Settings, but it will be overwritten when you use pod install.
In place of this, you can add this snippet to your Podfile. It will write the necessary Build Settings every time you run pod install
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings[‘EXCLUDED_ARCHS[sdk=iphonesimulator*]’] = ‘arm64’
end
end
Please try and let me know if it helps
Related
I have generated a basic react-native project and have configured the ios project to use Cocoa Pods.
The project builds fine and works with the iOS simulator when I run react-native run-ios, but if I open the project in Xcode and try to build and run on a physical device, I get the following:
ld: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework/XCTest' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using version Xcode version 10.2.1, react-native 0.59.8.
I'm new to Xcode and any ideas on how I could resolve this would be very very welcome!
Additional Info
I don't know much about Xcode configuration but I tried out disabling bitcode in the Podfile.
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
After a pod install, clean and build this resulted in another build failure with the linker complaining that it couldn't find certain files. Removing it from the podfile+clean+build resulted in the original error again.
I'm working on an IOS app and I'm using SDWebImage (v 3.8.2 installed with Cocoa Pods). When I compile I get a warning that reads:
This block declaration is not a prototype
This error refers to the line
typedef void(^SDWebImageNoParamsBlock)();
in the SDWebImageCompat.h file.
Is there a way to fix this? I tried updating the pod but this seems to be the latest version.
I'm using XCode 9.0.
inhibit_all_warnings! doesn't work for me. I add a pch file to the project, and add #pragma resolved warnings. Hope it can help you.
// Suppress warnings of framework
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#import <TheWarningPods/File.h>
#import TheWarningPods;
#pragma clang diagnostic pop
Add inhibit_warnings => true to your Podfile:
pod 'SDWebImage', :inhibit_warnings => true
Basically this will silence all warnings for the specified pod.
Alternatively, you can add inhibit_all_warnings! to the top of your Podfile to silence all warnings for all pods.
When compiling cocos2d-js for AppleTV project I receive this error:
ld: '/Users/pepa/Library/Developer/Xcode/DerivedData/GameXY-gwkkxwmtiilmalhdxfdjgqdfhedy/Build/Products/Debug-appletvos/libcocos2d
tvOS.a(bio_lib.o)' does not contain bitcode. You must rebuild it with
bitcode enabled (Xcode setting ENABLE_BITCODE) or obtain an updated
library from the vendor for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I believe that I've included only libs built for AppleTV target with bitcode enabled. But the compiler is still complaining. Is the hint to tell which library miss the bitcode in the brackets? (bio_lib.o)
If so, would you know which library it belongs to? I did not find it on my computer.
I'm using the prebuilt binaries from here: https://github.com/elvman/cocos2d-x-3rd-party-libs-bin/tree/tvos
Use next steps:
Install git, make, autoconf, automake, libtool. If you are using Homebrew this can be done by:
brew install git make autoconf automake libtool
Clone repository:
git clone https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src.git
Go to cocos2d-x-3rd-party-libs-src/build and change 2 lines in file tvos.ini:
cfg_build_release_mode="-O3 -DNDEBUG -fembed-bitcode"
cfg_build_debug_mode="-O0 -g -DDEBUG -fembed-bitcode"
Run build script:
build.sh -p=tvos --libs=curl --arch=arm64,x86_64 --mode=release
update libcurl.a crypto and ssl library
Ok for anyone coming here trying to build cocos2d-x (3.10) for iOS using Bitcode enabled. I did it, based on the answer of user1675169 ( https://stackoverflow.com/a/33969215/129202 ) but of course I replaced the os in the build.sh line, and I had to replace all of these one by one:
libtiff.a
libwebp.a
libchipmunk.a
libjpeg.a
libpng.a
libfreetype.a
It took me a while to replace each and everyone of these. Depending on what you use in your cocos2d-x project, you might need to replace other libraries as well. Probably in the end cocos2d-x 3.11 will be delivered with all of these libraries recompiled with bitcode enabled in the first place.
A recompile line could look like this:
build.sh -p=ios --libs=tiff --arch=arm64,x86_64 --mode=release
In the end I was able to precompile the whole libcocos2d with bitcode enabled. I haven't tried sending this to iTunes Connect yet but I guess it might actually work in the end.
I've just updated my App to iOS9 and Xcode 7 and after that I always get the message:
1332 duplicate symbols for architecture x86_64
I'm using cocoapods for dependencies resolution, and if I edit Pods.xcconfig I get rid of the message but I get exceptions in my application.
I also modified Podfile and included directive use_frameworks! but I still have problems with the linker.
Updating cocoapods to last version 0.39.4 didn't help either.
Thanks in advance for your help
QUICK VERSION: I have a library of code that I'm creating a Cocoapods spec file for. It needs different compiler flags based on the architecture. Is that possible?
Explanatory background:
One of the library's files contains some ARM NEON intrinsics code. For armv7 & armv7s the flags are:
s.compiler_flags = '-mfloat-abi=softfp', '-mfpu=neon', '-mcpu=cortex-a9'
The last flag causes a (totally reasonable) compile error on arm64.
Xcode supports per-architecture flags in the Build Settings area, so this has been building fine, until now when a podspec wrapper is required.
Is there a way to configure a CocoaPods spec with per-architecture flags?
One solution, I found via Can you set architecture specific Build Settings in an .xcconfig file in Xcode 4.3?, use xcconfig:
# Common flags
s.compiler_flags = '-mfloat-abi=softfp', '-mfpu=neon'
# Per-arch flags
s.xcconfig = { 'OTHER_CFLAGS[arch=armv7]' => '$(inherited) -mcpu=cortex-a9' ,
'OTHER_CFLAGS[arch=armv7s]' => '$(inherited) -mcpu=cortex-a9'}
Minor CocoaPods bug here, the $(inherited) flag double up the parameters in the Pods.xcconfig:
OTHER_CFLAGS[arch=armv7] = $(inherited) -mcpu=cortex-a9 $(inherited) -mcpu=cortex-a9
OTHER_CFLAGS[arch=armv7s] = $(inherited) -mcpu=cortex-a9 $(inherited) -mcpu=cortex-a9
I wonder if there's a more spec-friendly way to do this via the actual compiler-flags flag?