Re: [rt.cpan.org #132398] PAR::Packer and fork

2020-04-25 Thread Kenneth Ölwing




In any case, fork and wait* on
Windows is a minefield.


I agree. The fundamental difference of how fork() has to be implemented 
on Windows (since it doesn't natively exist in the OS) simply makes a 
lot of things weird. It's a pseudoprocess, using an OS thread in the 
same process. This will simply trip some things up as threads and fork 
aren't the same thing.


*Some* things can work, but other things will just behave in a way that 
is hard to or impossible to work around. I've recently had to port old 
code that uses fork extensively together with XML::LibXML and there's a 
lot to massage there. In particular I think is the fact that you 
eventually reach a part in your 'fork' that does an exit() call, which 
supposedly should work correctly (and not bring the whole process down), 
but I'm assuming that it triggers something that, at least with 
XML::LibXML, isn't cool. The XML parsing part just dies 'somewhere'.


Also, depending on the Perl version things may happen. In my case I 
initially only had an ancient 5.8.9 to work with, and something in the 
forking code upset the interpreter so it always died with a core crash 
when exiting (with a nasty 'your process crashed bla bla msgbox). Now 
I've thankfully have redone so much that I'm on a 5.30 strawberry, but 
forking still doesn't work with XML. Rewriting the Windows parts using 
ithreads ('use threads') has made me able to workaround the XML stuff, 
but the process still generates errors when exiting, printing complaints 
about freeing memory that is already freed etc.


A lot of debugging of Perl and the C code in XML::LibXML might yield a 
clue but I haven't the time or inclination to even try. In short, feel 
free to try out fork/threads to make your particular usecase to work, 
but be prepared that it most likely won't work and so don't beat your 
head to the wall and accept you may need something else or just another 
approach. E.g. in some cases I rewrote stuff so I generated code on the 
fly, started a new Perl with that, and that process could do stuff I 
can't do in 'my' process. Clumsy as hell, but...


At the end, adding pp on top of the minefield becomes a non-starter, 
IMO. Sorry.


On another note however, I am **eagerly** awaiting WSL2 (i.e. 'Windows 
Subsystem Linux'). The integration this will bring is unprecedented 
(much better than WSL1 which was also really nice). Speculation abounds 
that we might even eventually see a Linux kernel to replace the NT 
kernel which would be absolutely awesome. In any case, if the 
integration is as good as I can hope, you might simply be able to ignore 
'Windows' as it is now and simply use the Linux subsystem instead and 
still have things look equal to the end users. Just hoping, but keep it 
in mind.



What do you mean by "compile a perl script in exe"?


I'd guess looking for alternatives to pp. For many years I used 
Activestate PDK that had 'perlapp' which basically does the same as pp. 
It had other nifty stuff, too. However, once I went to Strawberry and 
also had more reason to do things with multiple platforms, I'm using pp 
instead. Don't know if they still sell the PDK.


ken1


Re: Multiple entry points (MS Windows)

2020-04-24 Thread Kenneth Ölwing




Reducing installer size. Not 'installed size' since the binary needs to be
copied under two names due to the lack of symlinks.


What do you mean by 'lack of symlinks'?


Re: use Glib -> crash

2019-02-08 Thread Kenneth Ölwing
I can't help directly, but I have found 'depends' 
http://www.dependencywalker.com/ invaluable in situations like this.


Hope it helps,

ken1

On 2019-02-08 10:10, RAPPAZ Francois via par wrote:

Does Pango.xs.dll directly link to Glib.xs.dl?

I run

C:\strawberry\perl\site\lib\auto\Pango>objdump -x Pango.xs.dll | grep
"Glib.xs.dll"

DLL Name: Glib.xs.dll

FR

FROM: Roderich Schupp 
SENT: 08 February 2019 09:23
TO: RAPPAZ Francois 
CC: par@perl.org; Shawn Laffan 
SUBJECT: Re: use Glib -> crash

On Fri, Feb 8, 2019, 09:06 RAPPAZ Francois 
Adding Glib.xs.dll to my list does not change the problem: same
error


Shawn was correct that they should not be added with --lib. Also they
should be automatically detected, if not that's a bug.


Using pp_autolink.pl [1] without any other file added manualy gives
the error

Can't load


'C:\Users\rappazf\AppData\Local\Temp\par-72617070617a66\cache-c3a6620d3518bb97ef20a314815e03e1745a9234\778ce824.xs.dll'

for module Pango: load_file:The specified module could not be found
at C:/strawberry/perl/lib/DynaLoader.pm line 193.

at C:/strawberry/perl/site/lib/PAR/Heavy.pm line 123.


Does Pango.xs.dll directly link to Glib.xs.dl?


Comparing the output gavec by pp_autolink and the list I used
before, I see that

libgcc_s_sjlj-1.dll


That is always included as part of bootstrapping parl, hence
superfluous.


Strangely (for me !) the dll, Glib, Gtk2, Pango, Cairo are present
in auto/Glib etc despite they are not listed by pp_autolink


As above, they should be included automatically.


I also see that in lib/auto/ the folder Gtk2, Glib and Pango are not
renamed in _Gtk2, _Glib, _Pango


Huh?

Cheers, Roderich

Links:
--
[1] http://pp_autolink.pl