TALP-UPC / FreeLing

FreeLing project source code
Other
252 stars 96 forks source link

Getting error when trying to compile JAVA API #115

Open imardini98 opened 3 years ago

imardini98 commented 3 years ago

I am using the commmand cmake .. -DJAVA_API=ON to compile JAVA APi. However, it crashes with the following error:

-- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found Boost: /usr/include (found version "1.65.1") found components: regex filesystem thread program_options system chrono date_time atomic -- Found the following ICU libraries: -- data (required) -- i18n (required) -- uc (required) -- Found ICU: /usr/include (found version "60.2") CMake Deprecation Warning at src/libdynet/CMakeLists.txt:2 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- BACKEND not specified, defaulting to eigen. -- Eigen dir is /home/ivan/Desktop/FreeLing/src/eigen3 -- Found SWIG: /usr/bin/swig3.0 (found version "3.0.12")
CMake Error at /usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Java (missing: Java_JAVAC_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVADOC_EXECUTABLE Development) (found version "11.0.9") Call Stack (most recent call first): /usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.20/Modules/FindJava.cmake:324 (find_package_handle_standard_args) APIs/java/CMakeLists.txt:2 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/ivan/Desktop/FreeLing/build/CMakeFiles/CMakeOutput.log". See also "/home/ivan/Desktop/FreeLing/build/CMakeFiles/CMakeError.log".

My OS is Ubuntu Bionic 18.04. Any idea to solve the problem? I appreciate your support.

lluisp commented 3 years ago

It seems cmake can not locate Java in your system. You need to have JDK installed, not just JRE. You need to make sure to have jni.h installed. In my debian it comes in package openjdk-11-jdk-headless

if you have them installed in a non-standard location, you can try adding -DJNI_INCLUDE_DIRS=/my/jni/dir to the cmake command

It also maybe that cmake 3.20 is too new for freeling makefiles. You can try with an older cmake version (e.g 3.12 - 3.16)