iOS Question Library development error: x86_64 symbols not found

Jack Cole

Well-Known Member
Licensed User
Longtime User
I have been trying to develop a library for b4i to do crash reporting. I'd rather pay someone else to do it, but I'm wondering if there is anyone doing wrappers for b4i (other than Erel). Anyway, I keep running into the same wall when trying to run an app using wrappers that I have written.

ld: symbol(s) not found for architecture x86_64

Here is the most recent one:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Crittercism", referenced from:
objc-class-ref in libmwApteligent.a(mwApteligent.o)
ld: symbol(s) not found for architecture x86_64

I'm trying to run this on the simulator. I get similar error for an actual device:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_mwApteligent", referenced from:
objc-class-ref in b4i_main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think I could probably figure it out if I had an up-to-date library source. The one in the forum for iAdmob is old and won't work with the current SDK framework. I would really appreciate any insight into this problem or working source code for an example wrapper library.

Thank you in advance.
 

JordiCP

Expert
Licensed User
Longtime User
Seems that (at least) one of the static libraries you are using is not built for that architecture.

From your terminal, in the folder where these libs are located, type

lipo -info libmwApteligent.a

This will show the achitecture(s) of that library.
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Ok. I suppose that your library references other libs or frameworks and '_Crittercism' symbol is defined in one of them? Perhaps it is those libs that aren't built for that architecture.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
You need to compile a static library twice.
First compile for Generic IOS device. Another for any simulator. Then combine two variants using lipo -create.
For example, lipo -create path1 path2 -output path

As I remember, I set architecture in build settings also. Final .a supported all 4 platforms arm64 armv7 x86_64 i386
 
Last edited:
Upvote 0

Jack Cole

Well-Known Member
Licensed User
Longtime User
First compile for Generic IOS device. Another for any simulator.

How do you do that? I don't see any such options.

Ok. I suppose that your library references other libs or frameworks and '_Crittercism' symbol is defined in one of them? Perhaps it is those libs that aren't built for that architecture.

That symbol is defined in the header and referenced in the .m file that I created. I am not including any binary libs.

Note that if it is a swift library then it will not work on the simulator anyway.

Good to know. In this case, they are not swift libraries and I have the problem with both the simulator and real device.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Ok, step by step. Let's take Erel's sample. Unlike my description is long, a process requires 5 minutes.


Download libraries.zip, extract files, move iAdMob folder to desktop.
Click iAdMob. Inside you will see iAdMod.xcodeproj. Click it (this starts XCode).

First of all, open Build Settings for project and correct:
1) Architectures -- Architectures
Select standard architectures instead of armv7.
2) Architectures -- Valid architectures
Enter arm64 x86_64 armv7 i386
3) Deployment -- IOS Deployment Target
Select IOS 8.0

Then open Build Phases for Target iAdMob
Remove copy items (we will use another pathes).

Take a look a tree with files. Add file iCore.h from your Libs and remove previous link.

Take a look top left corner of XCode window. Click 'iAdMob', 'Edit schemes'. Select 'Release' for Run button (an icon as a big arrow
Then select Generic IOS device as target device ('combobox' near 'iAdMob'). Click Run button.

Find 'Products' section in the tree of files. Right click over libiAdMob.a. Select 'Show in Finder'. You will see a file. Rename it to libiAdMob1.a and move it to Desktop.

Change Generic IOS device to (for example) iPhone 11 Pro Max and compile again. Rename libiAdMob.a to libiAdMob2.a and move it to Desktop

Start app Terminal. Type
B4X:
cd ~/Desktop
lipo -create libiAdmob1.a libiAdmob2.a -output libiAdmob.a

Check platforms
B4X:
lipo -info libiAdmob.a
The answer should be
B4X:
Architectures in the fat file: libiAdmob.a are: i386 armv7 x86_64 arm64

Then you copy libiAdmob.a and iAdMob.h to Libs folder.
 
Upvote 0
Top