Skip to content

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Oct 2, 2025

Closes #14036

Pull Request Description

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@Akirathan Akirathan self-assigned this Oct 2, 2025
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Oct 2, 2025
@Akirathan
Copy link
Member Author

First attempt to build NI: bazel build :sbt_build_native_engine_distribution fails with:

Error: Default native-compiler executable 'cc' not found via environment variable PATH
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain

@Akirathan
Copy link
Member Author

Akirathan commented Oct 3, 2025

Which subprocesses does native-image invoke?

Let's find that out with the help of Java Flight Recorder (JFR). First, generate auxiliary native-image-args.txt by running

env ENSO_LAUNCHER=native,-ls,fast sbt engine-runner/rebuildNativeImage

Note that it is OK to kill the process right after few seconds, we are only interested in the arguments file.

The run:

native-image -J-XX:+FlightRecorder -J-XX:StartFlightRecording=filename=flight.jfr,settings=/Users/pavel/tmp/io-profile.jfc @engine/runner/target/native-image-args.txt

where io-profile.jfc is uploaded at io-profile.jfc.zip.

Then:

jfr print --events jdk.ProcessStart ./flight.jfr

The output is:

JFR output
jdk.ProcessStart {
  startTime = 16:49:54.631 (2025-10-03)
  pid = 32897
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -v"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.getCCompilerInfo() line: 403
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.<init>(Path) line: 75
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker$DarwinCCompilerInvoker.<init>(Path) line: 290
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.create(Path) line: 87
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(String, OptionValues, Map, JavaMainWrapper$JavaMainSupport, SubstitutionProcessor, DebugContext) line: 1049
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:54.822 (2025-10-03)
  pid = 32899
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixJVM_Direct /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixJVM_Direct.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:54.865 (2025-10-03)
  pid = 32902
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixJVM_Direct"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:54.879 (2025-10-03)
  pid = 32903
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -ObjC -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.050 (2025-10-03)
  pid = 32906
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.056 (2025-10-03)
  pid = 32907
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/MacTrashBin_CoreServices /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/MacTrashBin_CoreServices.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.160 (2025-10-03)
  pid = 32910
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/MacTrashBin_CoreServices"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.163 (2025-10-03)
  pid = 32911
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/LibMDependencies /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/LibMDependencies.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.199 (2025-10-03)
  pid = 32914
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/LibMDependencies"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.205 (2025-10-03)
  pid = 32915
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AMD64LibCHelperDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AMD64LibCHelperDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.250 (2025-10-03)
  pid = 32918
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AMD64LibCHelperDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.260 (2025-10-03)
  pid = 32919
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -I /Users/pavel/.sdkman/candidates/java/24.0.1-graal/include -I /Users/pavel/.sdkman/candidates/java/24.0.1-graal/include/darwin -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.304 (2025-10-03)
  pid = 32922
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.308 (2025-10-03)
  pid = 32923
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -I/Users/pavel/.sdkman/candidates/java/24.0.1-graal/include/darwin -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectivesJDKLatest /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectivesJDKLatest.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.346 (2025-10-03)
  pid = 32926
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectivesJDKLatest"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.358 (2025-10-03)
  pid = 32927
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/BuiltinDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/BuiltinDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.398 (2025-10-03)
  pid = 32930
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/BuiltinDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.410 (2025-10-03)
  pid = 32931
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -I/Users/pavel/.sdkman/candidates/java/24.0.1-graal/include/darwin -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.466 (2025-10-03)
  pid = 32934
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/JNIHeaderDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.471 (2025-10-03)
  pid = 32935
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AArch64LibCHelperDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AArch64LibCHelperDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.511 (2025-10-03)
  pid = 32938
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/AArch64LibCHelperDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.513 (2025-10-03)
  pid = 32939
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixWorkingDirectory_Directives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixWorkingDirectory_Directives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.551 (2025-10-03)
  pid = 32942
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/PosixWorkingDirectory_Directives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.554 (2025-10-03)
  pid = 32943
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wall -Werror -Wno-tautological-compare -o /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/RISCV64LibCHelperDirectives /var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/RISCV64LibCHelperDirectives.c"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.codegen.CCompilerInvoker.compileAndParseError(boolean, List, Path, Path, CCompilerInvoker$CompilerErrorHandler) line: 484
    com.oracle.svm.hosted.c.CAnnotationProcessor.compileQueryCode(Path) line: 167
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 111
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:49:55.590 (2025-10-03)
  pid = 32946
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/RISCV64LibCHelperDirectives"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.c.CAnnotationProcessor.makeQuery(CAnnotationProcessorCache, String) line: 132
    com.oracle.svm.hosted.c.CAnnotationProcessor.process(CAnnotationProcessorCache) line: 117
    com.oracle.svm.hosted.c.NativeLibraries.finish() line: 571
    com.oracle.svm.hosted.NativeImageGenerator.processNativeLibraryImports(NativeLibraries, ClassInitializationSupport) line: 1783
    com.oracle.svm.hosted.NativeImageGenerator.setupNativeLibraries(HostedProviders, CEnumCallWrapperSubstitutionProcessor, ClassInitializationSupport, DebugContext) line: 1313
    ...
  ]
}

