← index #18319Issue #2075
Off-topic · high · value 1.958
QUERY · ISSUE

ports/unix: Allow building and linking dynamically against libmbedtls on Linux

openby aylen384opened 2025-10-22updated 2025-10-22
enhancement

Description

It would be nice if micropython could be built against the libmbedtls from a linux distro instead of the one bundled with the sources - similar to as it works now with libffi on the unix port.

Code Size

No response

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Embedding micropython as a library (on unix)

closedby hauptmechopened 2016-05-14updated 2021-05-15

I guess this is a continuation of #1335 and #1279. Another data point for the discussion.

I was looking for a lightweight python implementation to embed. I found micropython, and after playing with it a bit decided to look at embedding it.

I started by reading unix/main.c. Not too complicated, but tightly integrated. The global context variable makes me nervous.

I read (but did not try) the two patches above. In spite of the discussion about complexity around #1279, I feel more comfortable with it because it creates the feel of a library, which is exactly what I want.

If I can grab the source, build a static and/or dynamic lib, and shove it in a system directory with an accompanying pkg-config file I'm happy. I think the worries about distributions and packaging are unfounded; I regularly create packages for Archlinux and Debian-ish systems when official ones are not available. I think that if you generate the standard outputs (lib files, include file, canonical executable), packagers will take care of the rest.

Having to locate and path-to and build the micropython source when I'm building my own source, as #1335 implies I should, feels a lot more risky.

@pfalcon Mentioned that the code is the documentation, and I totally agree as long as there is a nice comment at the top outlining the big picture.

If micropython on unix built as a library and main.c included the key include file and linked against the library, I'd need nothing more.

Anyway, sorry I don't have time to offer a patch or something. Hopefully the additional opinion is helpful.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied