Closed FishTan closed 3 years ago
I still cannot resolve the problem above and I try to set JDK=jdk-lite
and make
, the new problem arise:
root@2879af78ceae:~/JLang# make
--- Checking setup ---
+ ant found
+ JDK 7 found
+ git lfs installed
+ LLVM version is up to date: 5.0.1
+ Found libgc shared library
Setup looks good
--- Building Polyglot ---
Buildfile: /root/JLang/lib/polyglot/build.xml
java version is 1.8.0_271
current directory is /root/JLang/lib/polyglot
Java home directory is /usr/lib/jvm/jdk1.8.0_271/jre
Polyglot version is 2.7.1 (2020-11-24 12:21:20)
--- Building compiler ---
Buildfile: /root/JLang/build.xml
--- Building jdk-lite classes ---
make[1]: Entering directory '/root/JLang/jdk-lite'
make[1]: Nothing to be done for 'classes'.
make[1]: Leaving directory '/root/JLang/jdk-lite'
--- Building runtime ---
make[1]: Entering directory '/root/JLang/runtime'
Compiling 7 Java files with javac (.java --> .class)
Compiling 7 Java files with JLang (.java --> .ll)
/root/JLang/runtime/src/jlang/runtime/Exceptions.java:10: No valid method
call found for getConstructor(java.lang.Class<java.lang.String>) in
java.lang.Class<capture$2-of ? extends java.lang.Throwable>.
Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class);
^--------------------------------^
1 error.
null
Makefile:47: recipe for target 'out/ll_stamp' failed
make[1]: *** [out/ll_stamp] Error 1
make[1]: Leaving directory '/root/JLang/runtime'
Makefile:80: recipe for target 'runtime' failed
make: *** [runtime] Error 2
I found that no vaild method for getConstructor(), so I tried to comment out this method in /root/JLang/runtime/src/jlang/runtime/Exceptions.java
just like this:
static void throwNewThrowable(Class<? extends Throwable> clazz, String msg) throws Throwable {
//Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class);
//throw ctor.newInstance(msg);
}
then it worked out and I executed ./bin/jlangc -cp "$JDK"/out/classes HelloWorld.java
to compile HelloWorld.ll successfully but when l executed ./bin/compile_ll.sh Hello.ll
, it failed again:
root@c6ec7c2697d9:~/JLang# ./bin/compile_ll.sh Hello.ll
/root/JLang/bin
/root/JLang/runtime/out/libjvm.so: undefined reference to `Polyglot_java_lang_InterruptedException_cdv'
/root/JLang/runtime/out/libjvm.so: undefined reference to `Polyglot_java_lang_reflect_Method_Method__Ljava_lang_Class_2Ljava_lang_String_2_3Ljava_lang_Class_2Ljava_lang_Class_2_3Ljava_lang_Class_2IILjava_lang_String_2_3B_3B_3B'
/root/JLang/jdk-lite//out/libjdk.so: undefined reference to `Polyglot_java_io_ObjectOutputStream_class'
/root/JLang/runtime/out/libjvm.so: undefined reference to `Polyglot_java_lang_InterruptedException_InterruptedException__'
/root/JLang/jdk-lite//out/libjdk.so: undefined reference to `Polyglot_java_io_ObjectInputStream_class'
/root/JLang/runtime/out/libjvm.so: undefined reference to `Polyglot_java_lang_reflect_Field_Field__Ljava_lang_Class_2Ljava_lang_String_2Ljava_lang_Class_2IILjava_lang_String_2_3B'
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
Wrote compiled binary to Hello.o
I really confused.
BTW, I tried to compile JLang on both ubuntu16.04
and ubuntu18.04
and got the same problems.
JDK7 is jdk1.7.0_80
Bootstrap JDK I had tried both java-se-8u41-ri
and jdk1.8.0_271
Thanks if you could give some helps.
Hi, thanks for your interest in JLang!
For your second issue - the 'jdk-lite' library was built as a testing jdk lib that could be compiled quickly but intentionally doesn't fulfill pretty much any of the standard functionality. At some point during development, our runtime needed more functionality and now no longer can compile with the jdk-lite.
I'll create a ticket to track updating this, but likely it won't be a high priority to modify the jdk-lite lib to provide the necessary support.
A better solution would be to figure out why your JVM is running out of heap space while compiling the JDK. Based on the error message, your compilation is failing when running the normal java compiler, not JLang.
You can increase its heap memory by setting the JAVA_TOOL_OPTIONS environment variables.
For example, setting javac's max heap size to 1GB worked for me:
> export JAVA_TOOL_OPTIONS=-Xmx1g
Thanks!
I once tried:
export JAVA_OPTS="-Xms128m -Xmx1024m
which didn't work.
export JAVA_TOOL_OPTIONS=-Xmx1g
works!
I just meet this problem and have no ideas. Anyone has met the same problem?
root@2879af78ceae:~/JLang# make --- Checking setup ---
--- Building compiler --- Buildfile: /root/JLang/build.xml
--- Building jdk classes --- make[1]: Entering directory '/root/JLang/jdk' Creating JDK class files
The system is out of resources. Consult the following stack trace for details. java.lang.OutOfMemoryError: Java heap space at com.sun.tools.javac.parser.Scanner.stringVal(Scanner.java:741) at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:560) at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:484) at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:993) at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:701) at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:672) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:628) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:610) at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:600) at com.sun.tools.javac.parser.JavacParser.variableInitializer(JavacParser.java:1545) at com.sun.tools.javac.parser.JavacParser.arrayInitializer(JavacParser.java:1535) at com.sun.tools.javac.parser.JavacParser.arrayCreatorRest(JavacParser.java:1482) at com.sun.tools.javac.parser.JavacParser.creator(JavacParser.java:1431) at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1002) at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:701) at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:672) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:628) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:610) at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:600) at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1209) at com.sun.tools.javac.parser.JavacParser.classCreatorRest(JavacParser.java:1512) at com.sun.tools.javac.parser.JavacParser.creator(JavacParser.java:1451) at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1002) at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:701) at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:672) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:628) at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:610) at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:600) at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1212) at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1224) at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1031) at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:701) Makefile:49: recipe for target 'out/classes/cstamp' failed make[1]: [out/classes/cstamp] Error 3 make[1]: Leaving directory '/root/JLang/jdk' Makefile:85: recipe for target 'jdk-classes' failed make: [jdk-classes] Error 2