jdk.ProcessStart {
  startTime = 16:50:53.435 (2025-10-03)
  pid = 32970
  directory = "/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406"
  command = "/usr/bin/cc -Wl,-U,___darwin_check_fd_set_overflow -Wl,-no_compact_unwind -Wl,-exported_symbols_list -Wl,/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406/exported_symbols.list -Wl,-x -arch arm64 -o /Users/pavel/dev/enso/built-distribution/enso-engine-0.0.0-dev-macos-aarch64/enso-0.0.0-dev/bin/enso enso.o /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/clibraries/darwin-aarch64/liblibchelper.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libnet.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/clibraries/darwin-aarch64/libdarwin.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libextnet.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libnio.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libmanagement_ext.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libjava.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64/libzip.a /Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/clibraries/darwin-aarch64/libjvm.a -v -L/var/folders/bl/dj8f8x456nq6fvjlxz5tb_6c0000gn/T/SVM-8171376717939253406 -L/Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/static/darwin-aarch64 -L/Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/clibraries/darwin-aarch64 -L/Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/clibraries -L/Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/svm/macros/truffle-svm/builder -L/Users/pavel/.sdkman/candidates/java/24.0.1-graal/lib/server -Wl,-framework,CoreServices -lm -lc -Wl,-framework,CoreServices -ldl -lpthread -Wl,-framework,Foundation -lz"
  eventThread = "main" (javaThreadId = 3)
  stackTrace = [
    com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(String, LinkerInvocation, List, AbstractImage$NativeImageKind) line: 138
    com.oracle.svm.hosted.image.NativeImageViaCC.write(DebugContext, Path, Path, String, FeatureImpl$BeforeImageWriteAccessImpl) line: 115
    com.oracle.svm.hosted.NativeImageGenerator.doRun(Map, JavaMainWrapper$JavaMainSupport, String, AbstractImage$NativeImageKind, SubstitutionProcessor) line: 750
    com.oracle.svm.hosted.NativeImageGenerator.run(Map, JavaMainWrapper$JavaMainSupport, String, AbstractImage$NativeImageKind, SubstitutionProcessor, EconomicSet, TimerCollection) line: 533
    com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(ImageClassLoader) line: 545
    ...
  ]
}

TL;DR;

native-image invokes 24 subprocesses. As far as I can tell this is cc invocation to compile some auxiliary C sources to infer some capabilities, and then invoking those compiled executables. In this respect, native-image works like autoconf.

@vitvakatu do you think we can make this work from Bazel somehow?

EDIT (Answer)

@vitvakatu thinks it should be OK as far as:

@Akirathan
Copy link
Member Author

@vitvakatu bazel expert needed. I am trying to provide cc compiler in

cc_toolchain = ctx.toolchains["@bazel_tools//tools/cpp:toolchain_type"]
cc_path = cc_toolchain.cc.compiler_executable
. In my case cc_path is evaluated to external/rules_cc++cc_configure_extension+local_config_cc/cc_wrapper.sh. But this file does not exist: the command bazel build :sbt_build_native_engine_distribution is failing with:

Error: --native-compiler-path=/private/var/tmp/_bazel_pavel/737dedbf20ec237592160d5e174461b8/sandbox/darwin-sandbox/2/execroot/_main/external/rules_cc++cc_configure_extension+local_config_cc/cc_wrapper.sh does not specify a path to an executable.
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain

Any ideas how to convince Bazel to provide this external/../cc_wrapper.sh for the run_sbt rule?

@vitvakatu
Copy link
Contributor

vitvakatu commented Oct 13, 2025

It seems you need to specify compiler files as input for the rule. See how it is done in rules_graalvm:

https://github.com/sgammon/rules_graalvm/blob/81fc9b2de33c0429b716f1bfcd3223a82c0e1085/internal/native_image/rules.bzl#L122

https://github.com/sgammon/rules_graalvm/blob/81fc9b2de33c0429b716f1bfcd3223a82c0e1085/internal/native_image/toolchain.bzl#L41

GitHub
Build GraalVM native binaries with Bazel. Contribute to sgammon/rules_graalvm development by creating an account on GitHub.
GitHub
Build GraalVM native binaries with Bazel. Contribute to sgammon/rules_graalvm development by creating an account on GitHub.

@Akirathan
Copy link
Member Author

On 59aa5f5:

  • bazel build :sbt_build_native_engine_distribution builds the native image into bazel-bin/built-distribution-native directory.
  • bazel run run_enso_test runs sanity check by looking for the enso executable inside built-distribution-native and invoking it with --run test/Base_Tests/src/Data/Maybe_Spec.enso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: No changelog needed Do not require a changelog entry for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build enso native image in Bazel

2 participants