Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tftp_client can't be compiled #72907

Closed
yashi opened this issue May 17, 2024 · 1 comment · Fixed by #72919
Closed

tftp_client can't be compiled #72907

yashi opened this issue May 17, 2024 · 1 comment · Fixed by #72919
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug

Comments

@yashi
Copy link
Collaborator

yashi commented May 17, 2024

Describe the bug
samples/net/tftp_client can't be compiled for native_posix and qemu_cortex_m3, which we have .conf for.

To Reproduce

for native_posix
Steps to reproduce the behavior:

Either do

west build -b native_posix zephyr/samples/net/tftp_client

or

west build -b native_posix zephyr/samples/net/tftp_client -- -DCONF_FILE=$(readlink -f zephyr/samples/net/tftp_client/boards/native_posix.conf)

for qemu_cortex_m3

Either do

west build -b qemu_cortex_m3 zephyr/samples/net/tftp_client

or

west build -b qemu_cortex_m3 zephyr/samples/net/tftp_client -- -DCONF_FILE=$(readlink -f zephyr/samples/net/tftp_client/boards/qemu_cortex_m3.conf)

Expected behavior
Build without any problem and runs.

Impact
User experience problem

Logs and console output for native_posix

rm -rf build && west build -b native_posix zephyr/samples/net/tftp_client -- -DCONF_FILE=$(readlink -f zephyr/samples/net/tftp_client/boards/native_posix.conf)    
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client
-- CMake version: 3.29.2
-- Found Python3: /home/yashi/src/zephyr-project/.venv/bin/python (found suitable version "3.11.9", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /home/yashi/.cache/zephyr
-- Zephyr version: 3.6.99 (/home/yashi/src/zephyr-project/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: native_posix, qualifiers: native
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.6 (/home/yashi/zephyr-sdk-0.16.6)
-- Found toolchain: host (gcc/ld)
-- Found Dtc: /usr/bin/dtc (found suitable version "1.7.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/yashi/src/zephyr-project/zephyr/boards/native/native_posix/native_posix.dts
-- Generated zephyr.dts: /home/yashi/src/zephyr-project/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/yashi/src/zephyr-project/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/yashi/src/zephyr-project/build/zephyr/dts.cmake

warning: DNS_RESOLVER (defined at subsys/net/lib/dns/Kconfig:4) was assigned the value 'y' but got
the value 'n'. Check these unsatisfied dependencies: NET_NATIVE (=n), NETWORKING (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DNS_RESOLVER and/or look up DNS_RESOLVER in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: DNS_SERVER_IP_ADDRESSES (defined at subsys/net/lib/dns/Kconfig:80) was assigned the value
'y' but got the value 'n'. Check these unsatisfied dependencies: DNS_RESOLVER (=n), NETWORKING (=n).
See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DNS_SERVER_IP_ADDRESSES and/or look up
DNS_SERVER_IP_ADDRESSES in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.


warning: DNS_SERVER1 (defined at subsys/net/lib/dns/Kconfig:88) was assigned the value '192.0.2.2'
but got the value ''. Check these unsatisfied dependencies: DNS_SERVER_IP_ADDRESSES (=n),
DNS_RESOLVER (=n), NETWORKING (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_DNS_SERVER1 and/or look up DNS_SERVER1 in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

Parsing /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/Kconfig
Loaded configuration '/home/yashi/src/zephyr-project/zephyr/boards/native/native_posix/native_posix_defconfig'
Merged configuration '/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/boards/native_posix.conf'
Configuration saved to '/home/yashi/src/zephyr-project/build/zephyr/.config'
Kconfig header saved to '/home/yashi/src/zephyr-project/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /usr/bin/ld.bfd (found version "2.42")
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/lib/ccache/gcc
-- Using ccache: /usr/bin/ccache
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/yashi/src/zephyr-project/build
-- west build: building application
[1/90] Preparing syscall dependency handling

[2/90] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (/home/yashi/src/zephyr-project/zephyr), build: v3.6.0-4135-gdd395e72f7c7
[87/90] Building C object CMakeFiles/app.dir/src/tftp-client.c.obj
FAILED: CMakeFiles/app.dir/src/tftp-client.c.obj 
ccache /usr/lib/ccache/gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -D__ZEPHYR__=1 -I/home/yashi/src/zephyr-project/zephyr/include -I/home/yashi/src/zephyr-project/build/zephyr/include/generated -I/home/yashi/src/zephyr-project/zephyr/soc/native/inf_clock -I/home/yashi/src/zephyr-project/zephyr/boards/native/native_posix -I/home/yashi/src/zephyr-project/zephyr/arch/posix/core/nsi_compat -fno-strict-aliasing -Os -imacros /home/yashi/src/zephyr-project/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/yashi/src/zephyr-project/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/yashi/src/zephyr-project=WEST_TOPDIR -ffunction-sections -fdata-sections -m32 -msse2 -mfpmath=sse -include /home/yashi/src/zephyr-project/zephyr/arch/posix/include/posix_cheats.h -fno-freestanding -std=c11 -MD -MT CMakeFiles/app.dir/src/tftp-client.c.obj -MF CMakeFiles/app.dir/src/tftp-client.c.obj.d -o CMakeFiles/app.dir/src/tftp-client.c.obj -c /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c: In function ‘tftp_init’:
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:16: error: variable ‘hints’ has initializer but incomplete type
   40 |         struct addrinfo *res, hints = {0};
      |                ^~~~~~~~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:40: warning: excess elements in struct initializer
   40 |         struct addrinfo *res, hints = {0};
      |                                        ^
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:40: note: (near initialization for ‘hints’)
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:31: error: storage size of ‘hints’ isn’t known
   40 |         struct addrinfo *res, hints = {0};
      |                               ^~~~~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:46:15: warning: implicit declaration of function ‘getaddrinfo’; did you mean ‘net_addr_ntop’? [-Wimplicit-function-declaration]
   46 |         ret = getaddrinfo(hostname, CONFIG_TFTP_APP_PORT, &hints, &res);
      |               ^~~~~~~~~~~
      |               net_addr_ntop
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:53:33: error: invalid use of undefined type ‘struct addrinfo’
   53 |         memcpy(&remote_addr, res->ai_addr, sizeof(remote_addr));
      |                                 ^~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:54:9: warning: implicit declaration of function ‘freeaddrinfo’; did you mean ‘zsock_freeaddrinfo’? [-Wimplicit-function-declaration]
   54 |         freeaddrinfo(res);
      |         ^~~~~~~~~~~~
      |         zsock_freeaddrinfo
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:31: warning: unused variable ‘hints’ [-Wunused-variable]
   40 |         struct addrinfo *res, hints = {0};
      |                               ^~~~~
[88/90] Linking C static library zephyr/kernel/libkernel.a
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/yashi/src/zephyr-project/build

Logs and console output for qemu_cortex_m3

rm -rf build && west build -b qemu_cortex_m3 zephyr/samples/net/tftp_client -- -DCONF_FILE=$(readlink -f zephyr/samples/net/tftp_client/boards/qemu_cortex_m3.conf)
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client
-- CMake version: 3.29.2
-- Found Python3: /home/yashi/src/zephyr-project/.venv/bin/python (found suitable version "3.11.9", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /home/yashi/.cache/zephyr
-- Zephyr version: 3.6.99 (/home/yashi/src/zephyr-project/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- Board: qemu_cortex_m3, qualifiers: ti_lm3s6965
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.16.6 (/home/yashi/zephyr-sdk-0.16.6)
-- Found toolchain: zephyr 0.16.6 (/home/yashi/zephyr-sdk-0.16.6)
-- Found Dtc: /usr/bin/dtc (found suitable version "1.7.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/yashi/src/zephyr-project/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3.dts
-- Generated zephyr.dts: /home/yashi/src/zephyr-project/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/yashi/src/zephyr-project/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /home/yashi/src/zephyr-project/build/zephyr/dts.cmake

warning: NET_L2_ETHERNET (defined at boards/shields/arceli_eth_w5500/Kconfig.defconfig:8,
boards/shields/esp_8266/boards/sam4e_xpro.defconfig:8,
boards/shields/frdm_cr20a/boards/frdm_k64f.defconfig:8,
boards/shields/inventek_eswifi/boards/frdm_k64f.defconfig:8,
boards/shields/inventek_eswifi/boards/nucleo_f767zi.defconfig:8,
boards/shields/link_board_eth/Kconfig.defconfig:8,
boards/shields/mikroe_eth_click/Kconfig.defconfig:9, subsys/net/l2/ethernet/Kconfig:4) was assigned
the value 'y' but got the value 'n'. Check these unsatisfied dependencies: ((NETWORKING &&
SHIELD_ARCELI_ETH_W5500) || (BOARD_SAM4E_XPRO && NETWORKING && (SHIELD_ESP_8266 ||
SHIELD_ESP_8266_ARDUINO || SHIELD_ESP_8266_MIKROBUS)) || (BOARD_FRDM_K64F && IEEE802154 &&
SHIELD_FRDM_CR20A) || (BOARD_FRDM_K64F && NETWORKING && (SHIELD_INVENTEK_ESWIFI ||
SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI || SHIELD_INVENTEK_ESWIFI_ARDUINO_UART)) || (BOARD_NUCLEO_F767ZI
&& NETWORKING && (SHIELD_INVENTEK_ESWIFI || SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI ||
SHIELD_INVENTEK_ESWIFI_ARDUINO_UART)) || (NETWORKING && SHIELD_LINK_BOARD_ETH) || (NETWORKING &&
SHIELD_MIKROE_ETH_CLICK) || NETWORKING) (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NET_L2_ETHERNET and/or look up
NET_L2_ETHERNET in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.


warning: ETH_DRIVER (defined at drivers/ethernet/Kconfig:6) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: NETWORKING (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_ETH_DRIVER and/or look up ETH_DRIVER in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: ETH_STELLARIS (defined at drivers/ethernet/Kconfig.stellaris:6) was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies: ETH_DRIVER (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_ETH_STELLARIS and/or look up ETH_STELLARIS
in the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


warning: The choice symbol NET_QEMU_ETHERNET (defined at subsys/net/ip/Kconfig:111) was selected
(set =y), but no symbol ended up as the choice selection. See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NET_QEMU_ETHERNET and/or look up
NET_QEMU_ETHERNET in the menuconfig/guiconfig interface. The Application Development Primer, Setting
Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
too.

Parsing /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/Kconfig
Loaded configuration '/home/yashi/src/zephyr-project/zephyr/boards/qemu/cortex_m3/qemu_cortex_m3_defconfig'
Merged configuration '/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/boards/qemu_cortex_m3.conf'
Configuration saved to '/home/yashi/src/zephyr-project/build/zephyr/.config'
Kconfig header saved to '/home/yashi/src/zephyr-project/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /home/yashi/zephyr-sdk-0.16.6/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/yashi/zephyr-sdk-0.16.6/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Using ccache: /usr/bin/ccache
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/yashi/src/zephyr-project/build
-- west build: building application
[1/108] Preparing syscall dependency handling

[2/108] Generating include/generated/version.h
-- Zephyr version: 3.6.99 (/home/yashi/src/zephyr-project/zephyr), build: v3.6.0-4135-gdd395e72f7c7
[59/108] Building C object CMakeFiles/app.dir/src/tftp-client.c.obj
FAILED: CMakeFiles/app.dir/src/tftp-client.c.obj 
ccache /home/yashi/zephyr-sdk-0.16.6/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DK_HEAP_MEM_POOL_SIZE=0 -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/yashi/src/zephyr-project/zephyr/include -I/home/yashi/src/zephyr-project/build/zephyr/include/generated -I/home/yashi/src/zephyr-project/zephyr/soc/ti/lm3s6965 -I/home/yashi/src/zephyr-project/zephyr/soc/ti/lm3s6965/. -I/home/yashi/src/zephyr-project/modules/hal/cmsis/CMSIS/Core/Include -I/home/yashi/src/zephyr-project/zephyr/modules/cmsis/. -isystem /home/yashi/src/zephyr-project/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros /home/yashi/src/zephyr-project/build/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m3 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=/home/yashi/zephyr-sdk-0.16.6/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/yashi/src/zephyr-project/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/yashi/src/zephyr-project/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/yashi/src/zephyr-project=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -std=c99 -MD -MT CMakeFiles/app.dir/src/tftp-client.c.obj -MF CMakeFiles/app.dir/src/tftp-client.c.obj.d -o CMakeFiles/app.dir/src/tftp-client.c.obj -c /home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c: In function 'tftp_init':
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:16: error: variable 'hints' has initializer but incomplete type
   40 |         struct addrinfo *res, hints = {0};
      |                ^~~~~~~~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:40: warning: excess elements in struct initializer
   40 |         struct addrinfo *res, hints = {0};
      |                                        ^
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:40: note: (near initialization for 'hints')
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:31: error: storage size of 'hints' isn't known
   40 |         struct addrinfo *res, hints = {0};
      |                               ^~~~~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:46:15: warning: implicit declaration of function 'getaddrinfo'; did you mean 'net_addr_ntop'? [-Wimplicit-function-declaration]
   46 |         ret = getaddrinfo(hostname, CONFIG_TFTP_APP_PORT, &hints, &res);
      |               ^~~~~~~~~~~
      |               net_addr_ntop
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:53:33: error: invalid use of undefined type 'struct addrinfo'
   53 |         memcpy(&remote_addr, res->ai_addr, sizeof(remote_addr));
      |                                 ^~
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:54:9: warning: implicit declaration of function 'freeaddrinfo'; did you mean 'zsock_freeaddrinfo'? [-Wimplicit-function-declaration]
   54 |         freeaddrinfo(res);
      |         ^~~~~~~~~~~~
      |         zsock_freeaddrinfo
/home/yashi/src/zephyr-project/zephyr/samples/net/tftp_client/src/tftp-client.c:40:31: warning: unused variable 'hints' [-Wunused-variable]
   40 |         struct addrinfo *res, hints = {0};
      |                               ^~~~~
[84/108] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mutex.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/yashi/src/zephyr-project/build

Environment (please complete the following information):

  • OS: Debian GNU Linux Sid
  • Toolchain: Zephyr SDK 0.16.6
  • Commit SHA: v3.6.0-4135-gdd395e72f7c

Additional context

  • native_sim works fine
  • nucleo_f429zi builds fine (with a warning for DNS_RESOLVER gets y) and works fine if you specify larger stack size for the main thread
@yashi yashi added the bug The issue is a bug, or the PR is fixing a bug label May 17, 2024
@rlubos
Copy link
Contributor

rlubos commented May 17, 2024

Will handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants