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

Commit eb66ade

Browse files
update README, native image works again with libs from SQLcl 23.4.0, use JDK 21.0.2
1 parent 95d10ad commit eb66ade

1 file changed

Lines changed: 3 additions & 59 deletions

File tree

standalone/README.md

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -49,67 +49,11 @@ 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-
(based on SQLcl 23.3.0 on macOS 14.1.2 with an M-series chip):
61-
62-
```
63-
Exception in thread "main" javax.script.ScriptException: java.lang.Exception: java.lang.UnsatisfiedLinkError: no awt in java.library.path
64-
at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:136)
65-
at java.base@17.0.9/java.lang.ClassLoader.loadLibrary(ClassLoader.java:50)
66-
at java.base@17.0.9/java.lang.Runtime.loadLibrary0(Runtime.java:818)
67-
at java.base@17.0.9/java.lang.System.loadLibrary(System.java:1989)
68-
at java.desktop@17.0.9/java.awt.Toolkit$2.run(Toolkit.java:1388)
69-
at java.desktop@17.0.9/java.awt.Toolkit$2.run(Toolkit.java:1386)
70-
at java.base@17.0.9/java.security.AccessController.executePrivileged(AccessController.java:171)
71-
at java.base@17.0.9/java.security.AccessController.doPrivileged(AccessController.java:318)
72-
at java.desktop@17.0.9/java.awt.Toolkit.loadLibraries(Toolkit.java:1385)
73-
at java.desktop@17.0.9/java.awt.Toolkit.initStatic(Toolkit.java:1423)
74-
at java.desktop@17.0.9/java.awt.Toolkit.<clinit>(Toolkit.java:1397)
75-
at java.desktop@17.0.9/java.awt.Component.<clinit>(Component.java:624)
76-
at java.base@17.0.9/java.lang.Class.ensureInitialized(DynamicHub.java:579)
77-
at java.base@17.0.9/java.lang.Class.ensureInitialized(DynamicHub.java:579)
78-
at java.base@17.0.9/java.lang.Class.ensureInitialized(DynamicHub.java:579)
79-
at java.base@17.0.9/java.lang.Class.ensureInitialized(DynamicHub.java:579)
80-
at java.base@17.0.9/java.lang.Class.ensureInitialized(DynamicHub.java:579)
81-
at oracle.dbtools.parser.Visual.<init>(Visual.java:404)
82-
at oracle.dbtools.parser.Grammar.parseGrammarFile(Grammar.java:172)
83-
at oracle.dbtools.parser.Grammar.parseGrammarFile(Grammar.java:152)
84-
at oracle.dbtools.arbori.Program.getRules(Program.java:285)
85-
at oracle.dbtools.arbori.Program.getArboriParser(Program.java:194)
86-
at oracle.dbtools.arbori.Program.compile(Program.java:338)
87-
at oracle.dbtools.arbori.Program.compile(Program.java:327)
88-
at oracle.dbtools.arbori.SqlProgram.<init>(SqlProgram.java:32)
89-
at oracle.dbtools.app.Format$3.<init>(Format.java:343)
90-
at oracle.dbtools.app.Format.format(Format.java:343)
91-
at <js>.formatInSandbox(<eval>:168)
92-
at <js>.formatFile(<eval>:670)
93-
at <js>.formatFiles(<eval>:683)
94-
at <js>.run(<eval>:737)
95-
at <js>.:program(<eval>:803)
96-
at org.graalvm.sdk/org.graalvm.polyglot.Context.eval(Context.java:403)
97-
at org.graalvm.js.scriptengine/com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:485)
98-
at org.graalvm.js.scriptengine/com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:427)
99-
at com.trivadis.plsql.formatter.TvdFormat.run(TvdFormat.java:36)
100-
at com.trivadis.plsql.formatter.TvdFormat.main(TvdFormat.java:49)
101-
```
102-
103-
This is really sad. However, there is nothing we can do.
104-
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)
105-
or until the GraalVM team provides a native-image build process that works on all platforms with AWT/Swing.
106-
See also [macOS: no awt in java.library.path](https://github.com/oracle/graal/issues/4124).
107-
10852
## How to Build
10953

110-
1. [Download](https://www.oracle.com/tools/downloads/sqlcl-downloads.html) and install SQLcl 23.3.0
111-
2. [Download](https://github.com/graalvm/graalvm-ce-builds/releases/tag/jdk-17.0.9) and install the GraalVM JDK 17.0.9
112-
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.
54+
1. [Download](https://www.oracle.com/tools/downloads/sqlcl-downloads.html) and install SQLcl 23.4.0
55+
2. [Download](https://github.com/graalvm/graalvm-ce-builds/releases/tag/jdk-17.0.9) and install the GraalVM JDK 21.0.2
56+
3. 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.
11357
4. [Download](https://maven.apache.org/download.cgi) and install Apache Maven 3.9.6
11458
5. [Download](https://git-scm.com/downloads) and install a git command line client
11559
6. Clone the plsql-formatter-settings repository. The repository uses symbolic links. On Windows you have to use `git clone -c core.symlinks=true https://github.com/Trivadis/plsql-formatter-settings.git` as Administrator to make it work. See also [Symbolic Links in Windows](https://github.com/git-for-windows/git/wiki/Symbolic-Links) for more information.

0 commit comments

Comments
 (0)