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 install libcurl 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?



  • @Jonathan-Rizzo

    I figured this out myself, so hopefully it's all correct. But it works :)

    1. Make sure your shell is in the source directory
    2. Run: "./scripts/feeds install <<your lib>>"
    3. Often this works. If it doesn't we will install manually.
    4. mkdir -p package/libs/<<your lib>>
    5. cd package/libs/<<your lib>>
    6. wget https://raw.githubusercontent.com/openwrt/packages/master/libs/<<your lib>>/Makefile
    7. cd ../../../
    8. make package/libs/<<your-lib>>/compile
    9. make package/libs/<<your-lib>>/install
    10. make package/libs/<<your-lib>>/clean

    More information here:
    https://openwrt.org/docs/guide-developer/build-system/start

    Secondly, 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



Looks like your connection to Community was lost, please wait while we try to reconnect.