Skip to content

Using both NET_SOCKETS_SOCKOPT_TLS and POSIX_API fails build #33291

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

Closed
marinbudimir opened this issue Mar 12, 2021 · 3 comments
Closed

Using both NET_SOCKETS_SOCKOPT_TLS and POSIX_API fails build #33291

marinbudimir opened this issue Mar 12, 2021 · 3 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@marinbudimir
Copy link

marinbudimir commented Mar 12, 2021

Describe the bug
In my project I am using MQTT TLS so I have CONFIG_NET_SOCKETS_SOCKOPT_TLS=y. I am also using Zephyr ESP32 WiFi drivers which automatically select POSIX_API. Build fails when using both of this.

To Reproduce
Steps to reproduce the behavior:

  1. make any zephyr project
  2. put following config in prj.conf file
#NET_SOCKETS_SOCOPT_TLS dependecies
CONFIG_NET_SOCKETS=y
CONFIG_NETWORKING=y

CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_POSIX_API=y
  1. try to build zephyr project
  2. see error

Expected behavior
Zephyr project builds successfully

Logs and console output

[237/293] Building C object modules/mbedtls/CMakeFiles/..__modules__crypto__mbedtls.dir/library/ssl_cli.c.obj
In file included from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform.h:68,
                 from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_cli.c:56:
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_cli.c: In function 'ssl_generate_random':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform_time.h:99:24: warning: implicit declaration of function 'time'; did you mean 'gmtime'? [-Wimplicit-function-declaration]
 #define mbedtls_time   time
                        ^~~~
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_cli.c:724:9: note: in expansion of macro 'mbedtls_time'
     t = mbedtls_time( NULL );
         ^~~~~~~~~~~~
[239/293] Building C object modules/mbedtls/CMakeFiles/..__modules__crypto__mbedtls.dir/library/ssl_srv.c.obj
In file included from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform.h:68,
                 from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_srv.c:56:
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_srv.c: In function 'ssl_write_server_hello':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform_time.h:99:24: warning: implicit declaration of function 'time'; did you mean 'gmtime'? [-Wimplicit-function-declaration]
 #define mbedtls_time   time
                        ^~~~
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_srv.c:2479:9: note: in expansion of macro 'mbedtls_time'
     t = mbedtls_time( NULL );
         ^~~~~~~~~~~~
[247/293] Building C object modules/mbedtls/CMakeFiles/..__modules__crypto__mbedtls.dir/library/x509.c.obj
In file included from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform_util.h:61,
                 from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/cipher.h:64,
                 from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/oid.h:64,
                 from /home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/x509.c:67:
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/x509.c: In function 'x509_get_current_time':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/include/mbedtls/platform_time.h:99:24: warning: implicit declaration of function 'time'; did you mean 'gmtime'? [-Wimplicit-function-declaration]
 #define mbedtls_time   time
                        ^~~~
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/x509.c:935:10: note: in expansion of macro 'mbedtls_time'
     tt = mbedtls_time( NULL );
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(ssl_cli.c.obj):(.literal.mbedtls_ssl_handshake_client_step+0x38): undefined reference to `time'
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(ssl_cli.c.obj): in function `ssl_generate_random':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_cli.c:707: undefined reference to `time'
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(ssl_cli.c.obj): in function `ssl_parse_server_hello':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_cli.c:1894: undefined reference to `time'
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(ssl_srv.c.obj): in function `ssl_parse_client_hello':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_srv.c:2011: undefined reference to `time'
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(ssl_srv.c.obj): in function `ssl_write_server_hello':
/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/ssl_srv.c:2483: undefined reference to `time'
/home/users/mbudimir/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: modules/mbedtls/lib..__modules__crypto__mbedtls.a(x509.c.obj):/home/users/mbudimir/zephyrproject/modules/crypto/mbedtls/library/x509.c:935: more undefined references to `time' follow
@marinbudimir marinbudimir added the bug The issue is a bug, or the PR is fixing a bug label Mar 12, 2021
@sylvioalves sylvioalves self-assigned this Mar 15, 2021
@jukkar
Copy link
Member

jukkar commented Mar 16, 2021

There are conflicts if one selects CONFIG_POSIX_API and mbedtls. You can also try to unset CONFIG_NET_TCP_ISN_RFC6528=n if it helps (see commits 51beb28 and 6526b5b for details).

@galak galak added the priority: low Low impact/importance bug label Mar 16, 2021
@mniestroj
Copy link
Member

undefined reference to time could be solved by #33397.

@marinbudimir
Copy link
Author

undefined reference to time could be solved by #33397.

This solves the problem.

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

No branches or pull requests

5 participants