I have a C++, Java, and CMake project but I am, at the moment, unable to compile it. I encounter the following error.
make[2]: *** No rule to make target '/usr/lib/jvm/default/jre/lib/amd64/libjawt.so', needed by 'build/Ygor'. Stop.
From what I've read online that means the compiler cannot find that file, either it's looking in the wrong place or it doesn't exist. Sure enough, it's in the wrong place. On my computer the libjawt.so file is actually located at /usr/lib/jvm/default/lib/libjawt.so. There is no jre in /usr/lib/jvm/default/.
I would like for the compiler to accurately locate the file it's looking for. Either automatically or by me telling it where it is. However I am at a loss as to how to express this to the compiler. I've tried to add include_directories("/usr/lib/jvm/default/lib") to the uppermost CMakeLists.txt file but that changes nothing. I am aware of the add_library and find_library CMake functions but if they could help me in this situation I don't know how to use them to do that.
Here is the full compiler output.
Scanning dependencies of target CommandParser
[ 7%] Building CXX object src/CMakeFiles/CommandParser.dir/CommandParser.cpp.o
[ 14%] Linking CXX static library libCommandParser.a
[ 14%] Built target CommandParser
Scanning dependencies of target Item
[ 21%] Building CXX object src/CMakeFiles/Item.dir/Item.cpp.o
[ 28%] Linking CXX static library libItem.a
[ 28%] Built target Item
Scanning dependencies of target Dependency
[ 35%] Building CXX object src/CMakeFiles/Dependency.dir/dependency.cpp.o
[ 42%] Linking CXX static library libDependency.a
[ 42%] Built target Dependency
Scanning dependencies of target Parser
[ 50%] Building CXX object src/CMakeFiles/Parser.dir/Parser.cpp.o
[ 57%] Linking CXX static library libParser.a
[ 57%] Built target Parser
Scanning dependencies of target Actor
[ 64%] Building CXX object src/CMakeFiles/Actor.dir/Actor.cpp.o
[ 71%] Linking CXX static library libActor.a
[ 71%] Built target Actor
Scanning dependencies of target Room
[ 78%] Building CXX object src/CMakeFiles/Room.dir/Room.cpp.o
[ 85%] Linking CXX static library libRoom.a
[ 85%] Built target Room
Scanning dependencies of target Ygor
[ 92%] Building CXX object CMakeFiles/Ygor.dir/src/main.cpp.o
make[2]: *** No rule to make target '/usr/lib/jvm/default/jre/lib/amd64/libjawt.so', needed by 'build/Ygor'. Stop.
make[1]: *** [CMakeFiles/Makefile2:131: CMakeFiles/Ygor.dir/all] Error 2
make: *** [Makefile:104: all] Error 2
And here is the uppermost CMakeLists.txt file.
cmake_minimum_required (VERSION 2.6)
project (Ygor)
# Version Numbers
set (Ygor_VERSION_MAJOR 0)
set (Ygor_VERSION_MINOR 1)
set (Ygor_VERSION "${Ygor_VERSION_MAJOR}.${Ygor_VERSION_MINOR}")
# Output
set (EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/build")
# Include directories
include_directories ("${PROJECT_SOURCE_DIR}/src")
include_directories ("${PROJECT_SOURCE_DIR}/build")
include_directories ("${PROJECT_SOURCE_DIR}/build/include")
include_directories ("${PROJECT_SOURCE_DIR}/build/include/linux")
include_directories ("${PROJECT_SOURCE_DIR}/build/stanford-corenlp")
include_directories ("/usr/lib/jvm/default/lib")
add_subdirectory (src)
# Find the JNI package
find_package(JNI)
if (JNI_FOUND)
include_directories("${JNI_INCLUDE_DIRS}")
endif()
add_executable (Ygor src/main.cpp)
target_link_libraries (Ygor Parser)
target_link_libraries (Ygor Dependency)
target_link_libraries (Ygor CommandParser)
target_link_libraries (Ygor Actor)
target_link_libraries (Ygor Item)
target_link_libraries (Ygor Room)
if (JNI_FOUND)
target_link_libraries (Ygor ${JNI_LIBRARIES})
endif()