bitextor / pdf-extract

PDF parser and converter to HTML
GNU General Public License v3.0
83 stars 14 forks source link

Restructure of folders and adding compile action #28

Closed amirkamran closed 4 years ago

amirkamran commented 4 years ago

Contains the following changes:

How to compile and run: Assuming that all the dependencies are installed or for ubuntu:latest I installed the following

apt-get update
apt-get install build-essential git ant maven protobuf-compiler libprotobuf-dev cmake poppler-utils openjdk-8-jdk

Clone the repository recursively git clone -b [branch] https://github.com/bitextor/pdf-extract.git --recursive Build cld3-Java and install jar

cd cld3-Java
ant jar
mvn install:install-file -Dfile=cld3-java.jar -DgroupId=cld3-java -DartifactId=cld3-java -Dversion=1.0 -Dpackaging=jar

Build PDF Extract from the actual checkout folder mvn package

The resulting jar will be in target folder.

The setup.sh file is unnecessarily complicated and needs to be fixed.

lpla commented 4 years ago

For the record, 'ant jar' command breaks in the cld3 compilation step if you are using Ubuntu bundled libprotobuf (Canonical is packaged very old protobuf versions in Ubuntu):

lpla@xxxxx:~/pdf-extract/cld3-Java$ ant jar                                                                                                                                                              [14/398]
Buildfile: /home/lpla/pdf-extract/cld3-Java/build.xml

init:                                                                                   
    [mkdir] Created dir: /home/lpla/pdf-extract/cld3-Java/build                            

compile:                                                                                 
    [mkdir] Created dir: /home/lpla/pdf-extract/cld3-Java/build/main/java
    [javac] Compiling 1 source file to /home/lpla/pdf-extract/cld3-Java/build/main/java

cmake:
    [mkdir] Created dir: /home/lpla/pdf-extract/cld3-Java/build/main/cpp
     [exec] -- The C compiler identification is GNU 7.4.0      
     [exec] -- The CXX compiler identification is GNU 7.4.0
     [exec] -- Check for working C compiler: /usr/bin/cc
     [exec] -- Check for working C compiler: /usr/bin/cc -- works
     [exec] -- Detecting C compiler ABI info
     [exec] -- Detecting C compiler ABI info - done
     [exec] -- Detecting C compile features
     [exec] -- Detecting C compile features - done
     [exec] -- Check for working CXX compiler: /usr/bin/c++
     [exec] -- Check for working CXX compiler: /usr/bin/c++ -- works
     [exec] -- Detecting CXX compiler ABI info
     [exec] -- Detecting CXX compiler ABI info - done
     [exec] -- Detecting CXX compile features
     [exec] -- Detecting CXX compile features - done
     [exec] -- Looking for pthread.h
     [exec] -- Looking for pthread.h - found
     [exec] -- Looking for pthread_create
     [exec] -- Looking for pthread_create - not found
     [exec] -- Looking for pthread_create in pthreads
     [exec] -- Looking for pthread_create in pthreads - not found
     [exec] -- Looking for pthread_create in pthread
     [exec] -- Looking for pthread_create in pthread - found
     [exec] -- Found Threads: TRUE
     [exec] -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.0.0")
     [exec] CMake Warning at /usr/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
     [exec]   Protobuf compiler version doesn't match library version 3.0.0
     [exec] Call Stack (most recent call first):
     [exec]   CMakeLists.txt:2 (include)
     [exec]
     [exec]
     [exec] CMake Warning at /usr/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
     [exec]   Protobuf compiler version doesn't match library version 3.0.0
     [exec] Call Stack (most recent call first):
     [exec]   CMakeLists.txt:4 (find_package)
     [exec]
     [exec]
     [exec] -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread;-lpthread (found version "3.0.0")
     [exec] -- Found JNI: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libjawt.so
     [exec] -- Configuring done
     [exec] -- Generating done
     [exec] -- Build files have been written to: /home/lpla/pdf-extract/cld3-Java/build/main/cpp

forcld3:
     [exec] CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/cld3.dir/all' failed
     [exec] CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/forcld3.dir/rule' failed
     [exec] Makefile:175: recipe for target 'forcld3' failed
     [exec] CMakeFiles/cld3.dir/build.make:61: *** target pattern contains no '%'.  Stop.
     [exec] make[2]: *** [CMakeFiles/cld3.dir/all] Error 2
     [exec] make[1]: *** [CMakeFiles/forcld3.dir/rule] Error 2
     [exec] make: *** [forcld3] Error 2

BUILD FAILED
/home/lpla/pdf-extract/cld3-Java/build.xml:52: exec returned: 2

Total time: 5 seconds

My solution to this issue is to manually install libprotobuf from source, as the setup.sh does.