iOS Question third party lib questions

Ju Yang

Active Member
Licensed User
Longtime User
hello, I follow the tutorial and make a lib, when I use it in B4I, I got a build error:

Ld Payload/result.app/result normal armv7
cd /Users/administrator/Documents/UploadedProjects/<user id>
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk -L/Users/administrator/Documents/UploadedProjects/<user id>/Payload -L../../Libs -F/Users/administrator/Documents/UploadedProjects/<user id>/Payload -F../../Libs -filelist /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/result.LinkFileList -miphoneos-version-min=7.0 -ObjC -fobjc-arc -fobjc-link-runtime -lCore -framework Foundation -framework CoreGraphics -framework UIKit -liTableView -liMedia -liHttp -liJSON -liStringUtils -liBarcode -liHUD -liRandomAccessFile -lb4i_alipay -framework AVFoundation -lz -framework AlipaySDK -framework Foundation -framework QuartzCore -framework UIKit -framework CFNetwork -framework CoreGraphics -framework CoreMotion -framework CoreTelephony -framework CoreText -framework SystemConfiguration -lCore -lc++ -liDebug2 -Xlinker -dependency_info -Xlinker /Users/administrator/Documents/UploadedProjects/<user id>/build/B4iProject.build/Release-iphoneos/B4iProject.build/Objects-normal/armv7/result_dependency_info.dat -o /Users/administrator/Documents/UploadedProjects/<user id>/Payload/result.app/result
ld: library not found for -lb4i_alipay
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I reference some issues and can't find the problem, did I make mistakes by create the lib or did I use it the wrong way? thanks very much

I'v checked the project in the object folder, the project contains the libb4i_alipay.a, but I got error above

I have done the following steps:
first, import the third party lib and it's depending framewrok, bundle into the project( including some .h/.m files and Util, openssl folders)
then I set the search path into the macserver/Libs folder, import iCore.h File ,and write code like this:

[[AlipaySDK defaultService] payOrder: orderString fromScheme:appScheme callback:^(NSDictionary *resultDic) {
NSLog(@"reslut = %@",resultDic);
}];

then after generating a libb4i_alipay.lib , I use B4Ih2xml.jar and get a xml,
I put I into B4I project, but when I send It to server to builder the code , I get the error I first post

#import "iCore.h"

//~dependsOn:AlipaySDK.framework.3
//~dependson:Foundation.framework
//~dependson:QuartzCore.framework
//~dependson:UIKit.framework
//~dependson:CFNetwork.framework
//~dependson:CoreGraphics.framework
//~dependson:CoreMotion.framework
//~dependson:CoreTelephony.framework
//~dependson:CoreText.framework
//~dependson:SystemConfiguration.framework
//~dependson:libCore.dylib
//~dependson:libz.dylib
//~dependson:libc++.dylib
//~event: Finished
//~version:1.00
 
Last edited:

Ju Yang

Active Member
Licensed User
Longtime User
further more: I build the xproject under Object folder, and it says:

ld: warning: ignoring file ../../Libs/libb4i_alipay.a, file was built for archive which is not the architecture being linked (i386): ../../Libs/libb4i_alipay.a
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_alipayWrapper", referenced from:
objc-class-ref in b4i_mepagecontroller.o
ld: symbol(s) not found for architecture i386
clang: error: linker comman
 
Upvote 0

Ju Yang

Active Member
Licensed User
Longtime User
I have checked the architecture of the lib, it says
: Architectures in the fat file: libb4i_alipay.a are: armv7 arm64
but It still shows the same error, I build the project under Object folder, it still gets the same error after I import the libs,

detail:
ld: warning: ignoring file ../../Libs/libb4i_alipay.a, missing required architecture i386 in file ../../Libs/libb4i_alipay.a (2 slices)

Undefined symbols for architecture i386:

"_OBJC_CLASS_$_alipayWrapper", referenced from:

objc-class-ref in b4i_mepagecontroller.o

ld: symbol(s) not found for architecture i386

confuse about that, did I ignore some settings?
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
Later you will need to compile to armv7 and arm64 and use lipo to combine the three architectures to a single library.
Like Erel already said you have to use lipo to create a fat library.
Compile your Xcode project with the device SDK and the simulator SDK and then use the lipo command line tool to combine the lib files:
B4X:
lipo -create libDevice.a libSimulator.a -output libFat.a
 
Upvote 0

Ju Yang

Active Member
Licensed User
Longtime User
yes I have mixed it... thanks ,but I get another error,

Undefined symbols for architecture i386:

"_BIO_ctrl", referenced from:

_rsa_sign_with_private_key_pem in libb4i_alipay.a(openssl_wrapper.o)


an error from the depending lib's depend, what can I do?
 
Upvote 0

Ju Yang

Active Member
Licensed User
Longtime User
Like Erel already said you have to use lipo to create a fat library.
Compile your Xcode project with the device SDK and the simulator SDK and then use the lipo command line tool to combine the lib files:
B4X:
lipo -create libDevice.a libSimulator.a -output libFat.a
thanks, and I have done that, see above
 
Upvote 0

JanPRO

Well-Known Member
Licensed User
Longtime User
and I have done that
But probably you have done something wrong, because like you already said your library just includes armv7 and arm64 architecture
Architectures in the fat file: libb4i_alipay.a are: armv7 arm64

an error from the depending lib's depend, what can I do?
Check also the architecture of depending libs, if they don't include the i386 architecture you are also not able to use the final lib with the simulator ...
 
Upvote 0

Ju Yang

Active Member
Licensed User
Longtime User
But probably you have done something wrong, because like you already said your library just includes armv7 and arm64 architecture

Check also the architecture of depending libs, if they don't include the i386 architecture you can also doesn't use the final lib with the simulator ...

..yes you are right , another problem? but I can't find it out with the error post by compiler? I can't find it out....crazy ing
 
Upvote 0

Similar Threads

Top