pdflualibharu

hpdf not found by LuaHPDF MakeFile (but I've already installed it)


Executing the MakeFile of LuaHPDF (this one), it complains that #include <hpdf.h> directive has failed. I've installed it (v. 2.3.0) using apt . Despite of a hpdf.so taking place in the system, no header (hpdf.h) was added. This means such installation wasn't have effect.

I'm working with Debian 11 and lua 5.4.

How to install hpdf in my computer in order to such header being reachable to gcc? Should I create one by my self? If yes, how to do it?

Thanks in advance.


Solution

  • On Debian, you must also install the libhpdf-dev package to get the development files (headers) necessary to compile LuaHPDF (and then link against libhpdf-2.3.0.so).

    This is a general pattern when compiling from source.

    Note that this will only solve an initial problem, as LuaHPDF targets Lua 5.2, and will not compile under Lua 5.4, as there have been breaking changes (very common between Lua versions).

    You'll either need to compile and link against Lua 5.2, or port the source to Lua 5.4.

    That said, the only issue I ran into when compiling is that Lua 5.4 dropped the LUA_QS and LUA_QL macros from luaconf.h (present most recently in Lua 5.3 for compatibility). Adding them back near the top of hpdf.c

    #define LUA_QL(x)       "'" x "'"
    #define LUA_QS          LUA_QL("%s")
    

    does get this to compile cleanly, though I cannot comment on the stability of the library with this basic patch.


    For complete transparency, I tested this on Solus, where libHaru is available as libharu and libharu-devel. The process should be the same on Debian, even if the names are different - I just don't have a Debian machine on hand.