joeferner / node-java

Bridge API to connect with existing Java APIs.
MIT License
1.87k stars 279 forks source link

Build failing for 32bit/64bit Linux distributions #68

Closed shobhitsharma closed 10 years ago

shobhitsharma commented 10 years ago

Tried to install package but still can't use it due to following stack trace.

make: Entering directory `/home/node_modules/java/build'
make: *** No rule to make target `/jre/lib/i386/server/libjvm.so', needed by `build/depsVerified'.  Stop.
make: Leaving directory `/home/node_modules/java/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/shobhit/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.0-30-generic
gyp ERR! command "node" "/home/shobhit/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/shobhit/Workspace/uptime-pinging/node_modules/java
gyp ERR! node -v v0.10.17
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

Any clues?

joeferner commented 10 years ago

Does /jre/lib/i386/server/libjvm.so exist? If not check your JAVA_HOME variable and check where libjvm.so lives.

shobhitsharma commented 10 years ago

I reverified my root path for Java sdk. Now it returned this trace:

make: Entering directory `/var/www/xmpp-chat/node_modules/java/build'
make: *** No rule to make target `/usr/lib/jvm/java-7-openjdk-i386/include/jni.h', needed by `build/depsVerified'.  Stop.
make: Leaving directory `/var/www/xmpp-chat/node_modules/java/build'

What package of java is more likely compatible 1.6 or 1.7?

grawk commented 10 years ago

This same issue just cropped up for me as well. It appears that for some reason the make build is trying to reference a path that doesn't exist: [exec] make: *\ No rule to make target /x/re/jdk1.6.0_16/jre/lib/amd64/server/libjvm.so', needed bybuild/depsVerified'. Stop.

the "amd64" directory does not exist. The libjvm.so is under "i386/server" instead.

Ajeet-Ganga commented 10 years ago

I too faced the same issue. The comment is kind of vote up for the issue. :+1:

Ajeet-Ganga commented 10 years ago

Ok this is how i got it working on my mac, finally phew !

  1. git clone the latest code
  2. Modify finding.gyp
  3. Hardcode java_home and java version as follows ['OS=="mac"', { 'javahome%': "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home", 'javaver%' : "1.7" }]
  4. For some reason this still couldn't find jni_md.h which was under JAVA_HOME/include/darwin/ so I copied these files to JAVA_HOME/include/
gregory-h commented 10 years ago

Same problem on Intel based Ubuntu 12.04 64 bit.

Problem seems to be that finding.gyp doesn't find a value for JAVA_HOME even tho it is defined and exported to child processes.

Trying Ajeet's solution but have no experience with building npm modules. Forked the repo into my node_modules folder and modified finding.gyp, but 'npm install java' doesn't seem to see my modifications - is there another way to directly build the forked repo?

Ajeet-Ganga commented 10 years ago

This is how I got it done :

~/mycode/ : Where I have my server.js file ~/mycode/clonecode : Where I did git clone

cd ~/mycode/ sudo npm -g install clonecode

Btw, dont bother. The code gives bunch of other error when it is compiled, and I lost patience to fix it instead of coding functionality ....

joeferner commented 10 years ago

@oneHappyCanuck cd into the node_modules/java directory and type "npm install" if you want better logging you can also try "node-gyp configure build" (if node-gyp is not installed globally you will need to run "sudo npm install -g node-gyp")

jsdevel commented 10 years ago

@grawk @oneHappyCanuck @Ajeet-Ganga @ShobhitSharma Can you clone my fork locally and try building that? Here's the URL: https://github.com/jsdevel/node-java.git

I currently have PR for issue #94 open and I believe it will solve issues like this.

adamramadhan commented 10 years ago

got this error too

jsdevel commented 10 years ago

@adamramadhan What version of node-java are you using? What is the output of uname -a and what distro are you using?

neurotech commented 10 years ago

I'm encountering this error when trying to install node-java 0.2.9 on Amazon Linux AMI 2013.09.2 via EC2.

make: *** No rule to make target `/jre/lib/amd64/server/libjvm.so', needed by `build/depsVerified'. Stop.

When I enter echo $JAVA_HOME this is returned:

