1
我工作的一個JNI LIB的I2C傳感器,我不能讓我的makefile工作,可有人請看看:JNI編譯致命錯誤:jni.h:沒有這樣的文件或目錄
CC = gcc
#CFLAGS = -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marmv6z -Wall
CFLAGS = -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm -O3 -Wall -shared -I/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include -I/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include/linux
LIBS= -L'$(LD_LIBRARY_PATH)' -ljvm
LD = ld
LDFLAGS =
OBJ = Test.o raspi.o i2c.o sht21.o
BIN = libpijava.so
gpio: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS) $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
clean:
rm -rf $(BIN) $(OBJ)
我的JNI的C文件是Test.cpp的,它依賴於sht21.h,raspi.h和i2c.h中
也發生了變化:
CC = gcc -I/usr/lib/jvm/default-java
#CFLAGS = -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marmv6z -Wall
CFLAGS = -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -marm -O3 -Wall -shared -I/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include -I/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include/linux
LD = ld
LDFLAGS =
OBJ = Test.o raspi.o i2c.o sht21.o
BIN = libpijava.so
gpio: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
clean:
rm -rf $(BIN) $(OBJ)
我也改變了它: *發佈在編輯問題* 而且它仍然不起作用 –
對不起,錯誤的路徑。你還必須安裝'default-jdk-headless'軟件包。 –
沒有辦法,它的一個樹莓派我運行它:包沒有找到 –