Problems creating a redistributable binary for Mac OS-X
Added by Bob Davies over 12 years ago
Hey all.
I'm trying to build a redistributable version of the exiv2 binaries for mac (and linux) in command-line form to go into a firefox extension.
I'm having problems rebuilding the executable and dependencies into a neat package which can be executed from any desktop (so I don't have to tell users to go install MacPorts or Fink, then which packages to install from there (Sadly my userbase have little-to-none techie skills). I only really need to support 10.5, but below that would be a 'nice to have'.
I'm wondering if anyone here has had any success compiling Exiv2 into something neat for Mac (like the Windows executable) ? or might have any tips how to go about doing so?
Thanks for the Help.
Bob
Replies (6)
RE: Problems creating a redistributable binary for Mac OS-X - Added by Andreas Huggel over 12 years ago
Hi Bob,
What about something like this:
$ cd exiv2-0.18.2 $ ./configure --disable-shared $ make
to build a standalone static binary src/exiv2.
(Add $ strip src/exiv2
to discard symbols from the file and make it slightly smaller.)
Andreas
RE: Problems creating a redistributable binary for Mac OS-X - Added by Bob Davies over 12 years ago
That looks like it may be the perfect solution, will just figure out how to stop windows clearing the executable bit when I wrap it into my extension xpi and it may just work.
Thanks soooo much :) Beats the proverbial c**p out of my previous solution of shipping with a Macport-ed .pkg and hoping I could manage the install :)
Cheers Andreas, another of your always-fantastic responses gratefully recieved :)
RE: Problems creating a redistributable binary for Mac OS-X - Added by Robin Mills over 12 years ago
As always, Andreas is 100% correct in his solution and this will build a static version of exiv2.
If you want to distribute this to all Mac users, you may wish to build a "Universal" binary which includes the code for both Intel and PPC macs. I have been able to do this by building the i386 version on my iMac and the PPC version on my (elderly) PowerBook Pro - and then combining them together with lipo. If you want this (and can't build it for yourself), I'd be happy to build it and send you the binary. Let me know.
Robin
RE: Problems creating a redistributable binary for Mac OS-X - Added by Bob Davies over 12 years ago
Finally got it all up and running :) Thanks for the help :)
Cheating a little to stop windows wiping my permission-bits by zipping it, then unzipping within the extension the first time a user requires it :)
Robin I saw your excellent article about compiling a Universal Binary, but I must confess ~90% of it went way over my head. (I was until recently a C# developer lol :)
I'd give it a go but without a ppc system to build on I think I'd be totally stumped.
If you have a universal binary available I'd love to run it, but if not no worries :)
Thanks
Bob
RE: Problems creating a redistributable binary for Mac OS-X - Added by Robin Mills over 12 years ago
Bob
Here's the build:
http://clanmills.com/files/exiv2-0.18.2-MacUniversalStatic.zip
I created the archive with the 'zip' command which I believe preserves the x-bit.
The difficulty in building a universal exiv2 on a Mac is cross compiling. The build seems to be determined to produce a native build. So on the PPC it builds for PPC and on Intel for i386. So you really need a PPC to build the PPC version. I don't think this is an exiv2 issue - I think it's in the dependent libraries. Apple provide a Tech Note about creating universal builds: http://developer.apple.com/technotes/tn2005/tn2137.html
Once things are built, combining them together is easy with lipo:
lipo -arch ppc path/to/ppc/exiv2 -arch i386 path/to/i386/exiv2 -create -output path/to/universal/exiv2
I built the ppc version on Tiger (10.4) using the following commands:
./configure --disable-shared MACOSX_DEPLOYMENT_TARGET=10.4
make MACOSX_DEPLOYMENT_TARGET=10.4
I have much longer and more detailed build notes for building exiv2 and pyexiv2 at:
http://clanmills/articles/gpsexiftags/macos.shtml
The latest Mac/Universal (and Windows) build of pyexiv2 for Python 2.6 can be download from:
http://clanmills.com/files/pyexiv2-0-1-3+exiv2-0-18.zip
Tester's welcome!
RE: Problems creating a redistributable binary for Mac OS-X - Added by Bob Davies over 12 years ago
Heya Robin.
That's phenomenal :) Thanks so much for taking the time to build it :) Hugely appreciated :)
Bob