Inclusion of zephyr/net/socket.h

Hi,

I have an issue with a freestanding application I built.

I am working with the nRF9160 DK, and an installation of nRF Connect for VS Code on a Linux Virtual machine.

I'm trying to implement an LTE connection to a server with post request and I'm having an include error in one of my files.

cannot open source file "picolibc.h" (dependency of "zephyr/net/socket.h")C/C++(1696)

I tried to modify KConfig by including Picolibc Module but it doesn't seem to change anything.

I thought the problem might come from the way I wrote my prj.conf file or CMakeLists.txt file, but I didn't find much help on the internet on how to write those in my case, so if someone has useful links to share I would be very grateful.

The output of the CMake build is

[variant] Loaded new set of variants
[kit] Successfully loaded 2 kits from /home/maindir/.local/share/CMakeTools/cmake-tools-kits.json
[presetController] Successfully validated presets in /home/path-to-my-app/CMakePresets.json
[proc] Executing command: /usr/bin/cmake --version
[main] Configuring project: my-app 
[proc] Executing command: /usr/bin/cmake -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD=nrf9160dk_nrf9160_ns -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DCONF_FILE=/home/octech/Documents/Pifil/pifil-nrf9160/prj.conf -S/home/octech/Documents/Pifil/pifil-nrf9160 -B/home/octech/Documents/Pifil/pifil-nrf9160/build -G Ninja
[cmake] Loading Zephyr default modules (Zephyr base (cached)).
[cmake] -- Application: /path-to-my-app
[cmake] -- CMake version: 3.22.1
[cmake] -- Cache files will be written to: /home/maindir/.cache//zephyr
[cmake] -- Zephyr version: 3.3.99 (/home/maindir/ncs/zephyr)
[cmake] -- Found west (found suitable version "1.1.0", minimum required is "0.7.1")
[cmake] -- Board: nrf9160dk_nrf9160_ns, Revision: 0.7.0
[cmake] -- Found host-tools: zephyr 0.16.0 (/home/maindir/zephyr-sdk-0.16.0)
[cmake] -- Found toolchain: zephyr 0.16.0 (/home/maindir/zephyr-sdk-0.16.0)
[cmake] -- Found BOARD.dts: /home/maindir/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_ns.dts
[cmake] -- Generated zephyr.dts: /home/path-to-my-app/build/zephyr/zephyr.dts
[cmake] -- Generated devicetree_generated.h: /home/path-to-my-app/build/zephyr/include/generated/devicetree_generated.h
[cmake] -- Including generated dts.cmake file: /home/path-to-my-app/build/zephyr/dts.cmake
[cmake] Parsing /home/maindir/ncs/zephyr/Kconfig
[cmake] Loaded configuration '/home/path-to-my-app/build/zephyr/.config'
[cmake] No change to configuration in '/home/path-to-my-app/build/zephyr/.config'
[cmake] No change to Kconfig header in '/home/path-to-my-app/build/zephyr/include/generated/autoconf.h'
[cmake] CMake Warning at /home/maindir/ncs/zephyr/CMakeLists.txt:838 (message):
[cmake]   No SOURCES given to Zephyr library: lib__libc__common
[cmake] 
[cmake]   Excluding target from build.
[cmake] 
[cmake] 
[cmake] Dropping partition 'nrf_modem_lib_trace' since its size is 0.
[cmake] Dropping partition 'nonsecure_storage' since it is empty.
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /home/path-to-my-app/build

It builds ok but I'm concerned about the part that says

No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.

I think I really need the socket.h inclusion for my file, I don't know any other alternative, but it causes problem in my entire app.

Can someone help me with this issue ?

Thanks in advance.

Parents
  • Hi again,

    I'm trying to implement an LTE connection to a server with post request and I'm having an include error in one of my files.

    cannot open source file "picolibc.h" (dependency of "zephyr/net/socket.h")C/C++(1696)

    I tried to modify KConfig by including Picolibc Module but it doesn't seem to change anything.

    I can't find any references to this issue occurring anywhere, and neither to the relationship between socket.h and picolib.

    I also can't see any reference to it in the build log you posted.

    It builds ok but ...

    Are you saying that functionally, everything is fine?

    Because my first instinct here is that Intellisense has made a mistake, this happens regularly. It sometimes can't cope with Zephyr's build system and will report some error or warning, but this can be ignored.

    Coincidentally I found someone else experiencing this with net/socket.h, though a different dependency: https://community.platformio.org/t/zephyr-includes-missing-from-network-example/22237

    I'm guessing it's the same case here.

    Regarding lib__libc__common, I think this might be related to an ongoing issue that you can follow here: Peripheral LBS example: Policy CMP0010 is not set and No SOURCES given to Zephyr library: lib__libc__common 

    We've had multiple similar reports recently.

    By the way, regarding this:

    I thought the problem might come from the way I wrote my prj.conf file or CMakeLists.txt file, but I didn't find much help on the internet on how to write those in my case, so if someone has useful links to share I would be very grateful.

    Apart from our docs on Kconfig, I would like to recommend you to follow our NCS Fundamentals course at our new Dev Academy: https://academy.nordicsemi.com/.

    I hope this is useful!

    Best regards,

    Raoul

Reply
  • Hi again,

    I'm trying to implement an LTE connection to a server with post request and I'm having an include error in one of my files.

    cannot open source file "picolibc.h" (dependency of "zephyr/net/socket.h")C/C++(1696)

    I tried to modify KConfig by including Picolibc Module but it doesn't seem to change anything.

    I can't find any references to this issue occurring anywhere, and neither to the relationship between socket.h and picolib.

    I also can't see any reference to it in the build log you posted.

    It builds ok but ...

    Are you saying that functionally, everything is fine?

    Because my first instinct here is that Intellisense has made a mistake, this happens regularly. It sometimes can't cope with Zephyr's build system and will report some error or warning, but this can be ignored.

    Coincidentally I found someone else experiencing this with net/socket.h, though a different dependency: https://community.platformio.org/t/zephyr-includes-missing-from-network-example/22237

    I'm guessing it's the same case here.

    Regarding lib__libc__common, I think this might be related to an ongoing issue that you can follow here: Peripheral LBS example: Policy CMP0010 is not set and No SOURCES given to Zephyr library: lib__libc__common 

    We've had multiple similar reports recently.

    By the way, regarding this:

    I thought the problem might come from the way I wrote my prj.conf file or CMakeLists.txt file, but I didn't find much help on the internet on how to write those in my case, so if someone has useful links to share I would be very grateful.

    Apart from our docs on Kconfig, I would like to recommend you to follow our NCS Fundamentals course at our new Dev Academy: https://academy.nordicsemi.com/.

    I hope this is useful!

    Best regards,

    Raoul

Children
No Data
Related