Cygwin interesting problems
According to this test my module JSON::Parse wasn't working on Cygwin. I have a Windows computer with Cygwin installed, so I thought I would try to compile the module myself. The first problem I encountered was that the cpan shell command didn't work. It would print odd-looking errors and hang up at the following prompt:
What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
So I decided to download the module myself with
wget and compile
it. The next problem was that I hadn't got wget in my cygwin, so I had
to install that. After downloading and untarring the file, I tried the
then "make", and got a rather baffling error
fatal error: EXTERN.h: No such file or directory
I was able to find some assistance at this site. It turned out that the C compiler gcc was not included in my cygwin, and the gcc on my path was actually the Strawberry Perl version, so I installed the Cygwin gcc.
Next, the following problem occurred.
$ make rm -f blib/arch/auto/JSON/Parse/Parse.dll g++ --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong Json3.o -o blib/arch/auto/JSON/Parse/Parse.dll \ /usr/lib/perl5/5.22/x86_64-cygwin-threads/CORE/cygperl5_22.dll \ g++.exe: error: /usr/lib/perl5/5.22/x86_64-cygwin-threads/CORE/cygperl5_22.dll: No such file or directory
I spent quite a while searching around for "cygperl5_22.dll" and related things before I noticed that the g++ in my path was pointing at the Strawberry Perl one. I had only installed gcc, because I had assumed that would be enough for my non-C++ module, but it seems to use g++ regardless of whther the code is C or C++. I went back and installed g++-gcc from the Cygwin installer (setup64.exe, see cygwin.org). Finally, with the Cygwin g++, it compiled and built the module, and I was able to reproduce the issue that the tester had demonstrated and come up with a possible solution.
Unfortunately I'm not really sure why the original problem only happened on Cygwin. There is some sort of memory management issue which I don't understand properly.