Open shpsec-dennis opened 8 years ago
tools.jar
is probably not found at the place the build is expecting it. Can you try adopting CMakeLists.txt
to use the path where it is available at your computer. You need to change this line:
set(CMAKE_JAVA_INCLUDE_PATH ${JAVA_INCLUDE_PATH}/../lib/tools.jar)
FWIW this makes it compile, not sure if it will work yet:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5f7b28..f8f1785 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,7 @@ project (perf-map-agent)
# Binaries (agent libperfmap.so and attach-main.jar) will end up in ./out
set(OUTDIR ${PROJECT_BINARY_DIR}/out)
set(LIBRARY_OUTPUT_PATH ${OUTDIR})
+set(JAVA_INCLUDE_PATH /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/include)
find_package(JNI)
if (JNI_FOUND)
@@ -17,14 +18,19 @@ if (JNI_FOUND)
endif()
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH2})
+INCLUDE_DIRECTORIES(/usr/include)
+
+if(APPLE)
- set(CMAKE_MACOSX_RPATH ON)
+endif()
add_library(perfmap SHARED src/c/perf-map-agent.c src/c/perf-map-file.c)
find_package(Java REQUIRED)
include(UseJava)
-set(CMAKE_JAVA_INCLUDE_PATH ${JAVA_INCLUDE_PATH}/../lib/tools.jar)
+set(CMAKE_JAVA_INCLUDE_PATH /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/lib/tools.jar)
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${OUTDIR})
-#message(STATUS "LIBS: ${Java_JAR_EXECUTABLE} ${Java_INCLUDE_DIRS} incl: ${CMAKE_JAVA_INCLUDE_PATH} output_dir: ${CMAKE_JAVA_TARGET_OUTPUT_DIR}")
+message(STATUS "LIBS: ${Java_JAR_EXECUTABLE} ${Java_INCLUDE_DIRS} incl: ${CMAKE_JAVA_INCLUDE_PATH} output_dir: ${CMAKE_JAVA_TARGET_OUTPUT_DIR}")
add_jar(attach-main src/java/AttachOnce.java ENTRY_POINT net/virtualvoid/perf/AttachOnce OUTPUT_DIR ${OUTDIR})
diff --git a/src/c/perf-map-file.c b/src/c/perf-map-file.c
index 838ccbc..8b2b253 100644
--- a/src/c/perf-map-file.c
+++ b/src/c/perf-map-file.c
@@ -20,12 +20,16 @@
#include <sys/types.h>
#include <stdio.h>
+#include <stdlib.h>
-#include <error.h>
+// #include <error.h>
#include <errno.h>
#include "perf-map-file.h"
+void error (int status, int errnum, const char *format, ...) {
+}
+
FILE *perf_map_open(pid_t pid) {
char filename[500];
snprintf(filename, sizeof(filename), "/tmp/perf-%d.map", pid);```
Just saw the tools.jar comment. I received that error before and I set this manually and then I got a slew of different errors, I posted what I needed to do above, but I did adapt the CMake file, though in a hacky fashion: +set(CMAKE_JAVA_INCLUDE_PATH /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home/lib/tools.jar)
Hi,
I can't seem to build most of the targets on El Capitan.