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

JavaFX static SDK 21 linker command failed on macOS 13.6 (22G120) Apple Silicon #491

Open
cavoirom opened this issue Oct 5, 2023 · 3 comments

Comments

@cavoirom
Copy link

cavoirom commented Oct 5, 2023

I'm facing this error when building native image on macOS 13.6 (Apple Silicon)

[Thu Oct 05 23:35:25 ICT 2023][FINE] Start process link...
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: no platform load command found in '<redacted>/target/gluonfx/aarch64-darwin/gvm/tmp/SVM-1696523641365/com.cavoirom.quick_api.quickapi.o', assuming: macOS
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: object file (<redacted>/graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final/Contents/Home/lib/svm/clibraries/darwin-aarch64/libjvm.a[2](JvmFuncs.o)) was built for newer 'macOS' version (12.0) than being linked (11.0)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: object file (<redacted>/graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final/Contents/Home/lib/svm/clibraries/darwin-aarch64/libjvm.a[3](JvmFuncsFallbacks.o)) was built for newer 'macOS' version (12.0) than being linked (11.0)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: object file (<redacted>/graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final/Contents/Home/lib/svm/clibraries/darwin-aarch64/liblibchelper.a[4](cpuid.o)) was built for newer 'macOS' version (12.0) than being linked (11.0)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: object file (<redacted>/graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final/Contents/Home/lib/svm/clibraries/darwin-aarch64/liblibchelper.a[5](timeZone.o)) was built for newer 'macOS' version (12.0) than being linked (11.0)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: warning: object file (<redacted>/graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final/Contents/Home/lib/svm/clibraries/darwin-aarch64/libdarwin.a[2](foundation.o)) was built for newer 'macOS' version (12.0) than being linked (11.0)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] ld: Undefined symbols:
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]   _LMGetKbdType, referenced from:
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]       _getJavaCodeForMacKeyAndModifiers in libglass.a[14](GlassKey.obj)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]   _TISCopyCurrentKeyboardLayoutInputSource, referenced from:
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]       _getJavaCodeForMacKey in libglass.a[14](GlassKey.obj)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]   _TISGetInputSourceProperty, referenced from:
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]       _getJavaCodeForMacKeyAndModifiers in libglass.a[14](GlassKey.obj)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]   _kTISPropertyUnicodeKeyLayoutData, referenced from:
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB]       _getJavaCodeForMacKeyAndModifiers in libglass.a[14](GlassKey.obj)
[Thu Oct 05 23:35:25 ICT 2023][INFO] [SUB] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Thu Oct 05 23:35:25 ICT 2023][FINE] Result for link: 1
[Thu Oct 05 23:35:25 ICT 2023][SEVERE] Process link failed with result: 1

My settings

  • gluonfx-maven-plugin.version: 1.0.21
  • javaStaticSdkVersion: 21
  • javafxStaticSdkVersion: 21
  • javafx.version: 21

Build with GraalVM on: https://github.com/gluonhq/graal/releases

If I change the javafxStaticSdkVersion to 21-ea+9.1, the build will success.

Expected behavior: native image will be build successfully.

@jperedadnr
Copy link
Contributor

Those symbols come from the PR that added this commit, that was merged right before JavaFX 21 GA.

I'm running on macOS 13.4.1, and I can link just fine. I wonder what could have changed in 13.6.

Can you run and post the result of

nm target/gluonfx/aarch64-darwin/gvm/tmp/SVM-***/com.gluonhq.hello.hellogluon.o | grep _LMGetKbdType

@cavoirom
Copy link
Author

cavoirom commented Oct 7, 2023

Instead of running against hellogluon I ran the above command on my binary:

nm target/gluonfx/aarch64-darwin/gvm/tmp/SVM-1696523641365/***ickapi.o | grep _LMGetKbdType

No output.

There are nothing special in the dependencies:

    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>${javafx.version}</version>
    </dependency>
    <dependency>
      <groupId>io.reactivex.rxjava3</groupId>
      <artifactId>rxjava</artifactId>
      <version>${rxjava.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents.core5</groupId>
      <artifactId>httpcore5</artifactId>
      <version>${httpcore5.version}</version>
    </dependency>

@cavoirom
Copy link
Author

For those who is facing the same issue. Here is what I found on StackOverflow: https://stackoverflow.com/q/77512693

Summary: We need to link Carbon.

Here is my configuration in the gluonfx-maven-plugin.

<configuration>
  ...
  <linkerArgs>
    <!-- Workaround linker command failed on macOS Sonoma, details: https://stackoverflow.com/q/77512693 -->
    <linkerArg>-Wl</linkerArg>
    <linkerArg>-framework</linkerArg>
    <linkerArg>Carbon</linkerArg>
  </linkerArgs>
  ...
</configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants