Library not found for -lpj-arm-apple-darwin9 [duplicate] - ios

This question already has answers here:
How can I "add existing frameworks" in Xcode 4?
(10 answers)
Closed 8 years ago.
I downloaded pjsip source code from online.It is running without any error.But, I integrated openssl lib and include file into that pjsip > ipjsua xcode project.After compiled xcode project, am getting library not found error and warning like below,
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../pjlib/lib"'
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../pjlib-util/lib"'
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../pjmedia/lib"'
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../pjnath/lib"'
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../pjsip/lib"'
ld: warning: directory not found for option '-L"/Users/aahlaad/Desktop/swyxpjsip/iospj2/pjproject-2.2.1/pjsip-apps/src/pjsua/ios/../../../../third_party/lib"'
ld: library not found for -lpj-arm-apple-darwin9
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Delete your derived Data and
Go to Project->Build Settings->Search Paths
and remove everything from Framework/Header/Library Search Path respectively and add your frameworks again in Project -> General ->Linked Frameworks and Libraries

ld: library not found for -lpj-arm-apple-darwin9
Here's how to add headers and libraries under Xcode. Its shows how to add OpenSSL, but in your case, do the same for PJSIP.
Headers:
Libraries:
If your PJSIP library has both static archives and shared objects, then delete the shared objects. Even though iOS only allows static linking, Xcode will still link against a shared object if available. Apparently, the Xcode developers did not get the memo.
If you need help adding the PJSIP library to Xcode so it shows up under Frameworks and Libraries, then see How to “add existing frameworks” in Xcode 4?.
If you get the PJSIP library added but are missing architectures, you can use the following to see what's in the fat library:
$ xcrun -sdk iphoneos lipo -info /usr/local/ssl/ios/lib/libcrypto.a
Architectures in the fat file: libcrypto.a are: armv7 armv7s arm64 i386
Ideally, you will have the four architectures: ARMv7, ARMv7s, ARM64 and i386. i386 is for debug builds under the simulator.
If you are missing an architecture, then you should re-build the library with the missing architecture, and then use lipo to combine the different architectures into a single fat library.

Related

linker error while linking to arm64 library on Xcode

