eclipse-zenoh / zenoh-pico

Eclipse zenoh for pico devices
Other
120 stars 74 forks source link

Build zenoh-pico on Windows 10 #168

Closed Mallets closed 1 year ago

Mallets commented 1 year ago

Discussed in https://github.com/eclipse-zenoh/roadmap/discussions/80

Originally posted by **lanner17** March 1, 2023 Hi Trying to build zenoh-pico on Windows 10 for experimenting. I created a build directory and then ran this command `cmake -G "Visual Studio 16 2019" ..` and then `cmake --build . --config Release` It seems to build ok excepts for one repeated warning on almost every file, example ``` C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winbase.h(9305,5): warning C5105: macro expansion produc ing 'defined' has undefined behavior [C:\Projects\zenoh\zenoh-pico\build\z_sub_st.vcxproj] ``` It also builds the examples, but I am not able to run the examples. Both `z_pub.exe` and `z_sub.exe` only run to the point where it prints `Opening session...` to the command window. I expected it to progress further than this. For example I expected `z_pub `to print `Declaring publisher for `, but it seems to be blocking on either `zp_start_read_task `or `zp_start_lease_task` ? I also ran a zenoh router, however, it may be not compatible since I build it some time ago. Thanks
cguimaraes commented 1 year ago

The warning is an issue on Windows SDK. If you just want to silence it try #pragma warning(suppress : 5105) (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5105).

On the other issue, I am pretty sure the Windows firewall is blocking the multicast traffic (used to scout for a router or peer) in the session establishment. In order to properly debug it, please provide: 1) More details about your experimental setup. For example, which entities are running, if all in the same machine or across different machines, and their operating system. The more information you can share with us the better. 2) Enable ZENOH_DEBUG=3 and share the logs with us. 3) Wireshark captures are also helpful.

Also, try to execute the examples with a static locator (e.g. z_pub.exe -e tcp/127.0.0.1:7447) and let us know what is the result.

lanner17 commented 1 year ago

Hi @cguimaraes, thank you, I resolved it. I upgraded zenohd to v0.7.0-rc from 6. After that I was able to run the pub and sub examples. Apologies, I should have upgraded first before I raised the question. I started zenohd with zenohd.exe -l tcp/127.0.0.1:7447 and that seems to work. However, I have to run the subscriber a few times before it will connect. zenohd prints these errors (it connected the fifth time):

[2023-03-02T20:45:18Z INFO  zenohd] Finished loading plugins
[2023-03-02T20:45:30Z ERROR zenoh_transport::unicast::establishment::accept] Invalid Message: Decoding error on link: tcp/127.0.0.1:7447 => tcp/127.0.0.1:54685 at io\zenoh-link-commons\src\lib.rs:206.
[2023-03-02T20:45:32Z ERROR zenoh_transport::unicast::establishment::accept] Invalid Message: Decoding error on link: tcp/127.0.0.1:7447 => tcp/127.0.0.1:54686 at io\zenoh-link-commons\src\lib.rs:206.
[2023-03-02T20:45:32Z ERROR zenoh_transport::unicast::establishment::accept] Invalid Message: Decoding error on link: tcp/127.0.0.1:7447 => tcp/127.0.0.1:54687 at io\zenoh-link-commons\src\lib.rs:206.
[2023-03-02T20:45:33Z ERROR zenoh_transport::unicast::establishment::accept] Invalid Message: Decoding error on link: tcp/127.0.0.1:7447 => tcp/127.0.0.1:54688 at io\zenoh-link-commons\src\lib.rs:206.
cguimaraes commented 1 year ago

The wire protocol version was bumped between in v0.7.0 as we did some enhancements. For the moment, we require that components to be running in the same version.

As for the new issue, I will double check when I get access to a Windows machine. In the meantime, can you share a Wireshark capture of those invalid messages?

lanner17 commented 1 year ago

I tried to do a Wireshark capture, but discovered it is not straightforward to do a capture on the local (127.0.0.1) interface on Windows. There are some workarounds, but I am not ready to apply those to the company computer yet. For me, it is not a big deal, I am just exploring zenoh-pico.

lanner17 commented 1 year ago

Hi @cguimaraes, I added an additional interface to the command line and I believe I was able to capture two connection attempts by z_pub that failed. The Wireshark capture is attached. Hope it helps. z_pub.zip

cguimaraes commented 1 year ago

I only see the multicast packets sent by Zenoh for the scouting process. I do not see any other message related to Zenoh protocol.

Is zenohd running and accessible through the multicast path? Did you make sure that your Windows firewall is not blocking multicast?

cguimaraes commented 1 year ago

@lanner17 any update?

lanner17 commented 1 year ago

Hi @cguimaraes , my apologies. I did not have time to dig deeper into this and was just happy to build it on Windows and run it. This is a project on the side to consider alternative middleware and the actual target is actually vxWorks. So, the issue about the multiple connection attempts is not really a concern for me.

cguimaraes commented 1 year ago

I am closing this issue for the moment then. If you cross again with it, just reopen it or create a new one issue.

Regarding VxWorks, if that is the actual target we would be happy to know more about what you might need for such port and what is your target use case(s). I suggest either you create a new feature request (in the same tab as issues) or to initiate a discussion on our Discord channel.