GCC can't find curl library

家住魔仙堡 提交于 2019-12-13 05:43:32

问题


I have a Dragino Yun Shield (it's an Arduino Yun basically, running OpenWRt Linino) and I have installed GCC on it as explained here:

http://www.sniff.org.uk/2014/05/building-gcc-for-yun-in-12-not-easy.html

The compiler seems to work fine for my needs (except for some floating point warnings) but I run into a problem. My C program requires the curl library and it can't be found by the linker:

gcc -shared -fPIC kii_cloud.c kii_custom.c kii_prv_utils.c -L jansson -I curl -I jansson -l jansson -l curl -o libkii.so
/mnt/sda1/gcc/bin/ld: cannot find -lcurl
collect2: ld returned 1 exit status
make: *** [build] Error 1

but the package libcurl is installed:

> opkg files libcurl
Package libcurl (7.29.0-1) is installed on root and has the following files:
/usr/lib/libcurl.so.4
/usr/lib/libcurl.so.4.3.0

It seems there's no libcurlX-dev package available (as in big Linux distros).

Is there any way to fix this? Is /usr/lib/libcurl.so what the linker wants?

Best regards and thanks.


回答1:


Try passing -L/usr/lib to your invocation. If that doesn't work then try adding -m32 then in another call -m64 both with the -L option.

gcc -shared -fPIC kii_cloud.c kii_custom.c kii_prv_utils.c -Ljansson -Icurl -Ijansson -ljansson -lcurl -o libkii.so -L/usr/lib




回答2:


I solved it by creating a symbolic link as follows:

cd /usr/lib
ln -s libcurl.so.4.3.0 libcurl.so

Best regards



来源:https://stackoverflow.com/questions/28329573/gcc-cant-find-curl-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!