[tpm] PAR::Packer and cygwin

Stuart Watt stuart at morungos.com
Mon Jun 10 06:29:25 PDT 2013


Hi Fulko, comments in context below. 

On 2013-06-07, at 11:42 AM, Fulko Hew wrote:

> After a lot of fighting... I've made some progress on my battle
> of using PAR to package my app on various OSs.

Well done! 

> 
> [I've gotten something built on Solaris and now I just have to find out
> how to make a proper pkgadd package out of it.]
> 
> But my question of the day is really the MS Windows / Cygwin environment.
> I hope you (or anyone else) can help…
> 

A few notes below. 

> 
> When I run my Cygwin/PAR application under a DOS shell
> (with PATH also pointing to c:\cygwin\bin)  it now actually
> starts my app, but it immediately dies with:
> 
> Can't locate File/Temp.pm in @INC ...
> 
> Is it because of slash versus backslash?

As a rule, all the versions of Windows that matter understand forward slashes anyway. So the syntax is just fine. On Windows, I used / for everything. The only issue is that when you get a pathname back from Perl, it might contain \ characters, so I used a *lot* of s{\\}{/}g in my file access logic when I wanted stuff to be portable.  

> Is it because @INC contains entries like /usr/lib/perl5…

Very possible. I think cygwin does some funny path hacking, and maps stuff like /usr/... to some other place on the file system. As a rule, cygwin binaries need to be run under cygwin to overcome this. So you can probably par stuff up, but they will still only run on a cygwin runtime, not a straight Windows command line. 

> Is it because the @INC entries are rooted at '/' and Windows
>   doesn't understand that and Cygwin modules aren't kicking in?

Which is part of the issue above. So yes, even if you build a par, it'll only run under a cygwin runtime. What you might be able to do is use something like the NSIS installer to package up a cygwin runtime and the par file. That's a lot of work, and from what I recall there were some license oddities in cygwin which made that problematic. 

However, I did find this (at: http://www.ghettocode.net/perl/PARPackerHowTo)

So you (a) this might be fun, and (b) the second build of Perl might be an issue. 

> 2. Don't use this on a system with Cygwin.
>     - If you can get this working, you're god damn awesome.
>       Cygwin takes the liberty of installing a second build
>       of Perl in $PATH and completely fucks up your lib path.
>       Uninstalling Cygwin is not really an adventure in
>       awesome. Just don't do it.


> 
> Any clues?
> 
> Fulko
> 
> PS:  For those not privy to my earlier background discussions:
> 
> - I can't use Strawberry Perl because some of the modules I need
>   don't work under it, only works under Cygwin Perl.
> 
> - I'm trying to make a single executable for distribution
>   (that's what PAR is for)
> 
> - It needs to be invokable from DOS (srvany) and not from within
>   CYGWIN's terminal window



I will personally and publicly call you "god damn awesome" if you manage this. 
--
Stuart Watt
stuart at morungos.com / 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20130610/2d3b359b/attachment.html>


More information about the toronto-pm mailing list