espressif / esp-protocols

Collection of ESP-IDF components related to networking protocols
180 stars 123 forks source link

ASIO doesn't compile on Mac OS (IDFGH-13243) #614

Open moreana opened 1 month ago

moreana commented 1 month ago

Answers checklist.

General issue report

esp-idf: v5.2.2 asio: v1.28.2

I am trying to compile tcp_echo_server example from ASIO and I get such linking errors:

/Users/attila/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj):(.literal._ZN4asio6detail10socket_ops9inet_ntopEiPKvPcjmRSt10error_code+0x4): undefined reference to `if_indextoname'
/Users/attila/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj):(.literal._ZN4asio6detail18signal_set_service16open_descriptorsEv+0x4): undefined reference to `pipe'
/Users/attila/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj): in function `_ZN4asio6detail10socket_ops9inet_ntopEiPKvPcjmRSt10error_code':
/Users/attila/projects/esp/esp-idf/examples/wifi/scan/managed_components/espressif__asio/asio/asio/include/asio/detail/impl/socket_ops.ipp:2519:(.text._ZN4asio6detail10socket_ops9inet_ntopEiPKvPcjmRSt10error_code+0xa2): undefined reference to `if_indextoname'
/Users/attila/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj): in function `_ZN4asio6detail18signal_set_service16open_descriptorsEv':
/Users/attila/projects/esp/esp-idf/examples/wifi/scan/managed_components/espressif__asio/asio/asio/include/asio/execution_context.hpp:400:(.text._ZN4asio6detail18signal_set_service16open_descriptorsEv+0xa): undefined reference to `pipe'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /Users/attila/projects/esp/esp-idf/examples/wifi/scan/managed_components/espressif__asio/examples/tcp_echo_server/build/log/idf_py_stderr_output_14993 and /Users/attila/projects/esp/esp-idf/examples/wifi/scan/managed_components/espressif__asio/examples/tcp_echo_server/build/log/idf_py_stdout_output_14993

There is no definition for pipe and if_indextoname and I am not sure where these functions should come from.

Could you please help me to solve this issue?

euripedesrocha commented 1 month ago

Hi @moreana thanks for reporting. This is an issue that happens with IDF version 5.2.2, it is already solved in IDF 5.2 release branch. I'm trying to find a solution on ASIO build side to fix it for the released tag, in the meantime I would suggest you to use the HEAD of that IDF release branch.

ZantsuRocks commented 1 month ago

Same issue happens in 5.2.1 when using (asio::ip::udp::endpoint).address() in your code

euripedesrocha commented 1 month ago

Hi @moreana and @ZantsuRocks I was trying to find a solution from asio build side, but I believe that the cleanest path here is either:

I will still work to add more asio tests to the build to detect this issues earlier.