Implicit declaration of tzset and setenv in nRF Connect SDK

Hi,

I´ve upgraded my nRF Connect SDK from version v2.6.0 to v2.7.0 and now I get this warnings:

warning: implicit declaration of function 'setenv'; did you mean 'getenv'? [-Wimplicit-function-declaration]
   86 |         setenv("TZ", retained.timezone, 1);
   
warning: implicit declaration of function 'tzset' [-Wimplicit-function-declaration]
   87 |         tzset();

How can I fix them?

Parents Reply Children
  • Loading Zephyr default modules (Zephyr base).
    -- Application: /app
    -- CMake version: 3.21.0
    -- Found Python3: /home/daniel/ncs/toolchains/2be090971e/usr/local/bin/python3.9 (found suitable version "3.9.18", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /home/daniel/.cache/zephyr
    -- Zephyr version: 3.6.99 (/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: zswatch_nrf5340_cpuapp, Revision: 5
    -- Found host-tools: zephyr 0.16.5 (/home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found Dtc: /home/daniel/ncs/toolchains/2be090971e/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6") 
    -- Found BOARD.dts: /app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp.dts
    -- Found devicetree overlay: /app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.overlay
    -- Generated zephyr.dts: /app/debug_rev5/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /app/debug_rev5/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /app/debug_rev5/zephyr/dts.cmake
    CMake Deprecation Warning at /zephyr/cmake/modules/kconfig.cmake:89 (message):
      Use of 'zswatch_nrf5340_cpuapp_5.conf' is deprecated, please switch to
      'zswatch_nrf5340_cpuapp_5_defconfig'
    Call Stack (most recent call first):
      /nrf/cmake/modules/kconfig.cmake:29 (include)
      /zephyr/cmake/modules/zephyr_default.cmake:132 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:45 (find_package)
    
    
    Parsing /app/Kconfig
    Loaded configuration '/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig'
    Merged configuration '/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf'
    Merged configuration '/app/prj.conf'
    Merged configuration '/app/boards/debug.conf'
    Merged configuration '/app/debug_rev5/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/app/debug_rev5/zephyr/.config'
    Kconfig header saved to '/app/debug_rev5/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Deprecation Warning at /zephyr/soc/CMakeLists.txt:15 (message):
      
    
                ---------------------------------------------------------------------
                --- WARNING: Functionality to describe SoCs in HWMv1 is           ---
                --- deprecated and should be replaced with HWMv2, including       ---
                --- boards. HWMv1 SoCs support remains only to ease the migration ---
                --- of out-of-tree SoCs and associated boards. It will not be     ---
                --- possible to build using HWMv1 SoCs at all in future releases. ---
                ---------------------------------------------------------------------
    
    
    
    === child image hci_ipc - CPUNET begin ===
    loading initial cache file /app/debug_rev5/hci_ipc/child_image_preload.cmake
    -- Application: /zephyr/samples/bluetooth/hci_ipc
    -- CMake version: 3.21.0
    Loading Zephyr default modules (Zephyr base).
    -- Found Python3: /home/daniel/ncs/toolchains/2be090971e/usr/local/bin/python3.9 (found suitable version "3.9.18", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /home/daniel/.cache/zephyr
    -- Zephyr version: 3.6.99 (/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: zswatch_nrf5340_cpunet, Revision: 5
    -- Found host-tools: zephyr 0.16.5 (/home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk)
    -- Found Dtc: /home/daniel/ncs/toolchains/2be090971e/usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6") 
    -- Found BOARD.dts: /app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpunet.dts
    -- Generated zephyr.dts: /app/debug_rev5/hci_ipc/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /app/debug_rev5/hci_ipc/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /app/debug_rev5/hci_ipc/zephyr/dts.cmake
    CMake Deprecation Warning at /zephyr/cmake/modules/kconfig.cmake:89 (message):
      Use of 'zswatch_nrf5340_cpunet_5.conf' is deprecated, please switch to
      'zswatch_nrf5340_cpunet_5_defconfig'
    Call Stack (most recent call first):
      /nrf/cmake/modules/kconfig.cmake:29 (include)
      /zephyr/cmake/modules/zephyr_default.cmake:132 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    
    warning: Experimental symbol BT_LL_SW_SPLIT is enabled.
    
    Parsing /zephyr/Kconfig
    Loaded configuration '/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpunet_defconfig'
    Merged configuration '/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpunet_5.conf'
    Merged configuration '/zephyr/samples/bluetooth/hci_ipc/prj.conf'
    Merged configuration '/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/app/child_image/hci_ipc.conf'
    Configuration saved to '/app/debug_rev5/hci_ipc/zephyr/.config'
    Kconfig header saved to '/app/debug_rev5/hci_ipc/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/daniel/ncs/toolchains/2be090971e/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Deprecation Warning at /zephyr/soc/CMakeLists.txt:15 (message):
      
    
                ---------------------------------------------------------------------
                --- WARNING: Functionality to describe SoCs in HWMv1 is           ---
                --- deprecated and should be replaced with HWMv2, including       ---
                --- boards. HWMv1 SoCs support remains only to ease the migration ---
                --- of out-of-tree SoCs and associated boards. It will not be     ---
                --- possible to build using HWMv1 SoCs at all in future releases. ---
                ---------------------------------------------------------------------
    
    
    CMake Warning at /zephyr/subsys/bluetooth/controller/CMakeLists.txt:4 (message):
      
    
      CONFIG_BT_CTLR_ADVANCED_FEATURES=y, Advanced Features' default value change
      could change Zephyr Bluetooth Controller's functional behavior.
    
    
    -- libmetal version: 1.5.0 (/zephyr/samples/bluetooth/hci_ipc)
    -- Build type:  
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- Looking for include file stdatomic.h
    -- Looking for include file stdatomic.h - found
    -- open-amp version: 1.5.0 (/modules/lib/open-amp/open-amp)
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- C_FLAGS :  -Wall -Wextra
    -- Looking for include file fcntl.h
    -- Looking for include file fcntl.h - found
    -- Using ccache: /home/daniel/ncs/toolchains/2be090971e/usr/bin/ccache
    CMake Deprecation Warning at /nrf/cmake/partition_manager.cmake:32 (message):
      
    
                ---------------------------------------------------------------------
                --- WARNING: Child and parent image functionality is deprecated   ---
                --- and should be replaced with sysbuild. Child and parent image  ---
                --- support remains only to allow existing customer applications  ---
                --- to build and allow porting to sysbuild, it is no longer       ---
                --- receiving updates or new features and it will not be possible ---
                --- to build using child/parent image at all in nRF Connect SDK   ---
                --- version 2.9 onwards.                                          ---
                ---------------------------------------------------------------------
    Call Stack (most recent call first):
      /zephyr/cmake/modules/kernel.cmake:253 (include)
      /zephyr/cmake/modules/zephyr_default.cmake:141 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:5 (find_package)
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /app/debug_rev5/hci_ipc
    === child image hci_ipc - CPUNET end ===
    
    -- libmetal version: 1.5.0 (/app)
    -- Looking for include file stdatomic.h
    -- Build type:  
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- Looking for include file stdatomic.h - found
    -- open-amp version: 1.5.0 (/modules/lib/open-amp/open-amp)
    -- Host:    Linux/x86_64
    -- Target:  Generic/arm
    -- Machine: arm
    -- C_FLAGS :  -Wall -Wextra
    -- Looking for include file fcntl.h
    -- Looking for include file fcntl.h - found
    -- Using ccache: /home/daniel/ncs/toolchains/2be090971e/usr/bin/ccache
    CMake Warning at /zephyr/CMakeLists.txt:895 (message):
      No SOURCES given to Zephyr library: drivers__display
    
      Excluding target from build.
    
    
    CMake Warning at /zephyr/CMakeLists.txt:2027 (message):
      __ASSERT() statements are globally ENABLED
    
    
    CMake Deprecation Warning at /nrf/cmake/partition_manager.cmake:32 (message):
      
    
                ---------------------------------------------------------------------
                --- WARNING: Child and parent image functionality is deprecated   ---
                --- and should be replaced with sysbuild. Child and parent image  ---
                --- support remains only to allow existing customer applications  ---
                --- to build and allow porting to sysbuild, it is no longer       ---
                --- receiving updates or new features and it will not be possible ---
                --- to build using child/parent image at all in nRF Connect SDK   ---
                --- version 2.9 onwards.                                          ---
                ---------------------------------------------------------------------
    Call Stack (most recent call first):
      /zephyr/cmake/modules/kernel.cmake:253 (include)
      /zephyr/cmake/modules/zephyr_default.cmake:141 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:45 (find_package)
    
    
    -- Found partition manager static configuration: /app/partition_external.yml
    Partition 'littlefs_storage' is not included in the dynamic resolving since it is statically defined.
    Partition 'settings_storage' is not included in the dynamic resolving since it is statically defined.
    Applications
    -- 2048
    -- about
    -- battery
    -- compass
    -- flashlight
    -- iaq
    -- info
    -- music_control
    -- notification
    -- ppt_remote
    -- qr_code
    -- sensor_fusion
    -- sensors_summary
    -- settings
    -- template
    -- trivia
    -- watchface
    -- watchface_picker
    -- weather
    -- x_ray
    -- zds
    Watchfaces
    -- 0_digital
    -- 107_2_dial
    -- 116_2_dial
    -- 66_2_dial
    -- 70_2_dial
    -- 73_2_dial
    -- 75_2_dial
    -- 79_2_dial
    -- 80_2_dial
    -- 84_2_dial
    -- analog
    -- minimal
    -- pixel
    Number of external filesystem files:642
    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CACHED_CONF_FILE
    
    
    -- Build files have been written to: /app/debug_rev5
    -- west build: building application
    [1/1335] Preparing syscall dependency handling
    
    [11/1335] Generating include/generated/version.h
    -- Zephyr version: 3.6.99 (/zephyr), build: v3.6.99-ncs2
    [1/257] Preparing syscall dependency handling
    
    [6/257] Generating include/generated/version.h
    -- Zephyr version: 3.6.99 (/zephyr), build: v3.6.99-ncs2
    [255/257] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      176104 B       256 KB     67.18%
                 RAM:       56596 B        64 KB     86.36%
               SRAM1:          0 GB        64 KB      0.00%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from /app/debug_rev5/hci_ipc/zephyr/zephyr.elf for board: zswatch_nrf5340_cpunet
    [738/1335] Building C object CMakeFiles/app.dir/src/zsw_clock.c.obj
    /app/src/zsw_clock.c: In function 'zsw_clock_set_timezone':
    /app/src/zsw_clock.c:115:9: warning: implicit declaration of function 'setenv'; did you mean 'getenv'? [-Wimplicit-function-declaration]
      115 |         setenv("TZ", tz, 1);
          |         ^~~~~~
          |         getenv
    /app/src/zsw_clock.c:116:9: warning: implicit declaration of function 'tzset' [-Wimplicit-function-declaration]
      116 |         tzset();
          |         ^~~~~
    [1333/1335] Linking C executable zephyr/zephyr.elf

  • Hi,

    I was able to reproduce the issue by calling setenv() and tzset() in Zephyr's Hello World sample.

    The issue seems to come from some changes to POSIX in Zephyr. In Zephyr 3.7.0 setenv() can be used by enabling CONFIG_POSIX_SINGLE_PROCESS, but this configuration does not seem to exist in the nRF Connect SDK v2.7.0 yet.

    I would suggest asking about this on the Zephyr discord channel.

    Best regards,
    Marte

Related