求探讨一个编译出现的bug
yuyinyang
2013-05-05
我修改了一个cpp文件在其中加入了一些代码,其中一部分如下
... #include <sstream> ... void combineStringWithInt(int i){ std::stringstream ss; ss << "String "; ss << (uint)i; const char *result = stream.str().c_str(); printf("The reult is: %s\n", result); } ... 结果报如下错误 引用 ...
Linking vm... /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.6.3/libstdc++.a(functexcept.o): relocation R_X86_64_32 against `std::bad_exception::~bad_exception()' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/4.6.3/libstdc++.a: could not read symbols: Bad value collect2: ld returned 1 exit status ln: accessing `libjvm.so.1': Too many levels of symbolic links /usr/bin/chcon: failed to get security context of `libjvm.so': Too many levels of symbolic links ERROR: Cannot chcon libjvm.so make[6]: stat: libjvm.so: Too many levels of symbolic links echo Linking launcher... Linking launcher... gcc -m64 -Xlinker -O1 -Wl,--hash-style=both -Xlinker -z -Xlinker noexecstack -m64 -Xlinker -export-dynamic -L `pwd` -o gamma launcher/java_md.o launcher/wildcard.o launcher/java. o launcher/jli_util.o -ljvm -lm -ldl -lpthread make[6]: Leaving directory `/home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/hotspot/outputdir/linux_amd64_compiler2/product' All done. make[5]: Leaving directory `/home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/hotspot/outputdir/linux_amd64_compiler2/product' cd linux_amd64_compiler2/product && ./test_gamma java full version "1.6.0_24-b24" Error: no JVM at `/home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/hotspot/outputdir/linux_amd64_compiler2/product/libjvm.so'. make[4]: *** [product] Error 4 make[4]: Leaving directory `/home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/hotspot/outputdir' make[3]: *** [generic_build2] Error 2 make[3]: Leaving directory `/home/yuyinyang/workspace/openjdk/hotspot/make' make[2]: *** [product] Error 2 make[2]: Leaving directory `/home/yuyinyang/workspace/openjdk/hotspot/make' make[1]: *** [hotspot-build] Error 2 make[1]: Leaving directory `/home/yuyinyang/workspace/openjdk' make: *** [build_product_image] Error 2 我觉得粗体的那行信息应该是关键所在,不知道有什么方法可以解决吗? |
|
yuyinyang
2013-05-05
还有个问题,如果我编译的时候选择不编译JAXP和JAXWS,make BUILD_JAXP=false BUILD_JAXWS=false,会报下面的错
引用 java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:131) at java.util.zip.ZipFile.<init>(ZipFile.java:92) at sun.tools.jar.Main.extract(Main.java:893) at sun.tools.jar.Main.run(Main.java:254) at sun.tools.jar.Main.main(Main.java:1167) ( cd /home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/classes && /usr/lib/jvm/java-openjdk/bin/jar xfv /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/lib/tools.jar com/sun/codemodel com/sun/istack/internal/tools com/sun/istack/internal/ws com/sun/xml/internal/rngom com/sun/xml/internal/xsom com/sun/xml/internal/dtdparser com/sun/tools/internal/xjc com/sun/tools/internal/ws com/sun/tools/internal/jxc org/relaxng META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory META-INF/services/com.sun.tools.internal.xjc.Plugin -J-XX:-PrintVMOptions -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-Xmx512m -J-Xms512m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m ) java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:131) at java.util.zip.ZipFile.<init>(ZipFile.java:92) at sun.tools.jar.Main.extract(Main.java:893) at sun.tools.jar.Main.run(Main.java:254) at sun.tools.jar.Main.main(Main.java:1167) make[4]: *** [/home/yuyinyang/workspace/openjdk/build/openjdk-full-debug/tmp/java/components_imported] Error 1 make[4]: Leaving directory `/home/yuyinyang/workspace/openjdk/jdk/make/java/redist' make[3]: *** [all] Error 1 make[3]: Leaving directory `/home/yuyinyang/workspace/openjdk/jdk/make/java' make[2]: *** [all] Error 1 make[2]: Leaving directory `/home/yuyinyang/workspace/openjdk/jdk/make' make[1]: *** [jdk-build] Error 2 make[1]: Leaving directory `/home/yuyinyang/workspace/openjdk' make: *** [build_product_image] Error 2 |
|
RednaxelaFX
2013-05-05
请说明您试图build的OpenJDK的具体版本。
顶楼的问题: 你的build环境里,你没做任何代码改动前OpenJDK能正常编译完不? 总感觉你的G++没装完整… 或者你动过任何Makefile、*.make文件么? 后面的一个问题: 那个ZipFile的异常其实是很隐晦的告诉你,jar命令试图解压的文件不存在。 jar xfv /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/lib/tools.jar 看这个路径就知道了。路径里有/NOT-SET/,说明build的环境的环境变量没设够。我通常是把ALT_BOOTDIR和ALT_JDK_IMPORT_PATH都设到一个已经存在的、版本兼容的JDK上。 http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html <- 这个说明请好好读 |
|
yuyinyang
2013-05-06
RednaxelaFX 写道 请说明您试图build的OpenJDK的具体版本。
我编的版本是 openjdk-7-fcs-src-b147-27_jun_2011 RednaxelaFX 写道 顶楼的问题:
你的build环境里,你没做任何代码改动前OpenJDK能正常编译完不? 总感觉你的G++没装完整… 或者你动过任何Makefile、*.make文件么? 我在添加这段代码之前编过是没有问题的,添加了这段之后就报了如上错误。 怎么判断g++是否安装完整? 这段代码我在外面单独编译运行是没问题的,放到hotspot里面就报错了。我觉得会不会是库文件路径设置的问题? RednaxelaFX 写道 那个ZipFile的异常其实是很隐晦的告诉你,jar命令试图解压的文件不存在。
jar xfv /NOT-SET/re/jdk/1.7.0/promoted/latest/binaries/linux-amd64/lib/tools.jar 看这个路径就知道了。路径里有/NOT-SET/,说明build的环境的环境变量没设够。我通常是把ALT_BOOTDIR和ALT_JDK_IMPORT_PATH都设到一个已经存在的、版本兼容的JDK上。 http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html <- 这个说明请好好读 这个确实是像您说的,我没有设置ALT_JDK_IMPORT_PATH,设好之后没有问题了 |