Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit e417a2b

Browse files
document limitations of native-image in README.md
1 parent 7c8a1a2 commit e417a2b

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

standalone/README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,63 @@ To run a native image open a terminal window and type
4949

5050
The parameters are the same as for the [executable JAR](#executable-jar).
5151

52+
## Important: Native Images Do not Work Anymore
53+
54+
Starting with SQLcl 23.1.0 it is not possible to build native images on all platforms anymore.
55+
The reason is that the underlying parser uses AWT/Swing components (for whatever reason).
56+
AWT/Swing components are supported on AMD/Linux platforms only by GraalVM.
57+
As a result this build process will produce a non-working native image on most platforms.
58+
59+
You will see the following stacktrace similar to the following when running the resulting native image:
60+
61+
```
62+
at com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:120)
63+
at java.base@17.0.6/java.lang.ClassLoader.loadLibrary(ClassLoader.java:50)
64+
at java.base@17.0.6/java.lang.Runtime.loadLibrary0(Runtime.java:818)
65+
at java.base@17.0.6/java.lang.System.loadLibrary(System.java:1989)
66+
at java.desktop@17.0.6/java.awt.Toolkit$2.run(Toolkit.java:1388)
67+
at java.desktop@17.0.6/java.awt.Toolkit$2.run(Toolkit.java:1386)
68+
at java.base@17.0.6/java.security.AccessController.executePrivileged(AccessController.java:168)
69+
at java.base@17.0.6/java.security.AccessController.doPrivileged(AccessController.java:318)
70+
at java.desktop@17.0.6/java.awt.Toolkit.loadLibraries(Toolkit.java:1385)
71+
at java.desktop@17.0.6/java.awt.Toolkit.initStatic(Toolkit.java:1423)
72+
at java.desktop@17.0.6/java.awt.Toolkit.<clinit>(Toolkit.java:1397)
73+
at java.desktop@17.0.6/java.awt.Component.<clinit>(Component.java:624)
74+
at java.base@17.0.6/java.lang.Class.ensureInitialized(DynamicHub.java:528)
75+
at java.base@17.0.6/java.lang.Class.ensureInitialized(DynamicHub.java:528)
76+
at java.base@17.0.6/java.lang.Class.ensureInitialized(DynamicHub.java:528)
77+
at java.base@17.0.6/java.lang.Class.ensureInitialized(DynamicHub.java:528)
78+
at java.base@17.0.6/java.lang.Class.ensureInitialized(DynamicHub.java:528)
79+
at oracle.dbtools.parser.Visual.<init>(Visual.java:404)
80+
at oracle.dbtools.parser.Grammar.parseGrammarFile(Grammar.java:172)
81+
at oracle.dbtools.parser.Grammar.parseGrammarFile(Grammar.java:152)
82+
at oracle.dbtools.arbori.Program.getRules(Program.java:277)
83+
at oracle.dbtools.arbori.Program.getArboriParser(Program.java:187)
84+
at oracle.dbtools.arbori.Program.compile(Program.java:330)
85+
at oracle.dbtools.arbori.Program.compile(Program.java:319)
86+
at oracle.dbtools.arbori.Program.compile(Program.java:316)
87+
at oracle.dbtools.app.XML2Table.<init>(XML2Table.java:70)
88+
at oracle.dbtools.app.Persist2XML.<init>(Persist2XML.java:48)
89+
at oracle.dbtools.app.Persist2XML.read(Persist2XML.java:95)
90+
at <js>.configure(<eval>:104)
91+
at <js>.getConfiguredFormatter(<eval>:161)
92+
at <js>.run(<eval>:727)
93+
at <js>.:program(<eval>:803)
94+
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:399)
95+
at org.graalvm.js.scriptengine/com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:478)
96+
at org.graalvm.js.scriptengine/com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:420)
97+
at com.trivadis.plsql.formatter.TvdFormat.run(TvdFormat.java:36)
98+
at com.trivadis.plsql.formatter.TvdFormat.main(TvdFormat.java:49)
99+
```
100+
101+
This is really sad. However, there is nothing we can do.
102+
We have to wait until the SQL Developer team decides to provide a parser that does not require AWT/Swing components (as in previous versions)
103+
or until the GraalVM team provides a native-image build process that works on all platforms with AWT/Swing.
104+
See also [macOS: no awt in java.library.path](https://github.com/oracle/graal/issues/4124).
105+
52106
## How to Build
53107

54-
1. [Download](https://www.oracle.com/tools/downloads/sqlcl-downloads.html) and install SQLcl 22.4.0
108+
1. [Download](https://www.oracle.com/tools/downloads/sqlcl-downloads.html) and install SQLcl 23.1.0
55109
2. [Download](https://github.com/graalvm/graalvm-ce-builds/releases) and install the GraalVM JDK 17 22.3.1
56110
3. Go to the `bin` directory of the GraalVM JDK and run `./gu install js native-image visualvm`. For native image on Windows you need to [download](https://visualstudio.microsoft.com/downloads/) Visual Studio Community 2022 and install the C++ compiler. Use `x64 Native Tools Command Prompt for VS 2022` to get a terminal window with the correct environment.
57111
4. [Download](https://maven.apache.org/download.cgi) and install Apache Maven 3.9.1

0 commit comments

Comments
 (0)