Forum Bugs

Ubuntu; trouble loading image files using HTTP

kmtrowbr
Hi,

I am trying to using Prince to embed external image files into PDFs.

For example, within my HTML file I have this line:

<img src=
"xxx/some_file.jpg"
alt="Cottonball_playing_2"><br>

When I issue the command to turn the HTML into a PDF, I see this error:

prince: xxx: warning: Couldn't resolve host 'xxx'

Note: I see this spammer prevention message "You must have 1 posts before you can post URL's/Links." -> so I am swapping in xxx in place of the image URLs which I was using before. The xxx are meant to be - any generic link to an image file, starting with http:// and so on.

The computer is running Ubuntu 7.10. It's mysterious to me, because I have another Ubuntu 7.10 machine which has no trouble with the exact same file.

This is the Prince version I have (the most up to date):
prince --version
Prince 6.0 rev 5
Copyright 2002-2008 YesLogic Pty. Ltd.
Personal License

* If I do the same with a local image file, say '../../public/images/some_file.jpg' - it works fine.
* I noticed some discussion in this forum about how Prince using curl to get its images (which seems reasonable); I tried following this thread to figure it all out, but - did not get so far.

Can someone help me out? Thanks so much,
Kevin
mikeday
Sounds like a DNS issue, but strange that it works on the other machine. Do you get the same problem when running Prince on HTTP URLs, eg. "prince http://some.host.com" ? Do you have a http_proxy environment variable set?
kmtrowbr
Thanks for your help!

I tried:
echo $http_proxy
<I see a blank line>


Nonetheless I issued:
unset http_proxy


Now, I tried:
prince http://www.google.com --output=google.pdf
prince: http://www.google.com: error: Couldn't resolve host 'www.google.com'
prince: http://www.google.com: error: could not load input file
prince: error: no input documents to process


I also tried:
prince google.com --output=google.pdf
prince: warning: failed to load external entity "google.com"
prince: google.com: error: could not load input file
prince: error: no input documents to process


Nonetheless, if I ping google, it works just fine:
ping google.com
PING google.com (64.233.167.99) 56(84) bytes of data.
64 bytes from py-in-f99.google.com (64.233.167.99): icmp_seq=1 ttl=244 time=7.62 ms


I tried substituting google's IP address for its DNS name - that does work:
prince http://72.14.207.99 --output=google.pdf
prince: http://72.14.207.99:3: error: Tag nobr invalid
<eventually succeeds>


Thanks very much for your help, hopefully it will not turn out that the issue is just with something I have naively misconfigured. It is strange to me that network access to this machine works perfectly well using other programs, but Prince (so far), is having these issues. I wonder what would happen if I reinstalled the distro and started over (that is an expensive experiment, though).

Kevin
kmtrowbr
Hi Mike,

I continued to search through the forums and came across this post:
http://princexml.com/bb/viewtopic.php?t=1205

I wonder if the issue this person is having, is the same one that I am experiencing?

My server does have the AMD64 architecture:

uname -a  
Linux development 2.6.16.29-xen #1 SMP Sun Sep 30 04:00:13 UTC 2007 x86_64 GNU/Linux


My instinct says that is the case. I will probably put this issue on hold and wait for the 6.0r6 release, as you suggested to the other poster.

Thanks!
Kevin
ewhitten
I was just experiencing the same problem and installing ia32-libs over apt-get seemed to resolve the remote image download problem.
voodootikigod
I am running centos and have run into this problem -- any suggestions for how to fix it?
mikeday
Which CentOS version, and which RPM package did you install?
impact
I am facing the same problem on our production machine with Ubuntu 6.04 installed. I tried installing ia32-libs as suggested but that doesn't make any difference.

Package: ia32-libs
State: installed
Automatically installed: no
Version: 1.4ubuntu20


Perhaps the version is too old?

I get exactly the same message when I try getting images from an URL. Or when I try to generate the PDF out of an URL:

> prince http://www.google.nl -o google.pdf
Fontconfig warning: no <cachedir> elements found. Check configuration.
Fontconfig warning: adding <cachedir>/var/cache/fontconfig</cachedir>
Fontconfig warning: adding <cachedir>~/.fontconfig</cachedir>
prince: http://www.google.nl: error: Couldn't resolve host 'www.google.nl'
prince: http://www.google.nl: error: could not load input file
prince: error: no input documents to process


Anybody got an idea how I can solve this? Of course pinging Google goes perfect, the same as it just works when I try it on the IP.
mikeday
You will probably need a dynamically linked Prince build, so that it can pick up the correct library for successfully doing domain name resolution. Try this package: prince-6.0r9-ubuntu8.04.tar.gz. We may need to build one specifically for Ubuntu 6.04 if you see any library errors trying to run this build.
impact
I tried installing it and running Prince on Google. This is what it says:

# prince http://www.google.nl -o google.pdf
/usr/local/lib/prince/bin/prince: error while loading shared libraries: libgif.so.4: cannot open shared object file: No such file or directory
mikeday
Do you have any libungif packages installed? (eg. dpkg --list | grep ungif).
impact
That would be a no, no output from the command.
mikeday
Can you install one? :)

This is the downside of dynamically linked binaries: you need to have all the necessary shared libraries available. Alternatively, we can try making a build where some of the libraries are statically linked and some dynamically linked, but that's fiddly and will take time.
impact
# dpkg --list | grep ungif
ii  libungif-bin                                4.1.4-1                      programs to convert GIF images
ii  libungif4-dev                               4.1.4-1                      shared library for GIF images (development f
ii  libungif4g                                  4.1.4-1                      shared library for GIF images (runtime lib)


Doesn't make any difference, still the same message:

# prince http://www.google.nl -o google.pdf
/usr/local/lib/prince/bin/prince: error while loading shared libraries: libgif.so.4: cannot open shared object file: No such file or directory


Any more idea's?
mikeday
I suppose the 64-bit version of libungif is installed, and ia32-libs does not include libungif, and Prince being a 32-bit application is failing to find an appropriate version of libungif. If you can't install a 32-bit version of libungif then probably the only option is for us to build a dynamically linked version of Prince where most of the extra libraries like libungif are statically linked. Are you able to check which libraries are included in ia32-libs? In particular, libcurl is a critical library for network access.
impact
Yes, we run the 64-bit version of Ubuntu, so I guess that would be the problem.

# uname -a
Linux host 2.6.15-54-amd64-k8 #1 SMP PREEMPT Thu Apr 2 20:27:18 UTC 2009 x86_64 GNU/Linux


http://packages.ubuntu.com being slow/down right now, so I guess we will have to do it with Google's cache:

http://74.125.77.132/search?q=cache:-SXGJg-WTIoJ:packages.ubuntu.com/dapper/amd64/ia32-libs/filelist+packages.ubuntu.com/dapper/amd64/ia32-libs/filelist&hl=nl&gl=nl&strip=1

Filelist of package ia32-libs in dapper of architecture amd64

/lib32/libacl.so.1
/lib32/libacl.so.1.1.0
/lib32/libattr.so.1
/lib32/libattr.so.1.1.0
/lib32/libbz2.so.1
/lib32/libbz2.so.1.0
/lib32/libbz2.so.1.0.3
/lib32/libpam.so.0
/lib32/libpam.so.0.79
/lib32/libpam_misc.so.0
/lib32/libpam_misc.so.0.79
/lib32/libpamc.so.0
/lib32/libpamc.so.0.79
/lib32/libpopt.so.0
/lib32/libpopt.so.0.0.0
/usr/lib32/gtk-2.0/2.4.0/loaders/io-wmf.so
/usr/lib32/libGL.so.1
/usr/lib32/libGL.so.1.2
/usr/lib32/libGLU.so.1
/usr/lib32/libGLU.so.1.3.060401
/usr/lib32/libICE.so.6
/usr/lib32/libICE.so.6.3.0
/usr/lib32/libSM.so.6
/usr/lib32/libSM.so.6.0.0
/usr/lib32/libX11.so.6
/usr/lib32/libX11.so.6.2.0
/usr/lib32/libXTrap.so.6
/usr/lib32/libXTrap.so.6.4.0
/usr/lib32/libXau.so.6
/usr/lib32/libXau.so.6.0.0
/usr/lib32/libXaw.so.7
/usr/lib32/libXaw3d.so.6
/usr/lib32/libXaw3d.so.6.1
/usr/lib32/libXaw7.so.7
/usr/lib32/libXaw7.so.7.0.0
/usr/lib32/libXdmcp.so.6
/usr/lib32/libXdmcp.so.6.0.0
/usr/lib32/libXext.so.6
/usr/lib32/libXext.so.6.4.0
/usr/lib32/libXi.so.6
/usr/lib32/libXi.so.6.0.0
/usr/lib32/libXinerama.so.1
/usr/lib32/libXinerama.so.1.0.0
/usr/lib32/libXmu.so.6
/usr/lib32/libXmu.so.6.2.0
/usr/lib32/libXmuu.so.1
/usr/lib32/libXmuu.so.1.0.0
/usr/lib32/libXp.so.6
/usr/lib32/libXp.so.6.2.1
/usr/lib32/libXpm.so.4
/usr/lib32/libXpm.so.4.11.0
/usr/lib32/libXrandr.so.2
/usr/lib32/libXrandr.so.2.0.0
/usr/lib32/libXrender.so.1
/usr/lib32/libXrender.so.1.3.0
/usr/lib32/libXt.so.6
/usr/lib32/libXt.so.6.0.0
/usr/lib32/libXtst.so.6
/usr/lib32/libXtst.so.6.1.0
/usr/lib32/libXxf86vm.so.1
/usr/lib32/libXxf86vm.so.1.0.0
/usr/lib32/libcairo.so.2
/usr/lib32/libcairo.so.2.2.4
/usr/lib32/libdb-4.3.so
/usr/lib32/libdrm.so.2
/usr/lib32/libdrm.so.2.0.0
/usr/lib32/libexpat.so.0
/usr/lib32/libexpat.so.1
/usr/lib32/libexpat.so.1.0.0
/usr/lib32/libfontconfig.so.1
/usr/lib32/libfontconfig.so.1.0.4
/usr/lib32/libfreetype.so.6
/usr/lib32/libfreetype.so.6.3.8
/usr/lib32/libidn.la
/usr/lib32/libidn.so.11
/usr/lib32/libidn.so.11.5.11
/usr/lib32/libjpeg.so.62
/usr/lib32/libjpeg.so.62.0.0
/usr/lib32/liblcms.so.1
/usr/lib32/liblcms.so.1.0.13
/usr/lib32/libpng12.so.0
/usr/lib32/libpng12.so.0.1.2.8
/usr/lib32/libsndfile.so.1
/usr/lib32/libsndfile.so.1.0.12
/usr/lib32/libstdc++.so.5
/usr/lib32/libstdc++.so.5.0.7
/usr/lib32/libtiff.so.4
/usr/lib32/libtiff.so.4.1.4
/usr/lib32/libwmf-0.2.so.7
/usr/lib32/libwmf-0.2.so.7.1.0
/usr/lib32/libwmflite-0.2.so.7
/usr/lib32/libwmflite-0.2.so.7.0.1
/usr/lib32/libxml2.so.2
/usr/lib32/libxml2.so.2.6.24
/usr/share/doc/ia32-libs/Manifest
/usr/share/doc/ia32-libs/README.Debian
/usr/share/doc/ia32-libs/changelog.gz
/usr/share/doc/ia32-libs/copyright
/usr/share/lintian/overrides/ia32-libs


Is this the information you needed?
mikeday
Right, it looks as if ia32-libs includes libjpeg, libpng, and libtiff, so it has all the necessary image libraries except libungif. Funny. No libcurl either, though. One last thing: can you run "ldd /usr/local/lib/prince/bin/prince" to get a list of which libraries it is unable to find? This should include libungif and libcurl, but I'm wondering if there are any others.
impact
This is the output:

# ldd /usr/local/lib/prince/bin/prince
/usr/local/lib/prince/bin/prince: /lib32/libc.so.6: version `GLIBC_2.4' not found (required by /usr/local/lib/prince/bin/prince)
        linux-gate.so.1 =>  (0xffffe000)
        libpthread.so.0 => /lib32/libpthread.so.0 (0x55573000)
        libz.so.1 => /usr/lib32/libz.so.1 (0x55585000)
        libpng12.so.0 => /usr/lib32/libpng12.so.0 (0x5559a000)
        libtiff.so.4 => /usr/lib32/libtiff.so.4 (0x555bd000)
        libjpeg.so.62 => /usr/lib32/libjpeg.so.62 (0x5560d000)
        libgif.so.4 => not found
        libssl.so.0.9.8 => not found
        libcrypto.so.0.9.8 => not found
        libdl.so.2 => /lib32/libdl.so.2 (0x5562d000)
        libfontconfig.so.1 => /usr/lib32/libfontconfig.so.1 (0x55630000)
        libexpat.so.1 => /usr/lib32/libexpat.so.1 (0x5565e000)
        libm.so.6 => /lib32/libm.so.6 (0x5567d000)
        libc.so.6 => /lib32/libc.so.6 (0x5569f000)
        /lib/ld-linux.so.2 (0x55555000)
        libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0x557cf000)
mikeday
Thanks, we can use this to try making a build that provides the libraries you are missing.
impact
That would be great. Is this something which takes time or could I expect a working version in the near future? And how about the regular updates, would I still be able to install them or do I need a specially crafted build every new release?
mikeday
We will try and get a build working in the next few days. Once we get something that works, then we will be able to see how to fit this into our regular build process to support 64-bit Linux platforms more reliably.
mikeday
We've updated the build here: prince-6.0r9-ubuntu8.04.tar.gz. It is now statically linked with libungif, libcurl, libssl, and libcrypto, which should hopefully solve the missing library problems. Can you try running it on your 64-bit system and see if there are any further issues?
impact
Tried it, but getting this error when trying to execute prince:

/usr/local/lib/prince/bin/prince: /lib32/libc.so.6: version `GLIBC_2.4' not found (required by /usr/local/lib/prince/bin/prince)
mikeday
Oh well, that's better, but looks like we'll need to build one specifically for older Ubuntu distributions as the libc is not ABI compatible unfortunately.
mikeday
Okay, new build for Ubuntu 6.06! :)

prince-6.0r9-ubuntu6.06-dynamic.tar.gz

This is dynamically linked, except for the libungif/libcurl/etc. libraries as before. Since it's built on the correct Ubuntu version there should hopefully not be any libc issues. Please give it a try and see if we are one step closer to something that works.
impact
This one seems to work correctly.

Feeding it Google's URL works fine, also direct HTML/CSS input. So it looks like this works.

Thanks for the good support. And if you need any more info let me know :)
mikeday
We have now released Prince 7.0, which includes a 64-bit package for Ubuntu 9.04.
Seldaek
Is it recommended to use the ubuntu x64 build on debian x64 systems ?

Edit: NVM, found answer on this other post about x64 issues
mattheaton
I'm having this same " Couldn't resolve host" issue trying to get Prince working on a Ubunto 8.04 server. I'm using the prince-7.1-ubuntu804-static.tar.gz package. Any ideas?
mikeday
Is it a 32-bit or 64-bit server?
mattheaton
Thanks for the fast response, it's 64 bit.
mikeday
In that case I would suggest installing the 64-bit package of Prince, or the dynamically linked 32-bit package of Prince:

prince-7.1-ubuntu804-dynamic.tar.gz
prince-7.1-ubuntu904-amd64-dynamic.tar.gz
paulmuk
Hi all,

We are also having some problems with getting PrinceXML working on Ubuntu 10.04.

I have tried 3 versions of Prince, and each one fails with a different problem.

prince-7.1-linux

ubuntu@hostname:/$ prince http://www.google.co.uk -o google.pdf
Fontconfig error: Cannot load default config file
prince: http://www.google.co.uk: error: Couldn't resolve host 'www.google.co.uk'
prince: http://www.google.co.uk: error: could not load input file
prince: error: no input documents to process

prince-7.1-ubuntu904-amd64-dynamic

ubuntu@hostname:/$ prince http://www.google.co.uk -o google.pdf
/usr/local/lib/prince/bin/prince: error while loading shared libraries: libtiff.so.4: cannot open shared object file: No such file or directory

prince-7.1-ubuntu904-amd64-static

ubuntu@hostname:/$ prince http://www.google.co.uk -o google.pdf
Fontconfig error: Cannot load default config file
prince: relocation error: /lib/libnss_files.so.2: symbol __rawmemchr, version GLIBC_2.2.5 not defined in file libc.so.6 with link time reference


Any advice would be appreciated!

Thanks,

Paul
mikeday
The next release of Prince will include packages for Ubuntu 10.04. There are some early builds here you can try:
prince_7.2-3ubuntu10.04_amd64.deb
prince_7.2-3ubuntu10.04_i386.deb
paulmuk
Hi,

Thanks for the reply.

I've installed the package, but it seems that the old version of prince is still in place.

Steps I took to install the new package

1) Run dpkg. This returned some dependancy errors.

ubuntu@hostname:/$ sudo dpkg -i prince_7.2-3ubuntu10.04_amd64.deb 
Selecting previously deselected package prince.
(Reading database ... 25656 files and directories currently installed.)
Unpacking prince (from prince_7.2-3ubuntu10.04_amd64.deb) ...
dpkg: dependency problems prevent configuration of prince:
 prince depends on libtiff4; however:
  Package libtiff4 is not installed.
 prince depends on libgif4; however:
  Package libgif4 is not installed.
 prince depends on libfontconfig1; however:
  Package libfontconfig1 is not installed.
