kingbobo / hadoop-snappy

Automatically exported from code.google.com/p/hadoop-snappy
Apache License 2.0
0 stars 0 forks source link

/usr/bin/ld: cannot find -ljvm #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to build hadoop-snappy but it does not work with errors.

[exec] make  all-am
     [exec] make[1]: Entering directory `/home/ywkim/workspace/hadoop-snappy/target/native'
     [exec] /bin/bash ./libtool --tag=CXX   --mode=link g++  -g -O2 -version-info 0:1:0 -L/usr/local/lib -o libhadoopsnappy.la -rpath /usr/local/lib src/SnappyCompressor.lo src/SnappyDecompressor.lo  -ljvm 
     [exec] libtool: link: g++ -shared -nostdlib /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crti.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtbeginS.o  src/.libs/SnappyCompressor.o src/.libs/SnappyDecompressor.o   -L/usr/local/lib -ljvm -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2 -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../.. -L/usr/lib/x86_64-linux-gnu -lstdc++ -lm -lc -lgcc_s /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/crtendS.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crtn.o    -Wl,-soname -Wl,libhadoopsnappy.so.0 -o .libs/libhadoopsnappy.so.0.0.1
     [exec] make[1]: Leaving directory `/home/ywkim/workspace/hadoop-snappy/target/native'
     [exec] /usr/bin/ld: cannot find -ljvm
     [exec] collect2: ld returned 1 exit status
     [exec] make[1]: *** [libhadoopsnappy.la] 오류 1
     [exec] make: *** [all] 오류 2

Ubuntu 11.04(x86_64, on VirtualBox)

Original issue reported on code.google.com by warwit...@gmail.com on 24 May 2011 at 7:14

GoogleCodeExporter commented 9 years ago
I had the same problem on Ubuntu 11.04(i386 and x86_64). My solution:

Comment line 58 in src/main/native/configure.ac:
LDFLAGS=$ldflags_bak
replace:
#LDFLAGS=$ldflags_bak

Original comment by krzyszto...@gmail.com on 29 Jul 2011 at 1:59

GoogleCodeExporter commented 9 years ago
In fact for resolve it you should create symbolic link in /usr/local/lib for 
libjvm.so. like:
$ sudo ln -s /usr/java/jdk1.6.0_27/jre/lib/i386/server/libjvm.so /usr/local/lib/

because it try to compile it with flag:  -L/usr/local/lib

Probably also to /usr/lib. In my case error was:
[exec] libtool: link: gcc -shared  
src/org/apache/hadoop/io/compress/snappy/.libs/SnappyCompressor.o 
src/org/apache/hadoop/io/compress/snappy/.libs/SnappyDecompressor.o   
-L/usr/local/lib -ljvm -ldl  -m32   -Wl,-soname -Wl,libhadoopsnappy.so.0 -o 
.libs/libhadoopsnappy.so.0.0.1
     [exec] /usr/bin/ld: cannot find -ljvm

Original comment by rku...@satelliz.com on 17 Oct 2011 at 1:04

GoogleCodeExporter commented 9 years ago
I am facing the same issue. 

[exec] config.status: executing libtool commands
     [exec] /bin/bash ./libtool --tag=CC   --mode=link gcc -g -Wall -fPIC -O2 -m64 -g -O2 -version-info 0:1:0 -L/usr/local/lib -o libhadoopsnappy.la -rpath /usr/local/lib src/org/apache/hadoop/io/compress/snappy/SnappyCompressor.lo src/org/apache/hadoop/io/compress/sn/usr/bin/ld: cannot find -ljvm
     [exec] collect2: ld returned 1 exit status
     [exec] make: *** [libhadoopsnappy.la] Error 1
     [exec] appy/SnappyDecompressor.lo  -ljvm -ldl 
     [exec] libtool: link: gcc -shared  src/org/apache/hadoop/io/compress/snappy/.libs/SnappyCompressor.o src/org/apache/hadoop/io/compress/snappy/.libs/SnappyDecompressor.o   -L/usr/local/lib -ljvm -ldl  -m64   -Wl,-soname -Wl,libhadoopsnappy.so.0 -o .libs/libhadoopsnappy.so.0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.762s
[INFO] Finished at: Thu Nov 17 15:14:53 PST 2011
[INFO] Final Memory: 8M/227M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile) on project 
hadoop-snappy: An Ant BuildException has occured: The following error occurred 
while executing this line:
[ERROR] 
/home/pkommireddi/misc/hadoop-snappy-read-only/maven/build-compilenative.xml:75:
 exec returned: 2

Original comment by prash1...@gmail.com on 17 Nov 2011 at 11:18

GoogleCodeExporter commented 9 years ago
/usr/lib64/gcc/x86_64-suse-linux/4.5/../../../../x86_64-suse-linux/bin/ld: 
cannot find -ljvm. 
I worked it around creating a symbolic link:
cd /usr/lib
ln -s /usr/lib64/jvm/java-1_6_0-ibm-1.6.0/jre/lib/amd64/default/libjvm.so 
libjvm.so

Use the path to libjvm.so that fits your installation

Original comment by south.mi...@gmail.com on 18 Feb 2014 at 1:42