Cross Compiling With Libcurl
-
Background
I am trying to use libcurl in a program.
I am cross compiling this program for the Omega 1 on my laptop using the official guide.
I am having issues figuring out how to obtain the header files and the library for libcurl on the Omega 1 for cross compilation.
Issues
If I compile the program for my host OS then my native toolchain will find the necessary libcurl files. I am not sure if these same files can be used to cross compile a program for the Omega 1.
I can use
opkg
to installlibcurl
on the Omega. However I believe I need the files on my laptop instead.If I try to install the
libcurl
package on my laptop inside the OpenWRT git repository by running:scripts/feeds update -a scripts/feeds install libcurl
It does not seem to work for 2 reasons.
First because that the install command shows this output:
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist WARNING: Makefile 'package/network/utils/nftables/Makefile' has a dependency on 'jansson', which does not exist
And second because the cross compile toolchain still can't find the
curl/curl.h
.Question
How would I go about obtaining the files needed to cross compile a binary for the Omega 1 with libcurl?
-
For the sake of people who find this old-ish thread from internet search, the answer is that you’ll need to install libcurl in your buildroot toolchain, with headers and libraries.
On the omega itself, you can just copy the .so library files from your buildroot into /usr/lib (or wherever you want to keep them)
I’ve done this with several libs.
-
How do you install a library or package into the buildroot of the toolchain?
-
I figured this out myself, so hopefully it's all correct. But it works
- Make sure your shell is in the source directory
- Run: "./scripts/feeds install <<your lib>>"
- Often this works. If it doesn't we will install manually.
- mkdir -p package/libs/<<your lib>>
- cd package/libs/<<your lib>>
- wget https://raw.githubusercontent.com/openwrt/packages/master/libs/<<your lib>>/Makefile
- cd ../../../
- make package/libs/<<your-lib>>/compile
- make package/libs/<<your-lib>>/install
- make package/libs/<<your-lib>>/clean
More information here:
https://openwrt.org/docs/guide-developer/build-system/startSecondly, this may be a cleaner way to do it, but I haven't tried:
https://navneetstudynotes.blogspot.com/2015/04/building-new-package-with-openwrt.html