To make it easier for our customers to extract images out of PDF files without using our cloud-based PDF conversion process, I decided to investigate the use of the Python Image Library to build a utility program.
After downloading the source code, I tried to build it and soon ran into errors such as the following:
lipo: can't open input file: /var/folders/.........(No such file or directory)
error: command 'gcc' failed with exit status 1
lipo: can't open input file: /var/tmp//ccptvQXL.out (No such file or directory)
Turns out this was happening because my system doesn’t have the ppc binaries (nor do I want them) and one of the options being passed to the gcc compiler is
I looked around on the web and found a few pages that described this error.
However, the suggested solutions were all rather painful or awkward. I decided to trace into the setup.py file to see from where it was getting the compiler options. To cut a long story short, I discovered very quickly that there’s an environment variable called ARCHFLAGS and if that is defined, then it is used before other mechanisms.
So I simply typed the following into the terminal window
export ARCHTYPES="-arch i386 -arch x86_64"
python setup.py install
and everything just built and installed with no problem whatsoever.
If you do this kind of thing often, it might be worth setting the environment value in your .bash_rc or .profile