javamakefilecentosjsvc

JSVC can't be build


I can't build JSVC locally on Centos 7 from tarball

http://archive.apache.org/dist/commons/daemon/source/commons-daemon-1.0.15-src.tar.gz
tar -zxf commons-daemon-1.0.15-src.tar.gz

I have JRE installed at the location /usr/java/jdk1.8.0_351-amd64:

I do according to the instruction:

cd /opt/install
wget http://archive.apache.org/dist/commons/daemon/source/commons-daemon-1.0.15-src.tar.gz
tar -zxf commons-daemon-1.0.15-src.tar.gz
cd ./commons-daemon-1.0.15-src/src/native/unix
./configure && make

Despite I have $JAVA_HOME pointed exactly to /usr/java/jdk1.8.0_351-amd64 the ./configure script still requires something to substitute missing $JAVA_HOME like sudo ./configure --with-java=/usr/java/jdk1.8.0_351-amd64

But it can't define the needed folder correctly even withthis parameter. The only option that allows me to build is

sudo ./configure --with-java=/usr/java/jdk1.8.0_351-amd64/include --with-os-type=linux 

So it requires /include part to be here to build the full correct path.

Bu the later causes problems on the next step, when I do make. It puts that surplus /include to the path that is a parameter of gcc and I'm getting the errors like that:

sudo make -I /usr/java/jdk1.8.0_351-amd64(cd native; make  all)
make[1]: Entering directory `/opt/install/commons-daemon-1.0.15-src/src/native/unix/native'
gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/usr/java/jdk1.8.0_351-amd64/include/include -I/usr/java/jdk1.8.0_351-amd64/include/include/linux -c java.c -o java.o
java.c:24:17: fatal error: jni.h: No such file or directory

So, how I can work it around? The first part doesn't work without /include, the second part doesn't work because of it.


Solution

  • I had to do a dirty hack like changing manually one file being produced on the ./configure stage and before the make stage.

    In the root folder together with Makefile we have Makedefs file

    Here replace

    INCLUDES =  -I/usr/java/jdk1.8.0_351-amd64/include/include -I/usr/java/jdk1.8.0_351-amd64/include/linux
    

    with

    INCLUDES =  -I/usr/java/jdk1.8.0_351-amd64/include/include -I/usr/java/jdk1.8.0_351-amd64/include/include/linux
    

    and compilation would succeed.

    I have no idea what hould be done by design according to the JSVC instruction.