Using curl library (nrf/ext/curl)

I would like to use the cURL libary that is included in the nRF Connect SDK (v2.6.1) a nrf/ext/curl

I started with the download sample (nrf/samples/net/download)

I've added this to CMakeLists.txt

And I've added this to the top of src.main.c:

When I build, I get the following error: 

In file included from C:/ncs/v2.6.1/nrf/ext/curl/include/curl/curl.h:38,
from C:/Users/MarkBlackburn/Documents/git/nrf9160_samples/curl_test/src/main.c:15:
C:/ncs/v2.6.1/nrf/ext/curl/include/curl/system.h:436:12: fatal error: sys/socket.h: No such file or directory
436 | # include <sys/socket.h>


How do I get the sys/socket.h file included in the project?

Parents Reply Children
  • I'm using nrf9160dk_nrf9160_ns.

    Here's the build command VS Code generated:

    west build --build-dir c:/Users/MarkBlackburn/Documents/git/nrf9160_samples/curl_test/build_dk c:/Users/MarkBlackburn/Documents/git/nrf9160_samples/curl_test --pristine --board nrf9160dk_nrf9160_ns --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=c:/users/markblackburn/board-roots;c:/users/markblackburn/documents/git/nrf9160_samples/curl_test

    I had earlier renamed the download sample to curl_test

    I've updated CMakeLists.txt to add the folder for the sys/socket.h include. Now I'm stuck on link errors as I don't know how to add the .c files for the nrf/ext/curl folder.

  • Hi,

    You could try out the changes shown below and build for nrf9160dk_nrf9160_ns board target.

    CMakeLists.txt



    main.c


    prj.conf

    Best regards,
    Dejan

  • Thanks, I've got that to build.