B2G Compilation error on Mac OS X

On Mac OS X 10.7 or newer, with Xcode 4.5 or newer, if you ran into this compilation error:

host Executable: sqlite3 (out/host/darwin-x86/obj/EXECUTABLES/sqlite3_intermediates/sqlite3)
Undefined symbols for architecture i386:
  “_sqlite3_androidopt_handle_pragma”, referenced from:
      _sqlite3Pragma in sqlite3.o
      _sqlite3Pragma in sqlite3.o
  “_sqlite3_androidopt_open”, referenced from:
      _openDatabase in sqlite3.o
      _openDatabase in sqlite3.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make: *** [out/host/darwin-x86/obj/EXECUTABLES/sqlite3_intermediates/sqlite3] Error 1

Modify the file :
/external/sqlite/dist/Android.mk

To match what is similar to this patch:

diff –git a/dist/Android.mk b/dist/Android.mk

index 3fdaefc..3f217c5 100644
— a/dist/Android.mk
+++ b/dist/Android.mk
@@ -133,6 +133,9 @@ ifneq ($(HOST_OS),freebsd)
 LOCAL_LDLIBS += -ldl
 endif
 endif
+ifeq ($(HOST_OS),darwin)
+LOCAL_LDFLAGS += -Wl,-U,_sqlite3_androidopt_open -Wl,-U,_sqlite3_androidopt_handle_pragma
+endif
 
 LOCAL_MODULE := sqlite3
A good explanation of what’s going on can be found here:
Special thanks to : Pekka Nikander for posting the solution at : https://groups.google.com/forum/#!msg/android-building/yAfPyUqCsiQ/7zvICk4GWjYJ
[update: https://bugzilla.mozilla.org/show_bug.cgi?id=898660 filed and I placed a patch in there]
Advertisements

About shizen008

Breaking things and getting in trouble for it since '74. Disclaimer: I am not responsible if I make your head explode reading this blog! The writings here are my own expression and not of any companies. I currently work on being a QA for B2G aka Firefox OS
This entry was posted in B2G, Gaia, Planet, QA, QMO and tagged , , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s