http://qs321.pair.com?node_id=1228810

fdesar has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks,

Sorry for this long first post, I just want to explain as clearly as possible what I'm attempting to do...

Preamble:

I'm a newbie at the monastery but not a perl newbie : I started using perl with version 4, beginning of the 90's...

Since a few years I started doing paper folding artwork also known as 'Origami' ((折り紙 or おりがみ) and I use a very popular OpenSource vector-drawing software called Inkscape for drawing Origami diagrams.

Diagramming Origami require somes very specific tools for drawing, to solve geometric problems to find where a crease will fall, following the axiomatic of Origami. It's sometimes tedious so, as Inkscape allows it, I decided to write a dedicated extension for it to do that. Of course, I wrote it in Perl as Inkscape allows using various scripting languages for it, but their preferences go clearly to Python : every docs and canevas for extensions are written for and in Python. So I decided to write my own tools to get my extension working with Perl and now it does work flawlessly.

As I've always been an OpenSource enthusiastic, I logically want to share my work with others. On Linux or other Unices, no problem : Perl is always available and just adding a few modules to the standard core installations is sufficient (XML::LibXML and Local::gettext as I also made support for I18n). But unfortunately, it exists a very widely used bloated thing called Windows on which many ordinary people get stuck. And here starts the problem: neither Perl nor Python are natively available on those environments.

I solved the problem by suggesting using Active Perl and it works quite well but... it is definitely *not* free software (as in free speech, not free bear) and I don't like that!

The Inkscape Team solved this issue by optionally integrating a Python2.7 chain to their Windows distribution as they already provide a lot of useful extensions written in Python. But for Perl, nothing, nada. Which I don't like neither and it makes me angry (but I keep zen).

So I had a very strange idea : building an integrated Perl framework for Inkscape on Windows that would install on top of standard Inkscape installation that would allow Perl extension to gracefully integrate with it. And if it works, maybe I'll be able to convince the Inkscape team to integrate it later on as an option within their main distribution, who knows...

For that, I need to do a number of things, all theoretically feasible I think :

1. Build a native Perl on Windows relative to the Inkscape installation directory (having an @INC pointing to (?)/Inkscape/lib/perl5)

2. Build the Lib::LibXML module for it (absolutely mandatory as Inkscape works upon SVG)

3. Build other few modules as Locale::gettext, for example, as gettext is their I18n implementation

4. Write a basic framework (in fact a module) for building extensions (mostly already done as I already wrote one for my own use but it needs to be more generalized/structured), as there is one for Python

5. Write an installer to setup things easily for dummy end-users (mainly copying the Perl executable and libraries into the installed Inkscape directory)

If all of this seems weird to you, just tell me and stop reading further...

Now, the problem:

I'm stuck on stage 1: building Perl on a windows system !

I tried many things, read a lot of threads, used a lot of configurations, from Straberry Perl, MingWin64 (MSYS2) to Visual Studio C++ Community 2017 and every thing failed:

- Strawberry Perl, no succes. I don't remember why I decided to give up, probably because using cygwin, it won't build a native Windows Perl...

- MingWin64 (MSYS2), no success, I get a fatal compiling error for a missing poll.h include file

- VS 2017 community is much better, as nmake completes the compilation correctly, but I get a fatal error running nmake test:

Test Summary Report ------------------- ../cpan/File-Temp/t/mktemp.t (Wsta +t: 6400 Tests: 5 Failed: 0) Non-zero exit status: 25 Parse errors: Bad plan. You planned 9 tests but ran 5. ../ext/File-Find/t/find.t (Wsta +t: 3328 Tests: 125 Failed: 0) Non-zero exit status: 13 Parse errors: Bad plan. You planned 137 tests but ran 125. ../ext/IPC-Open3/t/IPC-Open3.t (Wsta +t: 0 Tests: 45 Failed: 0) TODO passed: 25 ../ext/XS-APItest/t/locale.t (Wsta +t: 2304 Tests: 2 Failed: 0) Non-zero exit status: 9 Parse errors: No plan found in TAP output Files=2666, Tests=1088273, 1731 wallclock secs (66.19 usr + 6.66 sys += 72.84 CPU) Result: FAIL NMAKE : fatal error U1077: '.\perl.exe' : code retour '0x3' Stop.

and, of course, nmake install won't work.

And finally, the question:

What to try next ?

If anyone's interested in helping me mongering Perl on Inkscape, you're very welcome ;-)

PS : my extension is available to download and test at https://github.com/fdesar/Origami-Ext