pdf2htmlEX icon indicating copy to clipboard operation
pdf2htmlEX copied to clipboard

Building poppler and pdf2htmlEX from source

Open matanox opened this issue 10 years ago • 15 comments

It seems that on my Ubuntu, the poppler deb package does not come with its headers. I manually built and installed poppler (version 0.33.0) from source. I wonder if this here is a valid output from its building. Or should I have more prerequisites to get the most out of pdf2htmlEX, building it according to https://github.com/coolwanglu/pdf2htmlEX/wiki/Building. I have looked there but still would appreciate your feedback.

Building poppler with support for:
  font configuration: fontconfig
  splash output:      yes
  cairo output:       yes
  qt4 wrapper:        yes
  qt5 wrapper:        no
  glib wrapper:       yes
    introspection:    no
  cpp wrapper:        yes
  use gtk-doc:        no
  use libjpeg:        yes
  use libpng:         yes
  use libtiff:        yes
  use zlib:           no
  use libcurl:        no
  use libopenjpeg:    yes
      with openjpeg1
  use cms:            no
  command line utils: yes

Thanks in advance for your comment!

Actually I still get fatal error: poppler-config.h: No such file or directory building pdf2htmlEX, even though the header file does lie in /usr/local/include/poppler. I assume I'll manage that by refreshing myself about cmake...

matanox avatar May 18 '15 12:05 matanox

Run pkg-config --print-provides --cflags --libs poppler to check whether poppler is installed.

Run make clean and make SHELL="/bin/bash -x" in pdf2htmlEX source dir to check the compiler command actually used.

duanyao avatar May 18 '15 15:05 duanyao

Thanks @duanyao for your help. It appears poppler is well installed in terms of being accessible for linking and includes:

pkg-config --print-provides --cflags --libs poppler 
poppler = 0.33.0
-I/usr/local/include/poppler  -L/usr/local/lib -lpoppler  

However it may appear pdf2htmlEX isn't looking for it where it is installed:


..../pdf2htmlEX$ make clean
..../pdf2htmlEX$ make SHELL="/bin/bash -x"
+ /usr/bin/cmake -H..../pdf2htmlEX -B..../pdf2htmlEX --check-build-system CMakeFiles/Makefile.cmake 0
+ /usr/bin/cmake -E cmake_progress_start ..../pdf2htmlEX/CMakeFiles ..../pdf2htmlEX/CMakeFiles/progress.marks
+ make -f CMakeFiles/Makefile2 all
+ make -f CMakeFiles/pdf2htmlEX.dir/build.make CMakeFiles/pdf2htmlEX.dir/depend
+ cd ..../pdf2htmlEX
+ /usr/bin/cmake -E cmake_depends 'Unix Makefiles' ..../pdf2htmlEX ..../pdf2htmlEX ..../pdf2htmlEX ..../pdf2htmlEX ..../pdf2htmlEX/CMakeFiles/pdf2htmlEX.dir/DependInfo.cmake --color=
+ make -f CMakeFiles/pdf2htmlEX.dir/build.make CMakeFiles/pdf2htmlEX.dir/build
+ /usr/bin/cmake -E cmake_progress_report ..../pdf2htmlEX/CMakeFiles 1
[  2%] + /usr/bin/cmake -E cmake_echo_color --switch= --green 'Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o'
Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o
+ /usr/bin/c++ -Wall -std=c++0x -O2 -DNDEBUG -I..../pdf2htmlEX/src -I/usr/include/poppler -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I..../pdf2htmlEX/3rdparty/poppler/git -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -I/usr/include/pango-1.0 -I/usr/include/fontforge -o CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o -c ..../pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc
..../pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:36:28: fatal error: poppler-config.h: No such file or directory
 #include <poppler-config.h>
                            ^
compilation terminated.
make[2]: *** [CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o] Error 1
make[1]: *** [CMakeFiles/pdf2htmlEX.dir/all] Error 2
make: *** [all] Error 2

Defining the environment variable mentioned in the documentation didn't have any effect. Now there's several ways to tinker include paths with cmake or make files created by it. I chose adding /usr/share/local/poppler in the include_directories statement of CMakeLists.txt. which solved it. And the equivalent for ink_directories. Any idea about why the environment variables might not take effect?

matanox avatar May 19 '15 11:05 matanox

I'm still curious about why the environment variables have no effect... but that aside in case you'd care commenting a bit further about the build - it appears that with my fresh successful build, I get Error: Cannot open the manifest file, which is solved by make install. Could I avoid that last step, and run my built project without the install phase which sprinkles files into global directories and requires sudo privilege?

matanox avatar May 19 '15 11:05 matanox

It seems a problem of cmake, although I don't know why. Try to remove cmake's temp files listed in .gitignore, and re-run cmake. If the problem persists, check cmake.log file in the source dir.

To change installation dir, try adding -DDESTINATION=<dir> when running cmake (haven't tried myself). If you don't want to install at all, you can specify --data-dir <sourcedir>/share when runing pdf2htmlEX.

duanyao avatar May 19 '15 12:05 duanyao

Well, I am set up now, many thanks. Maybe I'd fix the "building" document if I were sure the env variables were not my setup issue. It would just hope it is not necessary to run sudo make install after every compilation...

On Tue, May 19, 2015 at 3:11 PM, Duan Yao [email protected] wrote:

It seems a problem of cmake, although I don't know why. Try to remove cmake's temp files listed in .gitignore, and re-run cmake. If the problem persists, check cmake.log file in the source dir.

To change installation dir, try add -DDESTINATION=

when running cmake (haven't tried myself). If you don't want to install at all, you can specify --data-dir /share when runing pdf2htmlEX.

— Reply to this email directly or view it on GitHub https://github.com/coolwanglu/pdf2htmlEX/issues/526#issuecomment-103463260 .

matanox avatar May 19 '15 12:05 matanox

Did you find the root cause of the failing build previously?

By the way, you don't have to run sudo make install after a compilation if you haven't modified files under ./share dir.

duanyao avatar May 20 '15 11:05 duanyao

Initially, the root cause has been that the Ubuntu 14.04 deb package for poppler doesn't install the header files. Then, the issue was that the suggested env variables have no effect (I ended up updating the cmake definitions file instead). I feel this should receive more confirmation from other cases before documentation is adjusted in any way.

On Wed, May 20, 2015 at 2:53 PM, Duan Yao [email protected] wrote:

Did you find the root cause of the failing build previously?

By the way, you don't have to run sudo make install after a compilation if you haven't modified files under ./share dir.

— Reply to this email directly or view it on GitHub https://github.com/coolwanglu/pdf2htmlEX/issues/526#issuecomment-103857045 .

matanox avatar May 20 '15 12:05 matanox

For the header files, try to install poppler-dev

coolwanglu avatar May 21 '15 13:05 coolwanglu

Or maybe named libpoppler-dev

coolwanglu avatar May 21 '15 13:05 coolwanglu

Thanks Lu, I meant the latter all along. However, as per my understanding, and the actual results of its installation, it may seem it does not bring along the headers:

$dpkg-query -L libpoppler-dev
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/poppler-splash.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/poppler.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/poppler-cairo.pc
/usr/lib/x86_64-linux-gnu/libpoppler.a
/usr/share
/usr/share/doc
/usr/share/doc/libpoppler-dev
/usr/share/doc/libpoppler-dev/copyright
/usr/share/doc/libpoppler-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/libpoppler.so

Anyway, building and installing from poppler source solved it. For doubt stake, I suggest waiting to see if others encounter the same, before generalizing from this particular experience.

matanox avatar May 21 '15 15:05 matanox

Oh there is also a package named libpoppler-private-dev

coolwanglu avatar May 22 '15 01:05 coolwanglu

Yes, looks like that may work easier than building the source:

apt-file list libpoppler-private-dev | grep config
libpoppler-private-dev: /usr/include/poppler/poppler-config.h

I would probably try that if I were to start over.

matanox avatar May 22 '15 15:05 matanox

libpoppler-private-dev work for me on debian wheezy.

kadashu avatar Jun 26 '15 16:06 kadashu

libpoppler-private-dev needed on ubuntu xenial, too. Maybe this would be something for the FAQ?

egroeper avatar Jun 17 '16 12:06 egroeper

@coolwanglu libpoppler-private-dev worked for me too.

Thanks.

Raghuvar avatar May 23 '18 13:05 Raghuvar