1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

LD cant find the library

Discussion in 'C' started by agnimidhun, Dec 5, 2008.

  1. agnimidhun

    agnimidhun New Member

    Joined:
    Dec 5, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi All,

    I am compiling a program with gcc on Fedora 8 machine (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)). It requires libsqlite3. I compile it as follows:

    gcc -Wall -g showbs4.c -o showbs4 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -L/usr/lib/ -lsqlite3.so

    ls -l /usr/lib/libsqlite3.so* shows:

    lrwxrwxrwx 1 root root 19 2008-12-05 13:41 /usr/lib/libsqlite3.so -> libsqlite3.so.0.8.6
    lrwxrwxrwx 1 root root 19 2007-11-02 19:49 /usr/lib/libsqlite3.so.0 -> libsqlite3.so.0.8.6
    -rwxr-xr-x 1 root root 435812 2007-09-28 18:24 /usr/lib/libsqlite3.so.0.8.6

    LD_LIBRARY_PATH is set to :

    LD_LIBRARY_PATH=/usr/lib


    gcc is still not able to find libsqlite3. How do I tell gcc to include the libsqlite3 ?:thinking:


    This might be trivial. But I have not been able to figure as to what else I can do. :embarasse

    Thanks,
    Midhun
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    -lXYZ is a linker shortcut; it tells the linker to look for libXYZ.a, e.g. to link with libm.a you just specify -lm. So if you specify -lsqlite3.so the linker dutifully adds lib and .a and goes off looking for libsqlite3.so.a. If you want it to link with sqlite3.so, just leave the -l prefix off.
     

Share This Page