NEURON-7.4 compilation problem --with-nrnjava

Post Reply
Posts: 1
Joined: Fri Oct 02, 2015 4:14 am

NEURON-7.4 compilation problem --with-nrnjava

Post by sbbtomoyoshida »

Dear Developer,

I am trying to compile NEURON-7.4 with java interface support.
My environment is Mac OS X 10.0.5.

I have downloaded iv-19 and nrn-7.4 from
What I've done so far:

At first, I successfully compiled iv. Next, I tried to compile nrn.

sh ./
./configure --with-iv=/usr/local/iv --with-nrnpython --with-nrnjava

After running ./configure in nrn-7.4, when I try to run make, I get the following results:

Code: Select all

Making all in nrnccmb
make[2]: Nothing to be done for `all'.
javah -classpath . -jni neuron.Neuron
javah -classpath . -jni neuron.Redirect
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src/nrnoc -I../../src/oc -I../../src/parallel -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I../../src/nrnpython  -DOOP=1 -DCABLE=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSEBBS=1 -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I../../src/nrniv -I../../src/CVODE -I../../src/nrncvode -I../../src/sparse13 -I../../src/gnu -I. -I../../src/ivoc -I../../src/nrnoc -I../oc -I../../src/oc  -I/usr/local/iv/include -I/usr/X11/include   -g -O2 -MT nrnjava.lo -MD -MP -MF .deps/nrnjava.Tpo -c -o nrnjava.lo nrnjava.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../../src/nrnoc -I../../src/oc -I../../src/parallel -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I../../src/nrnpython -DOOP=1 -DCABLE=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSEBBS=1 -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers -I../../src/nrniv -I../../src/CVODE -I../../src/nrncvode -I../../src/sparse13 -I../../src/gnu -I. -I../../src/ivoc -I../../src/nrnoc -I../oc -I../../src/oc -I/usr/local/iv/include -I/usr/X11/include -g -O2 -MT nrnjava.lo -MD -MP -MF .deps/nrnjava.Tpo -c nrnjava.cpp  -fno-common -DPIC -o .libs/nrnjava.o
nrnjava.cpp:126:10: error: cannot initialize a member subobject of type 'const char **(*)(void *)' with an lvalue of type 'char **(void *)': different return type
      ('const char **' vs 'char **')
        "name", joname,
nrnjava.cpp:502:21: error: use of undeclared identifier 'wincast'
                        setwinID, (jlong)wincast, type, left, top);
2 errors generated.
make[2]: *** [nrnjava.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Does anyone know what this error is and how to get around it?

Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON-7.4 compilation problem --with-nrnjava

Post by hines »

Sorry for the delay in responding. SFN...

It has been more than a decade since I tried to configure using --with-nrnjava. I guess that the java API has evolved to be more strict with regard to const char* vs char*.
On my ubuntu machine configure fails with

Code: Select all

Build the nrnjava interface
checking for javac... /usr/bin/javac
checking symlink for /usr/bin/javac... /etc/alternatives/javac
checking symlink for /etc/alternatives/javac... /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
Found a path to the libjvm
Determined JVMLIBDIR=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
Using JNI_INCLUDE_FLAGS=" -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux"
Using JVM_LIB_FLAGS="-L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64 -L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm -lpthread"
checking checking whether the java 2 virtual machine can be created... The test program that tests initialization of the java 2 virtual machine,
 failed. See config.log .
  It may be that linking requires some more -l libraries
  or extended LD_LIBRARY_PATH
  or perhaps the java vm is not JNI_VERSION_1_2.
JCFLAGS= -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux
JLFLAGS=-L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64 -L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm -lpthread
and in particular (from config.log)

Code: Select all

configure:18981: gcc -o conftest -g -O2
-L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm -lpthread
conftest.c -lm -ldl >&5

/tmp/cc6cvX3l.o: In function `main':

/home/hines/neuron/nrnjava/conftest.c:39: undefined reference to 

collect2: error: ld returned 1 exit status
Which is odd since

Code: Select all

hines@hinesT7500:/usr/lib/jvm/java-7-openjdk-amd64/include$ grep CreateJava *
jni.h:JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
Anyway, it looks like it will take some effort to resurrect this.
Site Admin
Posts: 1600
Joined: Wed May 18, 2005 3:32 pm

Re: NEURON-7.4 compilation problem --with-nrnjava

Post by hines » ... fb3ef3e0c4
resurrects java support for linux and mac. Note that it will likely be necessary for launching to set LD_LIBRARY_PATH so that the system can find and dynamically load the libjvm
Post Reply