node-java icon indicating copy to clipboard operation
node-java copied to clipboard

build issue

Open AnnamrajuSarvani opened this issue 8 years ago • 2 comments

I installed node-java 0.8 on ubuntu14.04. I am using node java for nw js(0.22.3) so tried to build with nw-gyp, first configured like this inside node java nw-gyp configure --target=0.22.3 Now build nw-gyp build --target=0.22.3 Build is failing with following errors SOLINK_MODULE(target) Release/obj.target/nodejavabridge_bindings.node /usr/bin/ld: cannot find -ljvm collect2: error: ld returned 1 exit status make: *** [Release/obj.target/nodejavabridge_bindings.node] Error 1 make: Leaving directory /home/cronj-10/Sarvani/offline-sample-app/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/local/lib/node_modules/nw-gyp/lib/build.js:294:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:194:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 3.13.0-115-generic gyp ERR! command "/home/cronj-10/.nvm/versions/node/v7.9.0/bin/node" "/usr/local/bin/nw-gyp" "build" "--target=0.22.3" gyp ERR! cwd /home/cronj-10/Sarvani/offline-sample-app/node_modules/java gyp ERR! node -v v7.9.0 gyp ERR! nw-gyp -v v3.4.0 gyp ERR! not ok I have java 1.8 and JAVA_HOME is set. When I do it with node-gyp it works but I need the same for nw js. Please help with the issue.

AnnamrajuSarvani avatar Jun 06 '17 09:06 AnnamrajuSarvani

check your software-properties-common python-software-properties and build-essential automake gcc g++ clang installation

tested it with docker 14.04

  1. create container instance from ubuntu 14.04 - then like in dockerfile
  2. RUN apt-get update -y --fix-missing
  3. RUN apt-get install -y software-properties-common python-software-properties
  4. RUN apt-get -y install curl build-essential automake gcc g++ clang libssl-dev
  5. RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
  6. RUN add-apt-repository -y ppa:webupd8team/java
  7. RUN apt-get update -y
  8. RUN apt-get install -y oracle-java8-installer
  9. RUN rm -rf /var/lib/apt/lists/*
  10. RUN rm -rf /var/cache/oracle-jdk8-installer
  11. ENV JAVA_HOME /usr/lib/jvm/java-8-oracle (export JAVA_HOME=/usr/lib/jvm/java-8-oracle)
  12. ENV PATH ${JAVA_HOME}/bin:$PATH (export PATH=$JAVA_HOME/bin:$PATH)
  13. RUN java -version
  14. ENV NVM_DIR /usr/local/nvm (export NVM_DIR=/usr/local/nvm)
  15. ENV NODE_VERSION 7.10.0 (export NODE_VERSION=7.10.0)
  16. curl https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash
  17. source $NVM_DIR/nvm.sh
  18. nvm install $NODE_VERSION
  19. nvm alias default $NODE_VERSION
  20. nvm use default
  21. ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules (export NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules)
  22. ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH (export PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH)
  23. RUN node --version
  24. RUN npm i -g nw-gyp
  25. RUN cd
  26. RUN npm init --yes
  27. RUN npm i java
  28. RUN cd node_modules/java/
  29. RUN nw-gyp configure --target=0.22.3
  30. RUN nw-gyp build --target=0.22.3

all done! all fine!

naxmefy avatar Jun 09 '17 22:06 naxmefy

I have similar problem while installing on Raspberry Pi 3. I have found the root of the issue. Script which searches for java lib dir ( find_java_libdir.sh ) returned path "/usr/lib/jvm/java-8-openjdk-armhf/jre/lib/arm/server", but in fact there is no "server" directory. Instead there is directory "client". It seems that my issue is related to the https://www.raspberrypi.org/forums/viewtopic.php?t=197824

andrui avatar Nov 25 '19 15:11 andrui