ExifTool, ActivePerl, @INC, and making executables with pp

Started by Archive, May 12, 2010, 08:54:39 AM

Previous topic - Next topic

Archive

[Originally posted by noctilio on 2009-07-24 16:38:04-07]

I have been struggling to make stand-alone executables of my perl scripts that utilize Image-ExifTool.  I have finally succeeded thanks to much trolling of the web and messing around.  My impression is that this issue has cropped up for quite a few people, so I thought it was worth mentioning.

Running perl scripts that use ExifTool is no problem.  My @INC contains the appropriate paths to c:\perl\lib and c:\perl\site\lib.  However, when I use pp to create an executable, it can't find ExifTool, even though it is installed in what I believe is the appropriate location.  The program runs, but I get an error message that is similar to what many users have reported in similar situations: "Error while attempting to call Image::ExifTool::SetNewValue; can't locate Image/ExifTool/Writer.pl in @INC."  And the contents of @INC that follow are NOT what you get when you do perl -e "print join(\"\n\", @INC);" from the windows command line.  Using the various options in pp that allow you to specify modules to include did not work either.

My solution was to explicitly add the ExifTool directories to the @INC path inside the script - note that both paths needed to be there:

Code:
use lib "C:/Perl/site/lib/";
use lib "C:/Perl/site/lib/Image/ExifTool/";

The perl scripts run fine without these lib statements; it's only when the scripts are turned into executables that there's a problem.

Of course, I wanted to change @INC globally so that it would always contain the proper paths, and I saw a post that suggested that I need to create a windows environment variable PERL5LIB to do this - this works, in that at the command line, I can see that @INC has changed, but I get the same problem when trying to create executables.  I also saw a post that suggested the problem was something to do with ActivePerl doing something weird with @INC, and I should make another environment variable called PERL5OPT.  And I saw another post that said something about ExifTool being a "special case."  But at this point, since my executable were now working, I said, I quit!!

Does anyone have an insight into what's really going on?

Archive

[Originally posted by exiftool on 2009-07-24 17:04:48-07]

You must add all of the ExifTool modules by hand to be sure the
are included by pp.  Specifically, pp misses the autoloaded modules.
Below is the argument file I use to build the exiftool executable.
I hope this helps.

- Phil

Code:
#------------------------------------------------------------------------------
# File:         pp_build_exe.args
#
# Description:  Arguments for building stand-alone Windows executable
#
# Revisions:    2006-11-22 - P. Harvey Created
#
# Requires:     The PAR (Perl Archive) module must be installed
#
# Checklist:    [now automated by "publish_windows" script]
#
#            1) Build tag lookup: "./build_tag_lookup".
#            2) Set exiftool version number in "-T" and --info lines below.
#            3) Add any new modules to the list below.
#            4) Make sure "windows_exiftool" is up to date.
#            5) Back up "exiftool" and "cp windows_exiftool exiftool".
#            6) In a "cmd.exe" window, type "pp @pp_build_exe.args".
#            7) Change back to Unix shell and restore original "exiftool".
#            8) Rename "exiftool.exe" to "exiftool(-k).exe".
#            9) Create a .zip archive: "zip exiftool-#.##.zip exiftool\(-k\).exe".
#           10) Copy zip archive to web servers.
#           11) Update zip file version in link and text of html/index.html.
#------------------------------------------------------------------------------
-T exiftool-7.84
--info=FileVersion=7.8.4.0
--info=ProductVersion=7.8.4.0
"--info=Build Date=2009:07:16 06:55::48"
"--info=Bundled Perl Version=ActivePerl 5.8.7"
"--info=LegalCopyright=Copyright (c) 2003-2009, Phil Harvey"
"--info=ProductName=ExifTool"
"--info=Comments=ExifTool EXE for Windows"
"--info=Home Page=https://exiftool.org/"
"--info=CompanyName=Phil Harvey"
"--info=OriginalFilename=exiftool(-k).exe"
"--info=InternalName=ExifTool"
"--info=FileDescription=Read and Write meta information"
-o exiftool.exe -I lib
-M Image::ExifTool::AFCP
-M Image::ExifTool::AIFF
-M Image::ExifTool::APE
-M Image::ExifTool::APP12
-M Image::ExifTool::ASF
-M Image::ExifTool::BMP
-M Image::ExifTool::BZZ
-M Image::ExifTool::BigTIFF
-M Image::ExifTool::BuildTagLookup
-M Image::ExifTool::Canon
-M Image::ExifTool::CanonCustom
-M Image::ExifTool::CanonRaw
-M Image::ExifTool::CanonVRD
-M Image::ExifTool::Casio
-M Image::ExifTool::DICOM
-M Image::ExifTool::DNG
-M Image::ExifTool::DjVu
-M Image::ExifTool::EXE
-M Image::ExifTool::Exif
-M Image::ExifTool::Fixup
-M Image::ExifTool::FLAC
-M Image::ExifTool::Flash
-M Image::ExifTool::FlashPix
-M Image::ExifTool::FotoStation
-M Image::ExifTool::FujiFilm
-M Image::ExifTool::Geotag
-M Image::ExifTool::GeoTiff
-M Image::ExifTool::GIF
-M Image::ExifTool::GPS
-M Image::ExifTool::HP
-M Image::ExifTool::HTML
-M Image::ExifTool::HtmlDump
-M Image::ExifTool::InDesign
-M Image::ExifTool::ICC_Profile
-M Image::ExifTool::ID3
-M Image::ExifTool::IPTC
-M Image::ExifTool::ITC
-M Image::ExifTool::JPEG
-M Image::ExifTool::JPEGDigest
-M Image::ExifTool::Jpeg2000
-M Image::ExifTool::JVC
-M Image::ExifTool::Kodak
-M Image::ExifTool::KyoceraRaw
-M Image::ExifTool::Lang::cs
-M Image::ExifTool::Lang::de
-M Image::ExifTool::Lang::en_ca
-M Image::ExifTool::Lang::en_gb
-M Image::ExifTool::Lang::es
-M Image::ExifTool::Lang::fr
-M Image::ExifTool::Lang::it
-M Image::ExifTool::Lang::ja
-M Image::ExifTool::Lang::ko
-M Image::ExifTool::Lang::nl
-M Image::ExifTool::Lang::pl
-M Image::ExifTool::Lang::ru
-M Image::ExifTool::Lang::sv
-M Image::ExifTool::Lang::tr
-M Image::ExifTool::Lang::zh_cn
-M Image::ExifTool::Lang::zh_tw
-M Image::ExifTool::Leaf
-M Image::ExifTool::M2TS
-M Image::ExifTool::MakerNotes
-M Image::ExifTool::MIE
-M Image::ExifTool::MIFF
-M Image::ExifTool::Minolta
-M Image::ExifTool::MinoltaRaw
-M Image::ExifTool::MNG
-M Image::ExifTool::MPC
-M Image::ExifTool::MPEG
-M Image::ExifTool::MPF
-M Image::ExifTool::Nikon
-M Image::ExifTool::NikonCapture
-M Image::ExifTool::Olympus
-M Image::ExifTool::Panasonic
-M Image::ExifTool::PanasonicRaw
-M Image::ExifTool::PDF
-M Image::ExifTool::Pentax
-M Image::ExifTool::PhotoMechanic
-M Image::ExifTool::Photoshop
-M Image::ExifTool::PICT
-M Image::ExifTool::PNG
-M Image::ExifTool::PostScript
-M Image::ExifTool::PPM
-M Image::ExifTool::PrintIM
-M Image::ExifTool::QuickTime
-M Image::ExifTool::Rawzor
-M Image::ExifTool::Real
-M Image::ExifTool::Ricoh
-M Image::ExifTool::RIFF
-M Image::ExifTool::Sanyo
-M Image::ExifTool::Shortcuts
-M Image::ExifTool::Sigma
-M Image::ExifTool::SigmaRaw
-M Image::ExifTool::Sony
-M Image::ExifTool::Stim
-M Image::ExifTool::TagInfoXML
-M Image::ExifTool::TagLookup
-M Image::ExifTool::Unknown
-M Image::ExifTool::Vorbis
-M Image::ExifTool::XMP
-M Image::ExifTool::XMP2
-M Image::ExifTool::ZIP
-M Image::File::RandomAccess
-M Image/ExifTool/Shift.pl
-M Image/ExifTool/WriteCanonRaw.pl
-M Image/ExifTool/WriteExif.pl
-M Image/ExifTool/WriteIPTC.pl
-M Image/ExifTool/WritePDF.pl
-M Image/ExifTool/WritePhotoshop.pl
-M Image/ExifTool/WritePNG.pl
-M Image/ExifTool/WritePostScript.pl
-M Image/ExifTool/Writer.pl
-M Image/ExifTool/WriteXMP.pl
exiftool