Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build native app on macOS without error at kotlin.coroutines.intrinsics.CoroutineSingletons #10771

Open
kurb70 opened this issue Apr 27, 2024 · 1 comment

Comments

@kurb70
Copy link

kurb70 commented Apr 27, 2024

Expected Behavior

Should build macOS native app without initializing during image building.

Actual Behaviour

I got an error: Classes that should be initialized at run time got initialized during image building: kotlin.coroutines.intrinsics.CoroutineSingletons …

09:40:13: Executing 'nativeBuild'...

Starting Gradle Daemon...
Gradle Daemon started in 686 ms
> Task :generateJte UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :compileGroovy NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :generateResourcesConfigFile UP-TO-DATE

> Task :nativeCompile
[native-image-plugin] GraalVM Toolchain detection is disabled
[native-image-plugin] GraalVM location read from environment variable: JAVA_HOME
[native-image-plugin] Native Image executable path: /Users/kuba/.sdkman/candidates/java/21.0.2-graalce/lib/svm/bin/native-image
========================================================================================================================
GraalVM Native Image: Generating 'demo' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (7,9s @ 0,27GB)
 Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
 Graal compiler: optimization level: 2, target machine: armv8-a
 C compiler: cc (apple, arm64, 15.0.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 2 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.micronaut.core.io.service.ServiceLoaderFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 12,09GB of memory (75,6% of 16,00GB system memory, determined at start)
 - 8 thread(s) (100,0% of 8 available processor(s), determined at start)
[2/8] Performing analysis...  [*]                                                                       (73,3s @ 3,69GB)
   36 844 reachable types   (92,9% of   39 648 total)
   59 769 reachable fields  (69,2% of   86 405 total)
  209 421 reachable methods (67,7% of  309 275 total)
   11 157 types,   540 fields, and 7 527 methods registered for reflection
        1 native library: -framework CoreServices

------------------------------------------------------------------------------------------------------------------------
                       33,0s (40,3% of total time) in 93 GCs | Peak RSS: 5,28GB | CPU load: 5,57
========================================================================================================================
Finished generating 'demo' in 1m 21s.
Error: Classes that should be initialized at run time got initialized during image building:
 kotlin.coroutines.intrinsics.CoroutineSingletons was unintentionally initialized at build time. To see why kotlin.coroutines.intrinsics.CoroutineSingletons got initialized use --trace-class-initialization=kotlin.coroutines.intrinsics.CoroutineSingletons
To see how the classes got initialized, use --trace-class-initialization=kotlin.coroutines.intrinsics.CoroutineSingletons

> Task :nativeCompile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nativeCompile'.
> Process 'command '/Users/kuba/.sdkman/candidates/java/current/bin/native-image'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1m 26s
6 actionable tasks: 1 executed, 5 up-to-date
09:41:40: Execution finished 'nativeBuild'.

Steps To Reproduce

I created an micronaut 4.4.1 app with

applicationType: default
defaultPackage: com.a0d.care
testFramework: spock
sourceLanguage: java
buildTool: gradle
features: [ app-name, graalvm, gradle, http-client-test, java, java-application, logback, micronaut-aot, micronaut-build, micronaut-http-validation, netty-server, properties, readme, serialization-jackson, shade, spock, static-resources, views-jte ]

and immediately tried to build a native app.

Environment Information

  • macOS 14.4.1 (Apple M1)
  • Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1

Example Application

No response

Version

4.4.1

@sdelamo
Copy link
Collaborator

sdelamo commented Apr 29, 2024

@msupic could you look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants