Thanks for your suggestion.
I tried both the ebuild too; unfortunately that doesn't get to the end of the installation, and for this reason I was trying the binary installation.
Indeed there seems to be an issue with the image magick libraries. I tried to work around this by setting LD_LIBRARY_PATH, but it looks like some of the libraries are still being picked up from the system. (I installed calibre in /usr/local/calibre/calibre/)
Code:
$ export LD_LIBRARY_PATH=/usr/local/calibre/calibre/lib:/usr/local/calibre/calibre/lib/ImageMagick/modules-Q16/coders/
$ LD_DEBUG=libs ebook-convert foo.html foo.epub
<...a lot of libraries being loaded from /usr/local/calibre...>
21083:
Looking for large trees in foo.html...
No large trees found
Generating default cover
21083: find library=liblcms2.so.2 [0]; searching
21083: search path=/usr/local/calibre/calibre/lib:/usr/local/calibre/calibre/lib/ImageMagick/modules-Q16/coders (LD_LIBRARY_PATH)
21083: trying file=/usr/local/calibre/calibre/lib/liblcms2.so.2
21083:
21083: find library=libtiff.so.3 [0]; searching
21083: search path=/usr/local/calibre/calibre/lib:/usr/local/calibre/calibre/lib/ImageMagick/modules-Q16/coders (LD_LIBRARY_PATH)
21083: trying file=/usr/local/calibre/calibre/lib/libtiff.so.3
21083: trying file=/usr/local/calibre/calibre/lib/ImageMagick/modules-Q16/coders/libtiff.so.3
21083: search cache=/etc/ld.so.cache
21083: trying file=/usr/lib/libtiff.so.3
21083:
21083:
21083: calling init: /usr/lib/libtiff.so.3
21083:
21083:
21083: calling init: /usr/local/calibre/calibre/lib/liblcms2.so.2
21083:
21083:
21083: calling init: /usr/lib/ImageMagick-6.6.5/modules-Q16/coders/png.so
21083:
21083: /usr/lib/ImageMagick-6.6.5/modules-Q16/coders/png.so: error: symbol lookup error: undefined symbol: png_LTX_RegisterPNGImage (fatal)
21083: /usr/lib/ImageMagick-6.6.5/modules-Q16/coders/png.so: error: symbol lookup error: undefined symbol: png_LTX_UnregisterPNGImage (fatal)
ebook-convert: coders/png.c:2825: ReadPNGImage: Assertion `image_info->signature == 0xabacadabUL' failed.
/usr/bin/ebook-convert: line 9: 21083 Aborted $base/bin/ebook-convert "$@"
21080:
21080: calling fini: /bin/sh [0]
21080:
21080:
21080: calling fini: /lib/libncurses.so.5 [0]
21080:
21080:
21080: calling fini: /lib/libdl.so.2 [0]
21080:
21080:
21080: calling fini: /lib/libc.so.6 [0]
Thanks for any suggestion you may have.