Open strum3nt opened 7 years ago
It seems like new versions of fontforge don't support the old API that pdf2html is using. My system has version fontforge-20170731 (gentoo, via the overlay ebuild). When I build, I get a bunch of implicit function warnings. e.g.
src/pdf2htmlEX/src/util/ffw.c:57:5: warning: implicit declaration of function 'InitSimpleStuff' [-Wimplicit-function-declaration] InitSimpleStuff(); ^
One of these warnings leads to
src/pdf2htmlEX/src/util/ffw.c:303:17: warning: passing argument 1 of 'strcopy' makes pointer from integer without a cast [-Wint-conversion] src/pdf2htmlEX/src/util/ffw.c:41:15: note: expected 'const char *' but argument is of type 'int'
which is the source of the segfault. The segault I had was
from /usr/lib64/libpoppler.so.68
Anyway, I'm not familiar with fontforge, its history, or its APIs. Maybe the right fix is to convert pdf2html to use the more recent interfaces? If not, I'd either put the old version in your package or otherwise make it clear that newer versions of fontforge won't work. I get this problem both with the gentoo ebuild and with building from source (as you'd expect).
Well, the fix is as simple as it is evil.
https://github.com/akhuettel/pdf2htmlEX/commit/46160f0c83b02a6fd7f23c40b7fab612f913f8c4
pdf2htmlEX requires an interface that is not exported by fontforge in its headers anymore. That's why the messages about implicit function definitions pop up. Also, something in this interface changed, and function call (in pdf2htmlEX) and implementation (in fontforge) do not fit together anymore. That's why it crashes on runtime.
The "fix" is to copy fontforge internal headers into pdf2htmlEX and include them. However, the resulting binary will likely only work with the version of fontforge that provided the headers...
I built this on an AWS EC2 instance using (effectively) the bash script here https://gist.github.com/rajeevkannav/d07f822e209a22d07176
When I tried executing PDF2HTMLEX on a pdf file I got a segmentation fault error.
I rebuilt fontforge from coolwanglu's fork https://github.com/coolwanglu/fontforge/tree/pdf2htmlEX. It now works fine.