Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Ow! I'm stupid it's sqlite3 not sqlite
Thank you to all for your help 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Robert Myers
Envoyé : jeudi 12 avril 2012 18:15
À : sqlite-users@sqlite.org
Objet : Re: [sqlite] error compilation with Sqlite in C program

On 4/12/2012 11:07 AM, Sako Youssouf wrote:
> Here my step and the result.
>
> # gcc -c sqlite3.c
> # ar -rvs libsqlite3.a sqlite3.o
> ar: creating libsqlite3.a
> a - sqlite3.o
>
> # gcc -L. -lsqlite -L/usr/lib/ -ldl -lpthread -o compil compil.c

Here's your problem. You want -lsqlite3

> /tmp/ccfdSnPR.o: In function `main':
> compil.c:(.text+0xc3): undefined reference to `sqlite3_open'
> compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg'
> compil.c:(.text+0x101): undefined reference to `sqlite3_close'
> compil.c:(.text+0x138): undefined reference to `sqlite3_exec'
> compil.c:(.text+0x16d): undefined reference to `sqlite3_free'
> compil.c:(.text+0x179): undefined reference to `sqlite3_close'
> collect2: ld a retourné 1 code d'état d'exécution
>
> compil.c :
>
> 01  #include
> 02  #include
> 03
> 04  static int callback(void *NotUsed, int argc, char **argv, char 
> **azColName){
> 05int i;
> 06for(i=0; i<argc; i++){
> 07  printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
> 08}
> 09printf("\n");
> 10return 0;
> 11  }
> 12
> 13  int main(int argc, char **argv){
> 14sqlite3 *db;
> 15char *zErrMsg = 0;
> 16int rc;
> 17
> 18if( argc!=3 ){
> 19  fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
> 20  return(1);
> 21}
> 22rc = sqlite3_open(argv[1],);
> 23if( rc ){
> 24  fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
> 25  sqlite3_close(db);
> 26  return(1);
> 27}
> 28rc = sqlite3_exec(db, argv[2], callback, 0,);
> 29if( rc!=SQLITE_OK ){
> 30  fprintf(stderr, "SQL error: %s\n", zErrMsg);
> 31  sqlite3_free(zErrMsg);
> 32}
> 33sqlite3_close(db);
> 34return 0;
> 35  }
> ___
> 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
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Here my step and the result.

# gcc -c sqlite3.c
# ar -rvs libsqlite3.a sqlite3.o 
ar: creating libsqlite3.a 
a - sqlite3.o 

# gcc -L. -lsqlite -L/usr/lib/ -ldl -lpthread -o compil compil.c 
/tmp/ccfdSnPR.o: In function `main': 
compil.c:(.text+0xc3): undefined reference to `sqlite3_open' 
compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg' 
compil.c:(.text+0x101): undefined reference to `sqlite3_close' 
compil.c:(.text+0x138): undefined reference to `sqlite3_exec' 
compil.c:(.text+0x16d): undefined reference to `sqlite3_free' 
compil.c:(.text+0x179): undefined reference to `sqlite3_close' 
collect2: ld a retourné 1 code d'état d'exécution

compil.c :

01  #include 
02  #include 
03  
04  static int callback(void *NotUsed, int argc, char **argv, char **azColName){
05int i;
06for(i=0; i

Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Same error with -s argument with or without the shell.o in the archive.

there have it other way to use Sqlite in a C program ?

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Stephan Beal
Envoyé : jeudi 12 avril 2012 17:33
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with Sqlite in C program

On Thu, Apr 12, 2012 at 5:31 PM, Sako Youssouf <
youssouf.s...@renault-trucks.com> wrote:

> Others ideas?
>

Can you paste in the last thing (or two) you tried? You might also try
passing -s to ar (it's equivalent to calling ranlib, from what i
understand).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
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


Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Michael I rebuild library and after I done the "ranlib" step but the same error 
occur!

Stephan I tried the change that you propose but the same error occur!

Others ideas?


-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : jeudi 12 avril 2012 17:17
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with Sqlite in C program

You're missing a step in your library build.



ranlib libsqlite.a





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Thursday, April 12, 2012 10:10 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] error compilation with Sqlite in C program

Yes that what I tried but as you can see below when I do that, the first error 
reappear.

root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# ar -rv 
libsqlite.a sqlite3.o
ar: creating libsqlite.a
a - sqlite3.o
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc 
-L/home/y_sako/Documents/sqlite-amalgamation-3071100/ -lsqlite -L/usr/lib/ -ldl 
-lpthread -o compil compil.c
/tmp/cc7IDdvz.o: In function `main':
compil.c:(.text+0xc3): undefined reference to `sqlite3_open'
compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg'
compil.c:(.text+0x101): undefined reference to `sqlite3_close'
compil.c:(.text+0x138): undefined reference to `sqlite3_exec'
compil.c:(.text+0x16d): undefined reference to `sqlite3_free'
compil.c:(.text+0x179): undefined reference to `sqlite3_close'
collect2: ld a retourné 1 code d'état d'exécution

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Stephan Beal
Envoyé : jeudi 12 avril 2012 17:06
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with Sqlite in C program

On Thu, Apr 12, 2012 at 5:00 PM, Sako Youssouf <
youssouf.s...@renault-trucks.com> wrote:

> compil.c:(.text+0x6f): multiple definition of `main'
>

Remove shell.o from your libsqlite.a.

--
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
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
___
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


Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Yes that what I tried but as you can see below when I do that, the first error 
reappear.

root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# ar -rv 
libsqlite.a sqlite3.o 
ar: creating libsqlite.a 
a - sqlite3.o 
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc 
-L/home/y_sako/Documents/sqlite-amalgamation-3071100/ -lsqlite -L/usr/lib/ -ldl 
-lpthread -o compil compil.c  
/tmp/cc7IDdvz.o: In function `main': 
compil.c:(.text+0xc3): undefined reference to `sqlite3_open' 
compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg' 
compil.c:(.text+0x101): undefined reference to `sqlite3_close' 
compil.c:(.text+0x138): undefined reference to `sqlite3_exec' 
compil.c:(.text+0x16d): undefined reference to `sqlite3_free' 
compil.c:(.text+0x179): undefined reference to `sqlite3_close' 
collect2: ld a retourné 1 code d'état d'exécution

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Stephan Beal
Envoyé : jeudi 12 avril 2012 17:06
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with Sqlite in C program

On Thu, Apr 12, 2012 at 5:00 PM, Sako Youssouf <
youssouf.s...@renault-trucks.com> wrote:

> compil.c:(.text+0x6f): multiple definition of `main'
>

Remove shell.o from your libsqlite.a.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
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


Re: [sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Thank you for your answer Stephan 
I tried to adding -L command apparently it solved the problem but another error 
occur.


root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc 
-L/home/y_sako/Documents/sqlite-amalgamation-3071100/ -lsqlite -L/usr/lib/ -ldl 
-lpthread -o compil compil.c  
/tmp/cccbS6DV.o: In function `main': 
compil.c:(.text+0x6f): multiple definition of `main' 
/home/y_sako/Documents/sqlite-amalgamation-3071100//libsqlite.a(shell.o):shell.c:(.text+0x7515):
 first defined here 
collect2: ld a retourné 1 code d'état d'exécution 


I tried to add just the sqlite.c file in the library and recompile and there 
the first problem is comeback. 

root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# ar -rv 
libsqlite.a sqlite3.o 
ar: creating libsqlite.a 
a - sqlite3.o 
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc 
-L/home/y_sako/Documents/sqlite-amalgamation-3071100/ -lsqlite -L/usr/lib/ -ldl 
-lpthread -o compil compil.c  
/tmp/cc7IDdvz.o: In function `main': 
compil.c:(.text+0xc3): undefined reference to `sqlite3_open' 
compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg' 
compil.c:(.text+0x101): undefined reference to `sqlite3_close' 
compil.c:(.text+0x138): undefined reference to `sqlite3_exec' 
compil.c:(.text+0x16d): undefined reference to `sqlite3_free' 
compil.c:(.text+0x179): undefined reference to `sqlite3_close' 
collect2: ld a retourné 1 code d'état d'exécution


do you see what I have to changed? 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Stephan Beal
Envoyé : jeudi 12 avril 2012 16:18
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with Sqlite in C program

On Thu, Apr 12, 2012 at 4:14 PM, Sako Youssouf <
youssouf.s...@renault-trucks.com> wrote:

> root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc
> -lsqlite -o compil compil.c
>

Are you sure your -lsqlite isn't picking up an sqlite2 under /usr/lib?
Could you try adding -L. to your compile command?

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
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


[sqlite] error compilation with Sqlite in C program

2012-04-12 Thread Sako Youssouf
Hi,

I'm a new user of sqlite, i want to test utilization of sqlite in a C program.
So I generated a static lib of sqlite (using the amalgamation files) and I try 
to use it in my C program.
But I get some error. Below my compilation code and the return error.
The program that I wanted test is the C program on this page : 
http://www.sqlite.org/quickstart.html

root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc -c shell.c
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc -c sqlite3.c
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# ar -rv 
libsqlite.a shell.o sqlite3.o
ar: creating libsqlite.a
a - shell.o
a - sqlite3.o
root@ubuntu:/home/y_sako/Documents/sqlite-amalgamation-3071100# gcc -lsqlite -o 
compil compil.c

/tmp/ccBIvSMw.o: In function `main':

compil.c:(.text+0xc3): undefined reference to `sqlite3_open'

compil.c:(.text+0xda): undefined reference to `sqlite3_errmsg'

compil.c:(.text+0x101): undefined reference to `sqlite3_close'

compil.c:(.text+0x138): undefined reference to `sqlite3_exec'

compil.c:(.text+0x16d): undefined reference to `sqlite3_free'

compil.c:(.text+0x179): undefined reference to `sqlite3_close'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what is the problem ?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Problem resolved, it was pthread library instead of thread.

Thank you again 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Sako Youssouf
Envoyé : mercredi 11 avril 2012 14:43
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

Thank you Michael,

I compiled without including the library.
When I include the dl library the "dl..." error disappear but I can't find the 
thread library.
I find the "thread_db" library but the "thread..." error doesn't disappear when 
I use it.
 Do you know where can I find that thread library? 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : mercredi 11 avril 2012 14:01
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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
___
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


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Thank you Michael,

I compiled without including the library.
When I include the dl library the "dl..." error disappear but I can't find the 
thread library.
I find the "thread_db" library but the "thread..." error doesn't disappear when 
I use it.
 Do you know where can I find that thread library? 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : mercredi 11 avril 2012 14:01
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users