![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using funcion in a shared library | yhacks | High Level Programming | 1 | 05-23-2008 04:03 AM |
| Shared memory in shared library | DreamWarrior | High Level Programming | 12 | 05-30-2007 01:33 PM |
| shared library | areef4u | UNIX for Advanced & Expert Users | 1 | 07-31-2006 11:14 PM |
| Creation of Shared library | sarangb | SCO | 0 | 06-17-2005 04:51 AM |
| Shared Library | rajashekaran | High Level Programming | 2 | 08-03-2002 10:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
shared library not found
Hello,
On a Centos 5.0 box, I have two versions of a library (sqlite): (1) in /usr/lib that was installed using yum (maybe from php but I am not really sure) (2) in /usr/local/lib that I installed myself by compiling from the source code. My C++ program contains the following lines: main.cpp #include "/usr/local/include/sqlite3.h" Makefile SQLITE_LIB = "/usr/local/lib/libsqlite3.so" SQLITE = -I "/usr/local/include/" $(TARGET_APP) : main.o $(CPP) -LLIBDIR $(FASTCGI_LIB) $(SQLITE_LIB) -o $(TARGET_APP) main.o main.o : main.cpp $(CPP) $(BOOST) $(SQLITE) -c -o main.o main.cpp This compiles fine but when I run it, I am getting the error message: symbol lookup error: app: undefined symbol: sqlite3_open_v2 I guess the shared library is not found at run time. What should I do to make it work? Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
$(CPP) -LLIBDIR $(FASTCGI_LIB) $(SQLITE_LIB) -o $(TARGET_APP) main.o Code:
$(CPP) -L $(FASTCGI_LIB) /usr/local/lib/ -lsqlite3 -o $(TARGET_APP) main.o |
|
#3
|
|||
|
|||
|
Thanks for the answer. I tried
$(TARGET_APP) : main.o $(CPP) -L $(FASTCGI_LIB) /usr/local/lib/ -lsqlite3 -o $(TARGET_APP) main.o but compilation failed with the following message: /usr/local/lib/: file not recognized: Is a directory collect2: ld returned 1 exit status make: *** [lock.vrv] Error 1 |
|
#4
|
||||
|
||||
|
Quote:
Code:
$(CPP) -L $(FASTCGI_LIB) -L /usr/local/lib/ -lsqlite3 -o $(TARGET_APP) main.o |
|
#5
|
|||
|
|||
|
$(TARGET_APP) : main.o
$(CPP) $(FASTCGI_LIB) -L /usr/local/lib/ -lsqlite3 -o $(TARGET_APP) main.o doe compile indeed ( I just took off the -L before $(FASTCGI_LIB) but I am back to my previous problem since the final executable returns: symbol lookup error: ./app: undefined symbol: sqlite3_open_v2 Since the program compiles, the sqlite_open_v2 is found in both the header and the shared library but for some reason, at run-time, it fails. |
|
#6
|
|||
|
|||
|
post the output of the below commands
Code:
ldd ./app echo $LD_LIBRARY_PATH |
|
#7
|
|||
|
|||
|
hello,
ldd ./app linux-gate.so.1 => (0xffffe000) libfcgi++.so.0 => /usr/local/lib/libfcgi++.so.0 (0x4000c000) libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x464d9000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x46dfb000) libm.so.6 => /lib/libm.so.6 (0x46dab000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x46ded000) libc.so.6 => /lib/libc.so.6 (0x46c69000) libfcgi.so.0 => /usr/local/lib/libfcgi.so.0 (0x40012000) libnsl.so.1 => /lib/libnsl.so.1 (0x46543000) libpthread.so.0 => /lib/libpthread.so.0 (0x46dd4000) /lib/ld-linux.so.2 (0x4629a000) echo $LD_LIBRARY_PATH the latest commands returns a blank line. Thank you for your help |
|||
| Google The UNIX and Linux Forums |
| Tags |
| linux |
| Thread Tools | |
| Display Modes | |
|
|