Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Re: Importing external dependencies into source

by crabbdean (Pilgrim)
on Mar 04, 2004 at 10:44 UTC ( #333827=note: print w/replies, xml ) Need Help??

in reply to Re: Importing external dependencies into source
in thread Importing external dependencies into source

Thanks, I've already got cygwin installed, this is where I've got my GNU find.exe from.

I'm currently working on the correct syntax of how to use the GNU find.exe in my script so that it properly uses it once compiled INTO a single exe. I'll either post a full answer with syntax and compile commands or in a few hours issue a post to get further assistance. The answer I'm sure will be useful to a lot of people (and myself) so that the external dependency is gone and it offers a good solution that doesn't utilise the File::Find module.


Programming these days takes more than a lone avenger with a compiler. - sam
  • Comment on Re: Re: Importing external dependencies into source

Replies are listed 'Best First'.
Re: Re: Re: Importing external dependencies into source
by crabbdean (Pilgrim) on Mar 04, 2004 at 12:59 UTC
    Okay, finally here is the solution to compiling external source GNU applications into your Perl source on Win32 systems using compiler. My GNU applications came from an installation of cygwin or

    As per IndigoStar's manual page you have to use the "-tiny" option when compiling your source.

    perl2exe -tiny /path/to/your/source/code/
    In your Perl source code you also have to add in commands to "include" the external dependent modules into your EXE at compile time.
    #perl2exe_bundle "C:\cygwin\bin\find.exe" #perl2exe_bundle "C:\cygwin\bin\cygwin1.dll" #perl2exe_bundle "C:\cygwin\bin\cygintl-1.dll" my $this_dir = $ENV{TEMP} || $ENV{TMP} || ($^O eq "MSWin32" ? $ENV{WIN +DIR} : '/tmp');
    For this example I'm importing GNU find.exe. The extra DLL's are required also by cygwin. If you run it without these DLL's compiled you get an error requesting you import them also. And yes the hash (#) at the beginning of the line is required.

    The last line there is important, once its compiled how does your application know where the compiled components will reside at runtime? IndigoStar's compiler makes temporary copies of the imported programs to a temporary directory, which are removed at the end of execution. Where that temporary directory actually is for your system is based on this command, so use it yourself. Then in your code when you utilise the "find.exe" add this variable into your code so your program can find it.
    open( FIND, "$this_dir\\find . -type d -print0 |" ) or die "can't run find: $!";
    This will compile all the external dependencies into one exe, with a few extra dll's that are created because of the "-tiny" option. This is now fully portable to any other box, and doesn't require perl or cygwin installed. No more dependencies!!


    Programming these days takes more than a lone avenger with a compiler. - sam
      I would strongly suggest not using the cygwin version of GNU find and including the cygwin DLLs. The cygwin DLLs do not like having multiple copies installed so if anybody has Cygwin already installed and running, then this will cause problems. Not to mention all the fun with mount points.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333827]
[LanX]: Question: starting a script from an icon in Windows, but after C-c the window closes ... what I want is to restart in the cmd.exe. Recommendations?
[Corion]: LanX: What do you mean by "restart in the cmd.exe" ?
[Corion]: Do you want to launch a script and keep the command prompt/console window open?
[Corion]: Do you want to wait for a key press before closing the window?
[LanX]: I want the command line in the history
[tye]: -Mouse
[Corion]: Option a) would mean launching cmd.exe /k c:\path\to\ batchfile- launching-perl- script.cmd. Option b) would be to add pause as the last line of said batch file.
[LanX]: First day after holidays ... and already stressed by the fact that colleagues changed stuff without communication ... apparently I'm the only one trying to fight entropy
[Corion]: LanX: The command is always in the history if you typed it in before. If you didn't type the command into the command line, it will not be there. I think there is doskey which can stuff command lines into the history
LanX damns the cult of CB ;-)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2017-03-27 15:44 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.