3

I want to integrate the Aviary SDK Objective-C library into Monotouch project. I use 'Monotouch Binding Project' template for this. So I have created the API Definition file and define LinkWith Attributes.

[assembly: LinkWith ("libAviarySDK.a", LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true, IsCxx = true, Frameworks="CoreGraphics QuartzCore Accelerate StoreKit CoreData", LinkerFlags="-ObjC -all_load -fobjc-arc")]

It requires the following libraries:

  • Foundation.framework
  • UIKit.framework
  • CoreGraphics.framework
  • QuartzCore.framework
  • Accelerate.framework
  • StoreKit.framework
  • libz.1.2.5.dylib
  • libsqlite3.0.dylib
  • CoreData.framework

All these frameworks are linked without problems except the libsqlite3.0.dylib

The problem that I am encountering, though, is that the library depends on libsqlite3.0.dylib and I do not know how to include these frameworks in my MonoTouch application.

In a result - compiler returns the following errors:

/Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib -u _catch_exception_raise -force_load /var/folders/2n/ql7wkht57cg8wfgzz0cr9trm0000gn/T/tmp31d0b99b.tmp/libAviarySDK.a -ObjC -all_load -fobjc-arc

Undefined symbols for architecture i386:

"_sqlite3_open", referenced from: -[AFLocalyticsDatabase init] in libAviarySDK.a(AFLocalyticsDatabase.o)

"_sqlite3_busy_timeout", referenced from: -[AFLocalyticsDatabase init] in libAviarySDK.a(AFLocalyticsDatabase.o)

"_sqlite3_exec", referenced from: -[AFLocalyticsDatabase beginTransaction:] in libAviarySDK.a(AFLocalyticsDatabase.o)

* And many other same references *

ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status

mtouch exited with code 1

Shturman
  • 85
  • 5
  • In case you are using sharpie to generate from cocoapods, you can take a look at this: http://stackoverflow.com/questions/29752620/linking-libz-dylib-and-libsqlite3-dylib-in-xamarin-ios-project/39307966#39307966 – Bjørn Egil Sep 03 '16 at 14:33

1 Answers1

6

Try adding -lsqlite3.0 to your LinkerFlags for your binding to instruct the (native) linker to load the SQLite library (and symbols).

[assembly: LinkWith ("your_lib.a", LinkTarget.ArmV7, ForceLoad = true, LinkerFlags="-lsqlite3.0")]
Frederic
  • 2,034
  • 3
  • 18
  • 22
poupou
  • 43,413
  • 6
  • 77
  • 174
  • I too am working to link in Aviary - could you provide some details about how you got this working? – Rick Aug 26 '12 at 18:01