Build problem, include library?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
davef
Posts: 178
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Build problem, include library?

Post by davef » Sun Aug 02, 2020 4:00 am

Trying to build in ussl support for STM32, specifically axtls and get
the following error:.

Code: Select all

In file included from ../../lib/axtls/ssl/ssl.h:75:0,
                 from ../../extmod/modussl_axtls.c:37:
../../lib/axtls/ssl/tls1.h:43:21: fatal error: version.h: No such file or directory
 #include "version.h"
I see that there is a version.h file in my /micropython-1.12/micropython/extmod/axtls-includes/ folder.

I read about a similar problem in:
https://github.com/micropython/micropyt ... untu-16.04
... but before I get a hold of a 64bit Linux box with the latest Ubuntu installed and then
go and get the latest arm-none-eabi-gcc I just wanted to be fairly sure that I wasn't
doing something else wrong.

I can build the port I want without including ussl so it makes me think that it is
not a compiler issue.

Using Xubuntu 14.04LTS and
arm-none-eabi-gcc 4.9.3
Any clues appreciated.
Dave

azubi777
Posts: 3
Joined: Mon Aug 03, 2020 12:34 pm

Re: Build problem, include library?

Post by azubi777 » Mon Aug 03, 2020 1:07 pm

Sup

it is not a compiler problem. As the error says the compiler couldn't find the header file.
I don't know which IDE you are using but try to add it through your IDE to your project files manually.
Or if its a built-in header file try

Code: Select all

#include <version.h> 

Cheers,
777

davef
Posts: 178
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Build problem, include library?

Post by davef » Mon Aug 03, 2020 7:39 pm

I am building from the command line.

I can build ussl in the unix port, but not for the stm32 default PYBV10 port.

I tried changing #include "mbedtls/version.h" to #include <version.h> in moduhashlib.c and got the same result.

I assume that one modifies the /stm32/mpconfigport.h to add in the following:

Code: Select all

#define MICROPY_PY_USSL  (1)
#define MICROPY_SSL_MBEDTLS  (1)
Thanks for the suggestion.
Dave

Atzingen
Posts: 2
Joined: Tue Feb 23, 2021 3:28 am

Re: Build problem, include library?

Post by Atzingen » Tue Feb 23, 2021 3:32 am

Having a similar problem on pyboard v1.1

can not import ussl using the latest pre build firmware.

Buil firmware works without adition of MICROPY_PY_USSL (in mpconfgport.h).
Tried add MICROPY_SSL_MBEDTLS and MICROPY_SSL_AXTLS to the config but a similar problem to this thread arised.

GEN build-PYBV11/genhdr/moduledefs.h
GEN build-PYBV11/genhdr/qstr.i.last
../../extmod/moduhashlib.c:35:10: fatal error: mbedtls/version.h: No such file or directory
35 | #include "mbedtls/version.h"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
../../extmod/moducryptolib.c:64:10: fatal error: mbedtls/aes.h: No such file or directory
64 | #include <mbedtls/aes.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
In file included from mbedtls/mbedtls_port.c:30:
mbedtls/mbedtls_config.h:97:10: fatal error: mbedtls/check_config.h: No such file or directory
97 | #include "mbedtls/check_config.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from ../../lib/mbedtls_errors/mp_mbedtls_errors.c:25:
./mbedtls/mbedtls_config.h:97:10: fatal error: mbedtls/check_config.h: No such file or directory
97 | #include "mbedtls/check_config.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
../../extmod/modussl_axtls.c:36:10: fatal error: ssl.h: No such file or directory
36 | #include "ssl.h"
| ^~~~~~~
compilation terminated.
../../extmod/modussl_mbedtls.c:40:10: fatal error: mbedtls/platform.h: No such file or directory
40 | #include "mbedtls/platform.h"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

User avatar
jimmo
Posts: 2244
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Build problem, include library?

Post by jimmo » Wed Feb 24, 2021 12:54 am

davef wrote:
Sun Aug 02, 2020 4:00 am
Trying to build in ussl support for STM32, specifically axtls and get
ANy reason why specifically axtls? I think only build configuration for mbedtls is provided in the STM32 port?

You need three things:
- The submodule needs to be downloaded
- The makefile variables need to be set (e.g. in mpconfigboard.mk or on the make command line)
- The C macros need to be set. (Note: this happens automatically in extmod/extmod.mk if the makefile variables are set)

So for example, on PYBD_SF2, all that needs to be done is to set

Code: Select all

MICROPY_PY_USSL = 1
MICROPY_SSL_MBEDTLS = 1
in boards/PYBD_SF2/mpconfigboard.mk
Atzingen wrote:
Tue Feb 23, 2021 3:32 am
Having a similar problem on pyboard v1.1
I think it looks like you're missing the submodule.

Code: Select all

git submodule update --init lib/mbedtls

Atzingen
Posts: 2
Joined: Tue Feb 23, 2021 3:28 am

Re: Build problem, include library?

Post by Atzingen » Wed Feb 24, 2021 3:42 am

firmware with ssl was compiled and board booted just fine.
Was able to import the ssl library but it give a error when trying to wrap a socket connection. Same code worked fine on micropython in esp32. socket working fine on stm32 with wiz5500 adaptor, justo not with ssl.


addr = socket.getaddrinfo('micropython.org', 80)[0][-1]
s = socket.socket()
s.connect(addr)
ssl.wrap_socket(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: stream operation not supported

davef
Posts: 178
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Build problem, include library?

Post by davef » Wed Feb 24, 2021 6:19 am

Maybe this will help, from umail.py

Code: Select all

 def __init__(self, host, port, ssl=False, username=None, password=None):
        import ussl
        self.username = username
        addr = usocket.getaddrinfo(host, port)[0][-1]
        sock = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
        sock.settimeout(DEFAULT_TIMEOUT)
        sock.connect(addr)
        if ssl:
            sock = ussl.wrap_socket(sock)
ie SOCK_STREAM

davef
Posts: 178
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: Build problem, include library?

Post by davef » Wed Feb 24, 2021 6:24 am

jimmo,

Thanks for the response but a lot of water has gone under the bridge since then. I realised that what I was trying to do ... eventually talk to a 3G dongle over USB using a "Black Pill" was too much for this guy.

Post Reply