← index #6463Issue #1532
Related · high · value 0.976
QUERY · ISSUE

Using LWIP on Windows

openby gvanemopened 2020-09-21updated 2024-09-13
port-windows

First off, building MicroPython with MSVC and the ports/windows/micropython.vcxproj was exceptionally easy. Good job!

But when trying to add support for LwIP with:

  • -DMICROPY_PY_LWIP=1
  • -DMICROPY_ENABLE_SCHEDULER=1
  • Add extmod/modlwip.c and lib/netutils/netutils.c.

And trying to figure out where to add that in the .vcxproj files was not so easy. So I hacked up my own GNU-makefile.
And then getting to the link stage, I got this error:

lwip32.lib(sys_arch.obj) : error LNK2005: _sys_arch_protect already defined in MicroPython.lib(modlwip.obj)
lwip32.lib(sys_arch.obj) : error LNK2005: _sys_arch_unprotect already defined in MicroPython.lib(modlwip.obj)

Is there another define that should be set to avoid this? Adding -DNO_SYS=1 did not help.

Or are we supposed to link with a dynamic LwIP import-library? Since that works.

CANDIDATE · ISSUE

Windows port does not build in Visual Studio 2015

closedby omtinezopened 2015-10-25updated 2015-11-16
ports

I am trying to get a Micropython binary for Windows, and there are many issues with the existing port. I have made some changes that allow me to build the project, but linking fails miserably. Unfortunately, this is way out of my comfort zone so I am not able to figure out what is failing at the linking step.

My changes are summarized here: https://github.com/omtinez/micropython/commit/9ac7a21b6dc70b436064b9d5d5486b3cd08aaf21.

Some things worth noting:

  • lwIP was missing some key components regarding the OS specific implementation. I am baffled about how this project could possibly build in the past without those. I added them straight out of the lwip-contrib repo into /micropython/windows/lwip-win32
  • All references to ip_addr in lwIP are completely broken, since they all point to ipv4/lwip instead of directly lwip. I had to do a mass string-replace to get the building to work, and that is not reflected as part of the commit linked above since it's in a different repository (where does exactly the lib folder come from to get populated by the git submodule update --init command?
  • One of the changes required for the project to build affects the unix port, which I am unable to test at the moment. Special care needs to be taken to that to ensure that the unix port is unaffected by this change.

The output of the linker is the following:

Build FAILED.

"D:\git\micropython\windows\micropython.vcxproj" (default target) (1) ->
(Link target) ->
  modlwip.obj : error LNK2019: unresolved external symbol _netutils_format_inet_addr referenced in function _lwip_socke
t_recvfrom [D:\git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _netutils_parse_inet_addr referenced in function _lwip_socket
_connect [D:\git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _lwip_init referenced in function _mod_lwip_reset [D:\git\mic
ropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _pbuf_alloc referenced in function _lwip_udp_send [D:\git\mic
ropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _pbuf_free referenced in function _lwip_socket_close [D:\git\
micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _pbuf_copy_partial referenced in function _lwip_tcp_receive [
D:\git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_new referenced in function _lwip_socket_make_new [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_arg referenced in function _lwip_socket_make_new [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_accept referenced in function _lwip_socket_listen [D:\gi
t\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_recv referenced in function _lwip_socket_connect [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_err referenced in function _lwip_socket_make_new [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_recved referenced in function _lwip_tcp_receive [D:\git\
micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_bind referenced in function _lwip_socket_bind [D:\git\mi
cropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_connect referenced in function _lwip_socket_connect [D:\
git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_listen_with_backlog referenced in function _lwip_socket_
listen [D:\git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_abort referenced in function _lwip_socket_close [D:\git\
micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_close referenced in function _lwip_socket_close [D:\git\
micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _tcp_write referenced in function _lwip_tcp_send [D:\git\micr
opython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_new referenced in function _lwip_socket_make_new [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_remove referenced in function _lwip_socket_close [D:\git
\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_bind referenced in function _lwip_socket_bind [D:\git\mi
cropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_connect referenced in function _lwip_socket_connect [D:\
git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_recv referenced in function _lwip_socket_make_new [D:\gi
t\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_sendto referenced in function _lwip_udp_send [D:\git\mic
ropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _udp_send referenced in function _lwip_udp_send [D:\git\micro
python\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _dns_gethostbyname referenced in function _lwip_getaddrinfo [
D:\git\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _HAL_Delay referenced in function _lwip_socket_connect [D:\gi
t\micropython\windows\micropython.vcxproj]
  modlwip.obj : error LNK2019: unresolved external symbol _sys_check_timeouts referenced in function _mod_lwip_callback
 [D:\git\micropython\windows\micropython.vcxproj]
  modtime.obj : error LNK2019: unresolved external symbol _usleep referenced in function _mod_time_sleep_us [D:\git\mic
ropython\windows\micropython.vcxproj]
  D:\git\micropython\windows\micropython.exe : fatal error LNK1120: 29 unresolved externals [D:\git\micropython\windows
\micropython.vcxproj]

    0 Warning(s)
    30 Error(s)

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