Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Commit ecd6a5a

Browse files
On linux, statically link all libraries including GLIBC
Currently, GLIBC must not only be installed on the host, but has to be compatible with the version the image was built with. Static linking avoids both of these issues at the cost of a slightly larger image size.
1 parent a82d2d5 commit ecd6a5a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

build-scripts/graal.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ const NATIVE_IMAGE_BUILD_ARGS = [
5757
];
5858

5959
const spawnOpts = {};
60-
if (process.platform === 'win32') {
61-
spawnOpts.shell = true;
60+
switch (process.platform) {
61+
case 'win32':
62+
spawnOpts.shell = true;
63+
break;
64+
case 'linux':
65+
// On linux, statically link all libraries. Allows usage on systems
66+
// which are missing or have incompatible versions of GLIBC
67+
NATIVE_IMAGE_BUILD_ARGS.unshift('--static');
68+
break;
6269
}
6370

6471
runCommand(`native-image${process.platform === 'win32' ? '.cmd' : ''}`, NATIVE_IMAGE_BUILD_ARGS, spawnOpts)

0 commit comments

Comments
 (0)