Web lists-archives.com

Re: Is our use of Cygwin to build & run OpenOCD a good one?




On 19.05.2019 22:43, Bob Cochran wrote:
> And, I received the 
> following feedback:
> 
> "Cygwin? this is probably still functional, but now can be considered a 
> (pre)historic solution."
> 
> I personally have been using Cygwin for many years and have come to 
> trust it for interfacing to Linux and macOS boxes from Windows.  I think 
> it's a great project, so when I wanted to build & run OpenOCD from 
> scratch, I naturally went to Cygwin.
> 
> I would appreciate any feedback on our use of Cygwin for building & 
> running OpenOCD: https://mindchasers.com/dev/openocd-darsena-windows
> 

Cygwin allows you to compile programs written for *nix (specifically - for
Linux) with [almost] no changes to the source code, producing Windows
executables that run on Windows. That is achieved by using a compatibility
runtime (the Cygwin DLL).

This is useful if:
1) The code you're compiling is not Windows-compatible (i.e. can't be compiled
with MinGW against MinGW SDK).
2) You're OK with a dependence on Cygwin runtime
3) You're OK with a possible performance hit that the runtime incurs. The
amount of the performance you lose varies; might be negligible; might be
significant - depends on what the code does.

I grepped OpenOCD code, and it seems to me that it is Windows-compatible
(README.Windows even says so explicitly). In that case you should probably
cross-compile it to Windows (see autotools documentation on cross-compilation).
You *can* cross-compile from Cygwin, but cross-compiling from *nix will be
wa-a-ay faster.

You can also use MSYS2 to compile it on Windows (without doing
cross-compilation). Most likely the process won't be any faster than
cross-compiling from Cygwin.

Since OpenOCD uses autotools, these are your only options (if it were using
CMake or Meson, you might have been able to build at least the binaries with
just MinGW-w64 SDK and the buildsystem; but for autotools you need a
fully-functional POSIX shell, meaning Cygwin, MSYS2 or the real *nix shell
running on *nix).

There's also the modern, "hip" way of using Windows POSIX subsystem (these days
it's called "WSL", i think?) to run the necessary tools, but don't see any
significant practical advantages to doing that (you still can't get zero-cost
fork this way), whereas ethical ramifications might be significant.

Attachment: signature.asc
Description: OpenPGP digital signature