I'm trying to build my project for arm64. This project requires an arm64 libcrypto.a. I'd like to know if I'm missing any settings. Thanks in advance...
The error I see is:
ld: warning: ignoring file /Users/Amy/Desktop/swift_proj/swift_proj/include/libcrypto.a, file was built for archive which is not the architecture being linked (x86_64): /Users/Amy/Desktop/swift_proj/swift_proj/include/libcrypto.a
My project settings are shown below:
Architectures: arm64
Base SDK: Latest iOS(iOS 11.4)
Build Active Architecture Only: No
Supported Platforms: iOS
Valid Architectures: arm64
I've updated "RequiredDeviceCapabilities" in info.plist to arm64.
I've checked the type of library I'm trying to link with:
[Amys-MacBook-Air:include$ lipo -info libcrypto.a
input file libcrypto.a is not a fat file
Non-fat file: libcrypto.a is architecture: arm64
I fail to understand why the error says the project is being built for x86_64.
Looks like OpenSSL has some issues with multi-arch builds that you need to address for it to work, the answer here Build Multiarch OpenSSL on OS X should help.
Essentially, you'll have to replace a couple of the OpenSSL header files that include the architecture-specific header using #ifdef to check the system architecture at compile time. Do this after building OpenSSL from source for each target that you want. Then you'll be able to use the lipo tools to combine each target's static library build for OpenSSL into one static library, then use that.

missing required architecture x86_64 in ...libMumbleKit.a (3 slices)

I am trying to include MumbleKit as a library instead of having to compile it each time by following the suggestion of a member of this forum. Yet when I try to compile on the simulator I get:
missing required architecture x86_64 in …libMumbleKit.a (3 slices)
I think I added all the necessary versions to MumbleKit before generating the library:
arm64 armv7 armv7s armv7k arm7s x86_64 i386
notwithstanding, when I execute:
lipo -info libMumbleKit.a
I get:
Architectures in the fat file: libMumbleKit.a are: armv7 armv7s arm64
as well as configuring Build Active Architecture to NO.
I generated the library for MumbleKit both using the Generic iOS device and a iOS 9 physical device.
When I try to archive using the Generic iOS Device option after having extracted the Mumble library in the same way, I instead get error:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
armv7
Same when using my physical device after also generating the library in the correspondent way:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
arm64
And finally the installation on my iOS 9 iPhone 6S went fine with just the same contents in the warning:
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(CryptState.o)' was
built without full bitcode. All object files and libraries for bitcode
must be generated from Xcode Archive or Install build for architecture
arm64
CryptState.cpp if a c++ file in the library.
Check architectures it has with lipo tool. Open terminal, navigate to folder where your library is and do:
lipo -info yourlib.a
If you don't have x86_64, than you should find/compile lib that will have it.
x86_64 is an architecture for Simulator, not for generic iOS device.
I applied the suggestion at:
Xcode 7 'CrashReporter does not contain bitcode' linker error
by adding option -fembed-bitcode to the other linker flags field. And now the problem has moved to a c file: band.c, notwithstanding of course I have added this option for the c and c++ files.
ld: bitcode bundle could not be generated because
'/Users/fbartolom/Documents/cocoa
applications/inArrivoHD/MumbleKit/libMumbleKit.a(bands.o)' was built
without full bitcode. All object files and libraries for bitcode must
be generated from Xcode Archive or Install build for architecture
arm64
What might be still missing?
I aborted the attempt. There must be something faulty in the original mumble kit project not allowing to import its library into another project, or I do not know how to do it anyway.

XCode 6.1 Missing required architecture X86_64 in file for extern library

I have an issue when trying to use an external lib : I can't compile the project as it throws an exception as below.
ld: warning: ignoring file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a, missing required architecture x86_64 in file /Users/renaudcousin/Documents/XCode/WORK/StimShopPOC/StimShopPOC/libStimshop_SDK.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_StimshopSDK", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`
I tried lots of solutions found on stackoverflow (but for XCode 5.1 and not as well explained) without any change ...
I also found this topic XCode 6.1 Missing required architecture X86_64 in file that exactly correspond to my problem and
when looking at my lib's architecture with lipo -info command, it seems it's missing i386 and x86_64. How could I add them to my library architectures to be able compile ?
This means your .a library doesn't contain the x86_64 architecture (You can run lipo -info /path/to/your/lib.a to verify it). If you don't have the source code of the library, you have to modify your own project. In the build settings, change the valid architectures to armv7 and i386, or change Architectures to armv7 only. However, by doing so, your project won't be compiled to the arm64 architecture, which is required when uploading to the App Store after Feb 2015, according to Apple's announcement.
If your library doesn't contain x86_64 architecture, it is likely that it doesn't contain arm64 either. So you should avoid using old libraries.
If a library doesn't have the X86_64 architecture you can build it if you've picked a connected device rather than a simulator for your build target.
Basically, you can still build and develop but you can't use the simulator.
Click on your project > build setting > architecture. Change architecture as armv7 and delete others like armv6,etc, Then it will work :-
In the project that builds libStimshop_SDK.a, be sure the "Architectures" setting is set to $(ARCHS_STANDARD) and that it includes 64-bit settings in the compiler settings. Be sure the "Valid Architectures" setting includes 64-bit as well.

Xcode : Apple Mach-O linker Error

I made the app in Xcode 4.6 and tested in device. The app is made for both iPhone and iPad. When I try to archive it to make .ipa file, I get this error :
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/admin/Desktop/appName/appName/libzbar.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to set the architecture for this in Build Settings? Or is there some different issue?
libzbar.a library needs to be built for armv7s architecture. If you cannot do that (because you don't have source code for this library) than you should remove armv7s from valid architectures.
You can change valid architectures by following steps:
select project name from the Project Navigator
select project target
open Build Settings tab
change valid architectures field

error when including my static library in an iOS project

I'm trying to include a static library in an iOS project.
I imported the .a file and every .h related but then I'm getting this error :
ld: warning: ignoring file /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace- cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos/libPlazappPartnerLib.a, file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_LauncherViewController", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I guess there's a problem of architecture type but I don't understand why nor how to solve it.
Can someone explain it to me and tell me how to solve it? Thanks!
It seems your library was built to run in the device (arm architecture) and you try to use it in the simulator (i386 architecture). Check your library build settings. They should match with your project build settings.
Or even better, create a fat library for development purposes. lipo command is your friend.
To verify the current architectures present in your library: (in Terminal)
cd <path to library folder> # in you case: /Users/alexis/Library/Developer/Xcode/DerivedData/PlazappPartnerWorkspace- cdrmloavlcqouugawmtqywiinqne/Build/Products/Debug-iphoneos
lipo -info libPlazappPartnerLib.a
The output should look like:
Architectures in the fat file: libPlazappPartnerLib.a are: armv6 armv7
They should match with the target device or simulator you are building for.

Resources