Getting started: error opening shell on Windows via Cygwin

Hi Pixhawk/PX4 community,

I am trying to get started with the first application (Hello Sky) on Pixhawk 4 from the PX4 docs. Developing on a windows PC, I wrote an compiled the application using the Cygwin toolchain, and successfully uploaded it to the Pixhawk.

However, I can’t get a shell to open to communicate with the Pixhawk. When I try to pip-install pymavlink and pyserial The following error occurs upon the installation of the lxml package

Error: Please make sure the libxml2 and libxslt development packages are installed.

This is an issue that apparently more people have when installing lxml on Windows. I have tried the following solutions:

1. install lxml with prebuilt binary
The most heard solution for Windows on stackexchange is to dowload a prebuilt binary wheel and install this with pip.

When I try this for the python 3.6 version (cp36, 64bit) or any of the other wheels, it gives the error

$ pip3 install lxml-4.5.2-cp36-cp36m-win_amd64.whl
ERROR: lxml-4.5.2-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

None of the wheels in the list seem to work, maybe because of the Cygwin environment?

2. copy the libxml2 and libxslt files over to the toolchain/cywin64/bin folder
As per these instructions, you can just dowload the libxml2 and libxslt packages from here and place the files from the bin folder in toolchain/cywin64/bin.

As the original author writes, the libxml2 and libxslt packages depend on zlib and iconv, so I also copied the contents of those packages over.

When testing their installation using xmllint --version it does return something:

$ xmllint --version
xmllint: using libxml version 20909
  compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib Lzma

but for xsltproc --version, the following error appears:

$ xsltproc --version
C:/PX4/toolchain/cygwin64/bin/xsltproc.exe: error while loading shared libraries: libxml2-2.dll: cannot open shared object file: No such file or directory

This I find very strange because the file is actually there in toolchain/cywin64/bin. Maybe I should place the files in another location?

3. run the shell outside of Cygwin

Interestingly, I can install lxml on my local install of Python. This made me question whether I could not just open the shell outside of the Cygwin console. I therefore made a local venv, pip installed pymavlink and pyserial and tried to run Tools/ from there.

However, this script relies on the termios package, which is only available for Unix.

By now I am out of options what to do to make the shell connection work. I hope that someone here knows how to solve this issue. Probably other developers using the Cygwin toolchain must have come across the same problems.

Thanks a lot for your help/thoughts!