On Wed, 2 Apr 2025 14:54:35 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

> In the static JDK image, a single humongous java executable is generated, and 
> no other launcher, such as javac. This makes it impossible to run our jtreg 
> tests, which assume these are present.
> 
> The solution is fortunately simply: we just need to add a bunch of trivial 
> launchers, which are thin wrappers that execute the main java binary, with 
> the proper arguments. This will result in the same behavior as the normal 
> dynamic launchers, only that we will need to take the detour of launching 
> another process instead of calling directly into the JLI library.

The way I see it is that we need to be able to produce a generic static JDK 
image, to be able to test it and keep it from bit-rotting. In actual practice, 
though, a static JDK is of limited (or rather no) use by itself, and the static 
build will only serve to produce component that are consumed by downstream 
setups, where these static libraries are incorporated more tightly into a 
product. 

So while we continue to hammer out how to improve this, I think it is important 
to be able to test static builds in mainline, or they will break. I think we 
are going to have to keep these relaunchers around for as long as we want to 
test the static build, even if no downstream consumer really cares. If that is 
going to be kept in the "static-jdk" image, or in another deliverable, I can't 
say. Possibly the entire "static-jdk" will go away when we are done with proper 
jlink/jmod integration, or maybe not. For now, I think this works fine.

There were a lot of tricky details to get right in this one. I think I nailed 
it now. I have done manual adhoc testing of running
`build/images/static-jdk/bin/java -XshowSettings -version` to make sure I did 
not break anything. (I did discover that the Windows launcher did not work 
since it was missing runtime libs; I guess I copied them manually before and 
then forgot about it.)

I then run `build/images/static-jdk/bin/jar -J-XshowSettings --help`. I 
initially forgot about passing arguments to the underlying java launcher using 
the `-J` prefix; it took some fiddling to get that right. 

I've tested this on linux, macos and windows.

I am also currently running the complete set of build tests on Oracle's CI 
("builds-infra") + tier1 testing.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24380#issuecomment-2775969348
PR Comment: https://git.openjdk.org/jdk/pull/24380#issuecomment-3013561037

Reply via email to