Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix the build on Linux #5

Merged
merged 3 commits into from

2 participants

@bitbckt
  • Linux requires unistd.h for the write(2) and close(2) syscalls.
  • The proper shared object suffix on Linux is "so"; even for JNI bindings.
  • Ignore all *.so files.
  • Remove -mimpure-text; this is irrelevant on non-SPARC targets... check for SPARC, if this is necessary.
Brandon Mitc... added some commits
@mariusae mariusae merged commit caebed1 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 25, 2012
  1. Ignore .so files.

    Brandon Mitchell authored
  2. Use .so on Linux, .jnilib on OS X.

    Brandon Mitchell authored
  3. Include unistd.h for write(2) and close(2).

    Brandon Mitchell authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 5 deletions.
  1. +2 −1  .gitignore
  2. +6 −4 Makefile
  3. +1 −0  heapster.cc
View
3  .gitignore
@@ -1,3 +1,4 @@
*.class
*.jnilib
-*.o
+*.o
+*.so
View
10 Makefile
@@ -4,23 +4,25 @@ OS=$(shell uname -s | tr '[A-Z]' '[a-z]')
ifeq ("$(OS)", "darwin")
JAVE_HOME=$(shell /usr/libexec/java_home)
JAVA_HEADERS=/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Headers/
+OBJ=libheapster.jnilib
endif
ifeq ("$(OS)", "linux")
JAVA_HOME=/usr/java/default/
JAVA_HEADERS=$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
+OBJ=libheapster.so
endif
CFLAGS=-Ijava_crw_demo -fno-strict-aliasing \
-fPIC -fno-omit-frame-pointer -W -Wall -Wno-unused -Wno-parentheses \
-I$(JAVA_HEADERS)
LDFLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer \
- -static-libgcc -mimpure-text -shared
+ -static-libgcc -shared
DEBUG=-g
-all: libheapster.jnilib Heapster.class
+all: $(OBJ) Heapster.class
-libheapster.jnilib: heapster.o sampler.o util.o java_crw_demo/java_crw_demo.o
+$(OBJ): heapster.o sampler.o util.o java_crw_demo/java_crw_demo.o
g++ $(DEBUG) $(LDFLAGS) -o $@ $^ -lc
%.o: %.cc
@@ -31,5 +33,5 @@ libheapster.jnilib: heapster.o sampler.o util.o java_crw_demo/java_crw_demo.o
clean:
rm -f *.o
- rm -f libheapster.jnilib
+ rm -f $(OBJ)
rm -f java_crw_demo/*.o
View
1  heapster.cc
@@ -13,6 +13,7 @@
#include <jvmti.h>
#include <string.h>
#include <fcntl.h>
+#include <unistd.h>
#include "java_crw_demo.h"
#include <set>
Something went wrong with that request. Please try again.