Sysprogs forums › Forums › VisualGDB › using VisualGDB with sqlite3
- This topic has 5 replies, 3 voices, and was last updated 11 years, 1 month ago by ket.
-
AuthorPosts
-
October 18, 2013 at 22:50 #662dwilliamsvancouvParticipant
I am trying to use the sqlite3 library with VisualGDB. I am running my executable under Ubuntu. I have installed sqlite3 using get-apt. I can see the file libsqlite3.so.0.8.6 in /usr/lib. When I use the pathname: /usr/lib in the Library directories field of the VisualGDB Project Properties page and the name:sqlite3 in the Library names field, I get the following message from the linker when I click on the Apply button: /usr/bin/ld: cannot find -lsqlite3
collect2: ld returned 1 exit statusCan anyone help me get past this problem?
October 19, 2013 at 18:43 #2689supportKeymasterIn order to link correctly with the sqlite libraries the file called libsqlite3.so should be present in one of the library directories. You can search for it by running the following command:
cd /usr/lib find . | grep sqlite3
The expected output would be something like this:
./i386-linux-gnu/libsqlite3.so.0 ./i386-linux-gnu/libsqlite3.so.0.8.6 ./i386-linux-gnu/pkgconfig/sqlite3.pc ./i386-linux-gnu/libsqlite3.so ./i386-linux-gnu/libsqlite3.a ./i386-linux-gnu/libsqlite3.la
If all the files are present, but the linker does not find them, please double-check your settings and try restarting the Linux machine. If the problem persists please try creating a simple .c file containing a main() function and build it with the libsqlite library using command line:
gcc file.c -lsqlite3
If you get the same error, please add the -v option to enable the verbose mode and provide us with the gcc output. If command-line compilation works, please compare the basic command line with the command line mentioned in VisualGDB build output.
October 21, 2013 at 19:04 #2690dwilliamsvancouvParticipantWhen I do this:
cd /usr/lib
find . | grep libsqlite3I get this:
./libsqlite3.so.0
./libsqlite3.so.0.8.6The first one is a symbolic link to the second. Do I need all the other files?
I created a simple “hello world” sample c source file and used the verbose option as you suggested. The following is what I did:
gcc sample.c -lsqlite3 -vI tried to attach the result as a file, but the uploader for this board would not allow any and every extension I tried to use. I have pasted it below:
winsys@PCMVDX:~$ gcc sample.c -lsqlite3 -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v –with-pkgversion=’Ubuntu 4.4.3-4ubuntu5′ –with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs –enable-languages=c,c++,fortran,objc,obj-c++ –prefix=/usr –enable-shared –enable-multiarch –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.4 –program-suffix=-4.4 –enable-nls –enable-clocale=gnu –enable-libstdcxx-debug –enable-plugin –enable-objc-gc –enable-targets=all –disable-werror –with-arch-32=i486 –with-tune=generic –enable-checking=release –build=i486-linux-gnu –host=i486-linux-gnu –target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
COLLECT_GCC_OPTIONS=’-v’ ‘-mtune=generic’ ‘-march=i486’
/usr/lib/gcc/i486-linux-gnu/4.4.3/cc1 -quiet -v sample.c -D_FORTIFY_SOURCE=2 -quiet -dumpbase sample.c -mtune=generic -march=i486 -auxbase sample -version -fstack-protector -o /tmp/ccv1nAae.s
GNU C (Ubuntu 4.4.3-4ubuntu5) version 4.4.3 (i486-linux-gnu)
compiled by GNU C version 4.4.3, GMP version 4.3.2, MPFR version 2.4.2-p1.
GGC heuristics: –param ggc-min-expand=46 –param ggc-min-heapsize=31310
ignoring nonexistent directory “/usr/local/include/i486-linux-gnu”
ignoring nonexistent directory “/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../i486-linux-gnu/include”
ignoring nonexistent directory “/usr/include/i486-linux-gnu”
#include “…” search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include
/usr/lib/gcc/i486-linux-gnu/4.4.3/include-fixed
/usr/include
End of search list.
GNU C (Ubuntu 4.4.3-4ubuntu5) version 4.4.3 (i486-linux-gnu)
compiled by GNU C version 4.4.3, GMP version 4.3.2, MPFR version 2.4.2-p1.
GGC heuristics: –param ggc-min-expand=46 –param ggc-min-heapsize=31310
Compiler executable checksum: 5998ce5f1765e99eea5269f4c1e38d44
COLLECT_GCC_OPTIONS=’-v’ ‘-mtune=generic’ ‘-march=i486’
as -V -Qy -o /tmp/cclg5BPs.o /tmp/ccv1nAae.s
GNU assembler version 2.20.1 (i486-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.20.1-system.20100303
COMPILER_PATH=/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/4.4.3/:/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS=’-v’ ‘-mtune=generic’ ‘-march=i486’
/usr/lib/gcc/i486-linux-gnu/4.4.3/collect2 –build-id –eh-frame-hdr -m elf_i386 –hash-style=both -dynamic-linker /lib/ld-linux.so.2 -z relro /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.4.3/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. /tmp/cclg5BPs.o -lsqlite3 -lgcc –as-needed -lgcc_s –no-as-needed -lc -lgcc –as-needed -lgcc_s –no-as-needed /usr/lib/gcc/i486-linux-gnu/4.4.3/crtend.o /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crtn.o
/usr/bin/ld: cannot find -lsqlite3
collect2: ld returned 1 exit statusI hope this is what you need to see the problem. I am still at a loss.
October 21, 2013 at 21:05 #2691ketParticipantHi,
When you installed sqlite3, did you install the development package libsqlite3-dev?
October 21, 2013 at 23:11 #2692dwilliamsvancouvParticipantThis was a good question. I asked my dev team member who did the install exactly what parameters he used in the get-apt command. It turned out that he only installed sqlite3, but did not install the libsqlit3-dev package. I subsequently did this:
get-apt install libsqlite3-dev
Now my VisualGDB Project Properties – Makefile settings can see the library when I add sqlite3 to the Library names list. I think I’m over this problem.
My only other question is this. Where do I put the sqlite3.h file so VisualGDB knows about the library? Do I put this pathname in the Include directories?
October 21, 2013 at 23:26 #2693ketParticipantHi,
If the build fails, then add the sqlite3.h directory to include directories in makefile settings.
If only IntelliSense complains about the include being not found, then look on the IntelliSense directories page in VisualGDB Project Properties, the directory should probably already be there (it is probably /usr/include). If it is not there, then add it, otherwise select the directory and reload it. As you added header files with the sqlite3-dev install, the locally cached headers for IntelliSense need to be updated.
-
AuthorPosts
- You must be logged in to reply to this topic.