I'm even newer to Linux so I'm a bit confused when you mention that I need to recompile the lib file. How should I go about recompiling and test that out? It just seems weird to me that gcc is able to compile this, but arm-linux-gcc is not. could it be that arm-linux-gcc was setup incorrectly? I followed the directions from sqlite on cross compiling and I believe i set up arm-linux-gcc correctly (or not!). Thanks to everyone helping me out!
On 7/11/06, David Bicking <[EMAIL PROTECTED]> wrote:
Your problem is that your copy of libsqlite.a is incompatible. Being a relative newbie too, I had a similar problem, but not with sqlite, and I had to recompile the lib file. After that, I was able to build my program. Perhaps you need to grab the source to sqlite and use arm-linux-gcc to compile it in to a library file. David On Tue, 2006-07-11 at 20:16 -0700, Keiichi McGuire wrote: > still no luck:( > and yea I'm still a bit new to C. I have a few years experience in C during > school, but mainly used for microcontrollers, so I've done a very little > amount of system applications. > > anyways, with the pointer added to the errMsg, as well as the -lsqlite > switch, i get the following: > > [EMAIL PROTECTED]:~/dev/c$ arm-linux-gcc test.c -o test6 > /tmp/ccSgrZe2.o(.text+0x30): In function `main': > : undefined reference to `sqlite_open' > collect2: ld returned 1 exit status > [EMAIL PROTECTED]:~/dev/c$ arm-linux-gcc test.c -o test6 -lsqlite > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: > s kipping incompatible > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/libsqlite. so when > searching for -lsqlite > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: > s kipping incompatible > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/libsqlite. a when searching > for -lsqlite > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: > c annot find -lsqlite > collect2: ld returned 1 exit status > > this is making my brain hurt! :( > > > > On 7/11/06, John Stanton <[EMAIL PROTECTED]> wrote: > > > > Your program should look more like this - > > > > sqlite *db; > > char *errmsg = NULL; /*Ptr to possible error message.*/ > > > > int main() { > > printf("Hello!\n"); > > db = sqlite_open("sqlitetest", 0660, &errmsg); > > > > /*At this point if you get an error errmsg will not be null > > and will point to the error message. It will have malloc'd > > memory for that message so you need to "free" it or suffer > > a memory leak.*/ > > if (errmsg != NUL) { > > ... > > } > > ..... > > } > > > > I guess you are new to C. It will get easier. The first ten years are > > the hardest. > > > > Keiichi McGuire wrote: > > > Hi John, > > > I still get an error when i use the -lsqlite switch. When i take that > > > out it > > > says: > > > incompatible types in assignment > > > passing arg 3 of 'sqlite_open' from incompatible pointer type > > > > > > also I wanted to use v.3, but i'm working on a system where the disk > > space > > > is limited to 64megs, and i actually got the v2 from an ipkg package, > > and > > > there was an sqlite3 package available, but it was not compatible with > > php > > > that is on this system. > > > > > > -Keiichi > > > > > > On 7/11/06, John Stanton <[EMAIL PROTECTED]> wrote: > > > > > >> > > >> Keiichi McGuire wrote: > > >> > Hi everyone, > > >> > I'm still a bit new to sqlite and also to crosscompiling programs. > > >> > I've been having problems with being able to compile this test c > > >> program > > >> > that should just connect to the database. > > >> > > > >> > My program looks like this: > > >> > > > >> > #include<stdio.h> > > >> > #include"sqlite.h> > > >> > > > >> > int main() > > >> > { > > >> > > > >> > printf("Hello!\n"); > > >> > sqlite *db; > > >> > char errMsg; > > >> > errMsg = NULL; > > >> > > > >> > db = sqlite_open("sqlitetest",0660,&errMsg); > > >> > > > >> > return 0; > > >> > } > > >> > > > >> > > > >> > and I get the following error: > > >> > > > >> > [EMAIL PROTECTED] dev]# arm-linux-gcc test.c -o test4 -L > > >> > /home/kmcgui/sqlite-arm/.lib > > >> > > > >> > s/ -lsqlite tesc: In function `main': > > >> > test.c:9: warning: assignment makes integer from pointer without a > > cast > > >> > test.c:11: warning: pabssing arg 3 of qlite_open' from incompatible > > >> pointer > > >> > type > > >> > > > >> > > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3l.3.2/../../../.m-linux/biin/ld: > > >> > > >> > > > >> > skipping mpatible /home/kmcgui/sqlite-arm/.flibs//libsqliteso when > > >> > senarching for > > >> > > > >> > > -ls/local/armi/3.3.2/lib/gcc-e/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: > > >> > > >> > > > >> > skipping incompatible > > >> > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/libsqlite.a when > > >> > searlching > > >> > for -lsqle > > >> > > > >> > > /usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: > > >> > > >> > > > >> > cannot find -lsqlite > > >> > collect2: ld rxeturned 1 exit s > > >> > > > >> > thank you in advance!!! > > >> > > > >> > > > >> > -Keiichi > > >> > > > >> Try declaring errMsg as a character array rather than a character, > > >> > > >> char errMsg[256]; > > >> > > >> Arg3 3 of sqlite_open is of type char **. > > >> > > >> Note that you are using Sqlite V2. If you are starting a new project > > >> you might find using Sqlite V3 from the beginning a good idea. > > >> > > > > > > >