You need to add "-ldl" to LIBS resolve the dynmic linking library calls.
 
It's possible these calls could be in your -lrt which should be moved to the 
END of your LIBS.
 
 
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Mark Jones
Sent: Mon 9/27/2010 8:47 AM
To: sqlite-users@sqlite.org
Subject: EXTERNAL:[sqlite] Cross Compiling & C Interface Problem




  Good afternoon all,

This is the first time I've posted online seeking help and hope I
haven't missed anything out. I am trying to use SQLite on an embedded
system with an ARM9, running a closed proprietary Linux Real Time
Operating System (based on the 2.6 Linux kernel). At the time of
writing, I have successfully cross-compiled the SQLite binary for the
embedded system, and can execute it remotely on the target system
without a hitch.

However, my problems arise when I'm trying to write some C code to
interface with SQLite. I've included sqlite3.h (generated when I
cross-compiled SQLite) to my source code, and through my make file I
have added libsqlite3.a to my lib path.

I would normally develop on a Linux platform, but because the supplier
of the CPU gave me a disc with corrupted data (and are not responding
for requests for a new disc), I have to use their Windows XP toolchain
and thus develop on a Windows XP system. The embedded system does not
have a compiler on it or any of the GNU auto-configuration tools etc, so
I compiled the source from /sqlite-3.7.2.tar.gz/ instead of the
sqlite-amalgamation tarballs.

My code consists of a chopped down version of the sample C code in :
http://www.sqlite.org/quickstart.html. All my code does differently is
hardcodes in some test values instead of reading off the input arguments
and gives direct include call (ie #include "sqlite3.h" instead of
#include <sqlite3.h>).

I get the following error messages when attempting to compile my program :

    */cygdrive/c/Documents and Settings/boss/My Documents/sqlite cross
    compile/sqlite-eddybuild/libsqlite3.a(os_unix.o): In function
    `unixDlSym':*
    *../sqlite/src/os_unix.c:4871: undefined reference to `dlsym'*
    */cygdrive/c/Documents and Settings/boss/My Documents/sqlite cross
    compile/sqlite-eddybuild/libsqlite3.a(os_unix.o): In function
    `unixDlClose':*
    *../sqlite/src/os_unix.c:4875: undefined reference to `dlclose'*
    */cygdrive/c/Documents and Settings/boss/My Documents/sqlite cross
    compile/sqlite-eddybuild/libsqlite3.a(os_unix.o): In function
    `unixDlError':*
    *../sqlite/src/os_unix.c:4844: undefined reference to `dlerror'*
    */cygdrive/c/Documents and Settings/boss/My Documents/sqlite cross
    compile/sqlite-eddybuild/libsqlite3.a(os_unix.o): In function
    `unixDlOpen':*
    *../sqlite/src/os_unix.c:4830: undefined reference to `dlopen'*
    *collect2: ld returned 1 exit status*
    *make: *** [enst_core] Error 1*

The makefile for my C code is as follows.

    *CROSS = /opt/lemonix/cdt/bin/arm-linux-*
    *LDFLAGS += -L/opt/lemonix/cdt/lib -L/opt/lemonix/cdt/bin*
    *IFLAGS += -I/opt/lemonix/cdt/include  -I./include *
    *CFLAGS = -O2 -g  -Wall -Wno-nonnull*
    *DEST = ../../ramdisk/root/sbin *
    *DEST_ETC = ../../ramdisk/root/etc*
    *
    *
    *CC = $(CROSS)gcc *
    *STRIP = $(CROSS)strip*
    *AR = $(CROSS)ar*
    *
    *
    *TARGET = test_core*
    *
    *
    *LIBS =   -lrt SB_APIs/SB_APIs.a "/cygdrive/c/Documents and
    Settings/boss/My Documents/sqlite cross
    compile/sqlite-eddybuild/libsqlite3.a"*
    *
    *
    *all : $(TARGET)

    *
    *test_core : test_core.o*
    * rm -f $...@*
    * $(CC) $(CFLAGS) $(LDFLAGS) $(IFLAGS) -o $@ $...@.o $(LIBS)*
    * $(STRIP) $...@*
    *
    *
    *clean: *
    * rm -f *.bak *.o*
    *
    *
    *release:*
    * cp  -f $(TARGET) $(DEST)*
    * cp  -f sb_default_config $(DEST_ETC)*

I can supply the makefile for my SQLite cross-compile as well if needed.
I can't for the life of me work out where I've gone wrong or how to fix
the problem! I assume it is the way I am using the C interface. Any help
would be very much appreciated!

Thank you for your time,
Mark Jones
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to