Installing swftools and pdf2swf on Ubuntu Linux
Hello,
I’ve been using swftools, mainly pdf2swf functionality, for a while now and installation always sucked. Google usually provides good results for common problems, but lack of a step-by-step installation guide is lacking.
Main site, http://swftools.org, has pretty good wiki for documentation and a tidy installation walkthrough. Unfortunately for me I had a ton of problems getting pdf2swf to work properly on Amazon’s AWS Ubuntu server (ami-5059be39 – ubuntu-intrepid), but fortunately for you I finally got it working and also put together this guide, which will hopefully save you some time.
Note: swftools version that comes default with aptitude would not work for me hence the need to compile from source.
Note2: this guide assumes the distro is up to date and all system libraries have been installed from Installing RoR on Ubuntu post
Get necessary libraries and extract
wget http://swftools.org/swftools-0.9.0.tar.gz tar -zvxf swftools-0.9.0.tar.gz wget http://www.ijg.org/files/jpegsrc.v7.tar.gz tar -zvxf jpegsrc.v7.tar.gz wget http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz tar -zvxf freetype-2.3.12.tar.gz
Note: v8 produced errors in swftools install so I grabbed v7, which worked wonderfully.
Now order of install. First we install jpeg:
cd jpegsrc.v7 sudo ./configure sudo make sudo make install
Freetype is a little trickier. For install you have to reset cache, set flags, run ranlib (not sure why but it wouldn’t work without for me, if you know I’d love an explanation)
cd freetype-2.3.12 rm -f config.cache sudo ranlib /usr/local/lib/libjpeg.a sudo ldconfig /usr/local/lib sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure sudo make sudo make install
If you want to be able to convert pdf files into text you have to install xpdf. Fortunately aptitude does provide us with the right libraries this time.
sudo apt-get install xpdf-reader
And now for the final step:
cd swftools-0.9.0 sudo LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include" ./configure sudo make sudo make install
Big thanks to swftools for making this possible.
Best,
Mikhail
Edit (3/3/2011): Updated code formatting.
Extremely helpful — thank you!
-JP
Thanls a lot for this recipe like. Works like a sunny day at the beach. 😀
Very helpful! Thanks. This tutorial helped me installing Swftools on Mac OS, cause Macports port is failing with Segmentation Fault.
Regards
Glad you found it helpful. I had the same problem with macports and swftools unfortunately.
My admin installed swftools-0.8.0 i faced problem with the converting pdf file with single pages. But after following this post instructions and installing swftools-0.9.1. I is working like a charm.
Thanks
Sathyendra V
Thanks a ton for the instructions to build this.
I needed this for my plone site to view PDFs.
sudo apt-get install swftools did not work, so trid builing it with your instructions.
PN
MIL GRACIASSSSS ESTA SUPER
Cannot install.
…
making install in swfs…
cd swfs;make install
make[1]: Entering directory `/home/lotus/swftools-0.9.1/swftools-0.9.0/swfs’
/bin/bash ../mkinstalldirs /usr/local/share/swftools
mkdir /usr/local/share/swftools
/bin/bash ../mkinstalldirs /usr/local/share/swftools/swfs
mkdir /usr/local/share/swftools/swfs
/usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
/usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/lotus/swftools-0.9.1/swftools-0.9.0/swfs’
make: *** [install] Error 2
~/swftools-0.9.0$ ls
Try sudo make install
How do we fix the problem im getting the exact error and here is mine:
SWFOutputDev.cc:2706:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2707:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2707:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2708:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2708:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2709:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2709:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2710:75: warning: deprecated conversion from string constant to ‘char*’
SWFOutputDev.cc:2710:75: warning: deprecated conversion from string constant to ‘char*’
make[1]: *** [SWFOutputDev.o] Error 1
make[1]: Leaving directory `/home/swftools/swftools-0.7.0/pdf2swf’
make: *** [all] Error 2
I also tried this and got same error have you founded the solution if you then please tell me
In my case (debian squeeze 64) ‘make install’ gave the error:
/usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
/usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory
After getting the error (and others) I installed libjpeg62-dev, libfreetype6-dev and g++, not sure what solved what.
Hope it helps
i have same a problem. solution is very simlpe- in first sudo make then sudo make install
doesnt work in linux 64bits =(
What’s the error you are getting?
zlib (required by swftools) isn’t always installed by default on Ubuntu, which results in an error during the configure step in the swftools-0.9.0 directory. The solution is to run:
sudo apt-get install zlib1g-dev
before running that configure command.
great answer….thanks for resolving my problem
Greats! thank for share. Worked for me 🙂
I also ran into this issue: http://comments.gmane.org/gmane.comp.tools.swftools.general/729 (a showstopper).
Wouldn’t it be nice if swftools was available via apt-get… *sigh*
Yea I agree, not sure why they can’t do that. I also had trouble getting swftools to run under newer versions of Ubuntu, hence intrepid.
Very good job! its very useful 😛
Thanks alot very useful.
Hi, i have a problem with sudo. Whenever i type in a command with sudo, it says
-bash: sudo: command not found
Thanks. im on bluehost server
I think you might have a problem with your os install, or just using a different *nix version. You can try su instead of sudo. Try contacting your host tech support if that doesn’t work.
I have the same issue with an EC2 Instance running Amazon’s linux package. Try this:
# sudo su
Then you will be root and you won’t have to type in sudo every time.
Hello,
I am getting the below error while configure JPEG. Please view and advise how to resolve it.
configure: error: in `/home/ubuntu/jpeg-7′:
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.
Thank you,
Please run this sudo apt-get install build-essential and go ahead the installation.
Hello,
Thanks and done it, Now I am having another problem while installing swftools below error is receiving
Error:
You need zlib to compile swftools
Please advise
sudo apt-get install zlib1g-dev
is solved my issue.
Thank you
very useful! The first example you said: cd jpegsrc.v7 – That doesn’t work for me. I dropped the “v” and said; “cd jpegsrc.7” and it worked just fine and dandy-like.
Thanks you!
It asked me for following dependencies in addition to mentioned above: gif_lib.h and ungif
To fix this: sudo apt-get install libgif-dev
swftools 0.9.1 version fixed the compilation errors thrown in 0.9.0
a great help, thank you so much! ❤
thanks for really good guide. Used this to install swftools on debian squeeze, got some errors on missing libraries, and changed to
wget http://swftools.org/swftools-0.9.1.tar.gz
tar -zvxf swftools-0.9.1.tar.gz
wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
tar -zvxf jpegsrc.v8.tar.gz
wget http://download.savannah.gnu.org/releases-noredirect/freetype/freetype-2.3.12.tar.gz
tar -zvxf freetype-2.3.12.tar.gz
after that – clear sailing.
tested with pdf2swf -V
and got output “pdf2swf – part of swftools 0.9.1” that I understand to mean that all is well.
Happy!
Thanks for your help. I had some problems compiling problems with the “make” command, but they were resolved using version swftools-0.9.1.
Hello techies,
while compiling swftools I got following error
can anybody pleae help me out ??
ERROR:
You need zlib to compile swftools
Try “sudo apt-get install zlib1g-dev libssl-dev libexpat1-dev -y”
cd /usr/local/
wget zlib-1.2.11.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/
./configure
make
sudo make install
rm -f /usr/local/share/swftools/swfs/default_viewer.swf -o -L /usr/local/share/swftools/swfs/default_viewer.swf
rm: NA option – o
Try the ‘rm – help’ to get more information.
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/ishare1/swftools-0.9.2/swfs’
make: *** [install] Error 2
check any running process in the bg
Great post, Mikhail All seems to work even with today’s versions of all libraries. Happy to turn over my keystroke recording text file if anyone would find it useful.
Hey, glad you found it helpful! Tbh I’m amazed it still works after so many years.
kdflint, can you show us your steps?
Thank you.
I got this error
/usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
/usr/bin/install: cannot stat `./simple_viewer.swf’: No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home//Alfresco_Learner/Software/swftools-0.9.0/swfs’
make: *** [install] Error 2
before config i I run this command sudo apt-get install zlib1g-dev
still i got that error
4 years later, your post is still saving lives!! 🙂
Thank you very much. Kudos from Senegal!
I am trying to install on EC2, I get the following errors.
./types.h:36:2: error: #error “no way to define 64 bit integer”
#error “no way to define 64 bit integer”
^
./types.h:39:2: error: #error “don’t know how to define 32 bit integer”
#error “don’t know how to define 32 bit integer”
^
./types.h:42:2: error: #error “don’t know how to define 16 bit integer”
#error “don’t know how to define 16 bit integer”
^
./types.h:45:2: error: #error “don’t know how to define 8 bit integer”
#error “don’t know how to define 8 bit integer”
Can sombody help me, I have this problem
/bin/sh ../mkinstalldirs /usr/local/share/swftools
/bin/sh ../mkinstalldirs /usr/local/share/swftools/swfs
/usr/bin/install -c -m 644 ./simple_viewer.swf /usr/local/share/swftools/swfs/simple_viewer.swf
/usr/bin/install: no se puede efectuar `stat’ sobre «./simple_viewer.swf»: No existe el archivo o el directorio
make[1]: *** [install] Error 1
make[1]: se sale del directorio «/home/jorge/Downloads/swftools-0.5.1/swfs»
make: *** [install] Error 2
Installing swftools and pdf2swf on Ubuntu Linux
is a wonderful post concerning pdf
Thanks, finally is working!!!