/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/

Does anyone know how to fix this? I'm fairly new this side of things and don't really know what I'm doing.

jsdevel commented 10 years ago

@neurotech, thanks for posting. Can you paste the output of the following commands?

uname -a find /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 -type d ls -al /usr/lib/jvm

neurotech commented 10 years ago

@jsdevel Sure:

uname -a
Linux ip-10-250-18-5 3.4.73-64.112.amzn1.x86_64 #1 SMP Tue Dec 10 01:50:05 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

find /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 -type d
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/native_threads
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/headless
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/xawt
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/jli
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/security
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/management
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/im
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/cmm
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/ext
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Indian
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Australia
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Asia
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Pacific
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Antarctica
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/SystemV
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Etc
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Atlantic
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/America
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/America/Argentina
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/America/North_Dakota
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/America/Indiana
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/America/Kentucky
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Africa
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/zi/Europe
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/images
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/images/cursors
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/applet
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin

ls -al /usr/lib/jvm
total 16
drwxr-xr-x  4 root root 4096 Mar  9 06:04 .
dr-xr-xr-x 14 root root 4096 Mar  9 05:22 ..
drwxr-xr-x  3 root root 4096 Feb  3 22:01 java-1.6.0-openjdk-1.6.0.0.x86_64
drwxr-xr-x  3 root root 4096 Mar  9 05:58 java-1.7.0-openjdk-1.7.0.51.x86_64
lrwxrwxrwx  1 root root   21 Mar  9 06:04 jre -> /etc/alternatives/jre
lrwxrwxrwx  1 root root   27 Mar  9 05:19 jre-1.6.0 -> /etc/alternatives/jre_1.6.0
lrwxrwxrwx  1 root root   37 Mar  9 05:19 jre-1.6.0-openjdk.x86_64 -> java-1.6.0-openjdk-1.6.0.0.x86_64/jre
lrwxrwxrwx  1 root root   27 Mar  9 05:58 jre-1.7.0 -> /etc/alternatives/jre_1.7.0
lrwxrwxrwx  1 root root   38 Mar  9 05:58 jre-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.51.x86_64/jre
lrwxrwxrwx  1 root root   29 Mar  9 05:58 jre-openjdk -> /etc/alternatives/jre_openjdk
jsdevel commented 10 years ago

@neurotech I have a feeling openjdk is misleading. Can you check and see if the JDK is installed? I think the name openjdk is causing many to assume that the JDK is installed when it's not.

neurotech commented 10 years ago

Forgive me - how do I check to see if the JDK is installed?

joeferner commented 10 years ago

Take a look at http://openjdk.java.net/install/ you want the openjdk-7-jdk package.

neurotech commented 10 years ago

@joeferner thanks.

I literally just finished implementing the steps outlined here: http://websitenotebook.blogspot.com.au/2013/09/install-oracle-java-jdk-on-amazon-linux.html

and here: https://gist.github.com/tankchintan/1335220

node-java now installs perfectly on Amazon Linux AMI!

jsdevel commented 10 years ago

@ShobhitSharma can you try with latest?

jsdevel commented 10 years ago

@ShobhitSharma I'm going to close this out for now. If this still affects you please reopen. Thanks!

rochal commented 10 years ago

I'm still getting the error on my EC2 instance:

$ sudo npm install java

npm http GET https://registry.npmjs.org/java
npm http 200 https://registry.npmjs.org/java

> java@0.2.9 install /home/ubuntu/test/node_modules/java
> node-gyp rebuild

make: Entering directory `/home/ubuntu/test/node_modules/java/build'
make: *** No rule to make target `/jre/lib/amd64/server/libjvm.so', needed by `build/depsVerified'.  Stop.
make: Leaving directory `/home/ubuntu/test/node_modules/java/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/ubuntu/test/node_modules/java
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1
npm ERR! not ok code 0

$ java -version

java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

$ cat /etc/issue

Ubuntu 14.04 LTS \n \l

$ python --version

Python 2.7.6

Am I missing something?

jsdevel commented 10 years ago

@rochal it looks like you're still on node-java@0.2.9. Can you update to the latest version?