我的 Mac OS X 10.11 历险记:
虚拟机
用 make clean && CFLAGS="-m32" ./configure.
GNU 类路径
花了一点时间:
# If you already made an attempt
make clean
## If you don't --disable-tools. I didn't have antlr, so I downloaded it.
#curl -O http://www.antlr.org/download/antlr-4.5.1-complete.jar
./configure --disable-gtk-peer --disable-gconf-peer \
--disable-tools # for tools: --with-antlr-jar=antlr-4.5.1-complete.jar
如果您make现在,编译将失败并显示
java_io_VMConsole.c:80:19: error: use of undeclared identifier 'IUCLC'. 我最终在谷歌上搜索了那个符号是什么——它是一个八进制 01000,并将它添加到源代码中:
vim ./native/jni/java-io/java_io_VMConsole.c
# add this line in the beginning of the file: #define IUCLC 0001000
在那之后,./configure 一直抱怨你javac不是 GCJ。它看起来像 GNU Classpath 的一个老错误,我发现提到了类似的问题。正如您在下面看到的,./configure它已损坏并且不能javac与gcj.
我最终只是编辑./configure:
- 一开始,我加了一行
export JAVAC=$(which javac)
- 我用
JAVAC_IS_GCJ=no
现在,./configure应该通过,但make不会。
我对为 生成的所有Makefiles内容./configure进行了grep,然后如果有带有参数的备用行,则-fsource=用(这是一个gcj特定标志)注释掉行,或者只是用.-fsource-sourcefsourcesource
最后一步,我必须编辑顶层并从行中Makefile删除- 它没有编译并出现错误:$(EXAMPLESDIR)SUBDIRS = ...
./gnu/classpath/examples/CORBA/NamingService/Demo.java:99: error:
package gnu.classpath.tools.tnameserv does not exist
gnu.classpath.tools.tnameserv.Main.main(args);"
它建成了!
我运行它时出错,但这是一个完全不同的故事......
$ DYLD_FALLBACK_LIBRARY_PATH=/usr/local/classpath/lib/classpath \
/usr/local/jamvm/bin/jamvm -verbose:class -verbose:jni Test
...
Failed to open library /usr/local/classpath/lib/classpath/libjavanio:
dlopen(/usr/local/classpath/lib/classpath/libjavanio.so,
1): image not found]
...
Exception occurred while printing exception (java/lang/NoClassDefFoundError)...
Original exception was java/lang/UnsatisfiedLinkError
(如果我设法运行它,我会更新答案)