Hi,
Indeed it looks like the libcurl is not available in the toolchain. We’ll have a look at this to fix that ASAP.
In the meantime, here is a workaround.
First of all, you’ll need *.so files (libcurl + dependencies) to provide to the linker, and header files to be included in your code.
It is possible to directly grab the so files from the device, and the header files from the curl website (curl.haxx.se/download.html)
I’ve done it for you in the attached archive ([color=#FF0000]Caution: I’ve named it .zip to workaround the forum filter, but this is a .tar.xz file; please rename it before usage[/color])
[attachment=2]libcurl.zip[/attachment]
I suggest you to extract the content of the file to a libcurl sub-directory of your application project.
Then, you’ll need to update your app settings.
In Project properties > C/C++ Build > Settings > mkapp Tool > C build options > Additional Linker Options area, add the following options:
[ul]
[li]-Wl,-rpath=${ProjDirPath}/libcurl[/li]
[li]-L${ProjDirPath}/libcurl[/li]
[li]-l:libcurl.so.5[/li][/ul]
This should look like this:
[attachment=1]props.png[/attachment]
Then, in Project properties > Legato application > API directories, add a workspace path and point to your libcurl/include directory:
[attachment=0]include.png[/attachment]
Then, we need to configure the bindings to import the libs inside the sandbox at runtime; I’ve done it in the Component.cdef file:
sources:
{
testWithCurl.c
}
requires: {
file: {
/usr/lib/libcurl.so.5 /lib/
/usr/lib/libgmp.so.10 /lib/
/usr/lib/libgnutls.so.28 /lib/
/usr/lib/libhogweed.so.2 /lib/
/usr/lib/libnettle.so.4 /lib/
/lib/libz.so.1 /lib/
}
}
Now the app should build.
To test it, I’ve written that code:
#include "legato.h"
#include "curl.h"
COMPONENT_INIT
{
LE_INFO("curl try: %s", curl_version());
}
And then I’m getting this in the logs:
Jan 6 01:06:42 | Legato | testwithcurl[17135]/testWithCurlComponent T=main | testWithCurl.c _testWithCurlComponent_COMPONENT_INIT() 6 | curl try: libcurl/7.37.1 GnuTLS/3.3.5 zlib/1.2.8
Hope this will help.