0

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.

German
  • 10,263
  • 4
  • 40
  • 56

2 Answers2

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

Qwertyzw
  • 530
  • 4
  • 12
  • Thanks a lot but I solved it with my answer below. I really appreciate your input anyway (as that comes handy for other similar cases). Thx – German Feb 05 '15 at 18:40
1

I solved it by creating a symbolic link as follows:

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

Best regards

German
  • 10,263
  • 4
  • 40
  • 56
  • I have the same problem, but I'm using an Arduino Yun. I tried this solution but it didn't work. In your C program have you included curl/curl.h? – RiccardoCh Dec 01 '17 at 16:15
  • I'm sorry. I don't have access to those files or the device anymore and I can't remember :( – German Dec 10 '17 at 00:48