/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference t
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference t
[ocean@slackware-mp 13:37:26]$ gcc -o test testsqlite3.c -lsqlite3
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference to `dlsym'
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference to `dlsym'
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference to `dlerror'
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference to `dlopen'
/usr/lib/gcc/i486-slackware-linux/4.4.4/../../../libsqlite3.so: undefined reference to `dlclose'
Hi, there!!! I don't know why that there's always show me this error. I googled this problem, and seems that glibc-solibs may goes wrong, So I reinstalled glibc , libtool and glibc-solibs, but the problem still exist, nothing helps. any one had met this kind of situation? anyone could give a suggestion about this? thank you very much!!!
1. Try simply adding "-ldl" to your compile/link command:
Code:
gcc -o test testsqlite3.c -lsqlite3 -ldl
thank you, this is really works!!! hummm... well, I had not ever added libdl while compiling, so,I do not know this is the problem, I had thought that my library may goes wrong!!! thanks so much for your helping!!!!
thank you, this is really works!!! hummm... well, I had not ever added libdl while compiling, so,I do not know this is the problem, I had thought that my library may goes wrong!!! thanks so much for your helping!!!!
It wasn't your question, but anyway - I am strongly advise you against useage
'test' as name for test programs. There is already one - in the /usr/bin.
And if you by chance invoke your program as
Code:
test
instead of
Code:
./test
You'll run test from the /usr/bin and not yours.
While I ago I spent a lot of time to figure out that stupid error
It wasn't your question, but anyway - I am strongly advise you against useage
'test' as name for test programs. There is already one - in the /usr/bin.
OK!!! I remember that now, I won't use it any more, thanks' for your suggestion!!!! ~_~!!!
The error you encountered should be fixed for stuff that uses pkgconfig to get the flags for sqlite.
thanks for your reply, but, I do not get fully understand of this, you mean I can fixed this error by using the tool of pkgconfig or something others?
but the error I encountered is none of sqlite's business, it is the -ldl's problem. I just did not add the options "-ldl" here, then I got this error, although I did not get this kind of error by other linux.
so, could you please show me how to fixed this? the exactly step?
thank you so much!!!!
If you know sqlite3 is installed in your system, you can get the needed C compiler flags when compiling the program with "pkg-config --cflags sqlite3". To link an executable with sqlite3, you need to pass the flags indicated with "pkg-config --libs sqlite3" in the link step (for a simple program, this is the same step as the previous one). So, for example, a small program using sqlite3 could be compiled as:
And, to know if sqlite3 is installed in your system, you could use the following command:
pkg-config --exists sqlite3
This will return 0 when sqlite3 is installed with pkg-config, and something else if it's not. pkg-config is not something specific to Slackware. It's simply conveniently used by a good amount of programs and libraries so you can easily use pkg-config to get the needed flags.
If you know sqlite3 is installed in your system, you can get the needed C compiler flags when compiling the program with "pkg-config --cflags sqlite3". To link an executable with sqlite3, you need to pass the flags indicated with "pkg-config --libs sqlite3" in the link step (for a simple program, this is the same step as the previous one). So, for example, a small program using sqlite3 could be compiled as:
And, to know if sqlite3 is installed in your system, you could use the following command:
pkg-config --exists sqlite3
This will return 0 when sqlite3 is installed with pkg-config, and something else if it's not. pkg-config is not something specific to Slackware. It's simply conveniently used by a good amount of programs and libraries so you can easily use pkg-config to get the needed flags.
yes, you are right, I almost forgot this, I had used this, and this is really useful for me. en, I used mysql before, mysql needs many kinds of libs, then, I googled this tool "pkg-config",
seems that $(pkd-config --cflags mysql) $(pkg-config --libs mysql)
but I did not get a fully understand of pkg-config at that time, but now, I got it. thank you so much!!!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.