dpkg: error processing prince (--install):
 dependency problems - leaving unconfigured
Processing triggers for man-db ...
Errors were encountered while processing:
 prince


2) Run apt-get to resolve the dependency problems.

ubuntu@hostname:/$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies...Done
The following extra packages will be installed:
  fontconfig-config libfontconfig1 libgif4 libtiff4 ttf-dejavu-core
The following NEW packages will be installed
  fontconfig-config libfontconfig1 libgif4 libtiff4 ttf-dejavu-core
0 upgraded, 5 newly installed, 0 to remove and 76 not upgraded.
1 not fully installed or removed.
Need to get 2,116kB of archives.
After this operation, 4,121kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get: 1 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ lucid-updates/main libtiff4 3.9.2-2ubuntu0.3 [149kB]
Get: 2 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ lucid/main libgif4 4.1.6-9 [41.4kB]
Get: 3 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ lucid/main ttf-dejavu-core 2.30-2 [1,436kB]
Get: 4 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ lucid/main fontconfig-config 2.8.0-2ubuntu1 [205kB]
Get: 5 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ lucid/main libfontconfig1 2.8.0-2ubuntu1 [285kB]
Fetched 2,116kB in 0s (18.9MB/s)  
Selecting previously deselected package libtiff4.
(Reading database ... 25873 files and directories currently installed.)
Unpacking libtiff4 (from .../libtiff4_3.9.2-2ubuntu0.3_amd64.deb) ...
Selecting previously deselected package libgif4.
Unpacking libgif4 (from .../libgif4_4.1.6-9_amd64.deb) ...
Selecting previously deselected package ttf-dejavu-core.
Unpacking ttf-dejavu-core (from .../ttf-dejavu-core_2.30-2_all.deb) ...
Selecting previously deselected package fontconfig-config.
Unpacking fontconfig-config (from .../fontconfig-config_2.8.0-2ubuntu1_all.deb) ...
Selecting previously deselected package libfontconfig1.
Unpacking libfontconfig1 (from .../libfontconfig1_2.8.0-2ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up libtiff4 (3.9.2-2ubuntu0.3) ...

Setting up libgif4 (4.1.6-9) ...

Setting up ttf-dejavu-core (2.30-2) ...
Setting up fontconfig-config (2.8.0-2ubuntu1) ...

Setting up libfontconfig1 (2.8.0-2ubuntu1) ...

Setting up prince (7.2-3) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place


3) Re-run dpkg

ubuntu@hostname:/$ sudo dpkg -i prince_7.2-3ubuntu10.04_amd64.deb 
(Reading database ... 25988 files and directories currently installed.)
Preparing to replace prince 7.2-3 (using prince_7.2-3ubuntu10.04_amd64.deb) ...
Unpacking replacement prince ...
Setting up prince (7.2-3) ...
Processing triggers for man-db ...


This time it worked, however now if I run Prince, it's still using the old 7.1 version.

ubuntu@hostname:/$ prince --version
Prince 7.1
Copyright 2002-2010 YesLogic Pty. Ltd.
Non-commercial License


Do you know how I can remove the old version?

Thanks,

Paul
mikeday
Not sure what has happened here. What does "which prince" return? Does it work now, or does it still fail with the same error message?
paulmuk
Hi Mike,

ubuntu@hostname:/$ which prince
/usr/local/bin/prince


I think it's still using the old version, and it's still failing:

ubuntu@hostname:/$ prince http://www.google.co.uk -o google.pdf
prince: http://www.google.co.uk: error: Couldn't resolve host 'www.google.co.uk'
prince: http://www.google.co.uk: error: could not load input file
prince: error: no input documents to process


Paul
paulmuk
Should the installation of the new package have automatically removed or overwritten the old package (which I installed manually using the install.sh script)?
mikeday
Depends on where you installed the first package, /usr, /usr/local, or somewhere else?

Edit: I didn't see your previous message, looks like the old installation was in /usr/local. If you remove the file "/usr/local/bin/prince" and the directory "/usr/local/lib/prince" that should solve the problem.
paulmuk
Excellent, that's fixed it. Version 7.2 is now working correctly without the connection errors so thanks for that!