Giter Club home page Giter Club logo

Comments (18)

ayltai avatar ayltai commented on August 30, 2024 2

I tried installing GraalVM and native-image on the system, but not using this plugin. Change the working directory to <project root/build/native, run native-image ...(arguments) by copying and pasting the command using ./gradlew --debug buildNativeImage), it will work.

So the problem is related to the locally cached copy of GraalVM and native-image.

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024 1

There are a few similar issues reported:
https://github.com/oracle/graal/issues?q=is%3Aissue+Unable+to+compile+C-ABI+query+code

The causes seem to be related to the OS setup or Java version. To troubleshoot, I would suggest either:

  1. Create a GitHub Action and build your project on a macOS image to isolate OS setup issue; or
  2. Share a minimal project that reproduces this error and I can run it on my mac. If there is no error, I can share information like my Java version that compiles successfully.

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024

I'm not sure what caused this error, but it says "Make sure native software development toolchain is installed on your system". So are you sure you have the native toolchain installed?
Reference: https://www.graalvm.org/reference-manual/native-image/
xcode-select --install

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

Yes, this is installed
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024

Did you make any progress?

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

Not really, I pretty sure that it is something wrong with my station...
Could you please try ./gradlew buildNativeImage from https://github.com/artemptushkin/spring-boot-native-scale-zero ?

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

I tried to wipe some legacy Java version, check all the dependent libraries, and soft on my station - no result. I started debugging this, but same - can't see the file that exists

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024

I got the same error executing your project with ./gradlew buildNativeImage, so I think it is not related to the system configurations. I'll take a deeper look.

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024

Found this: oracle/graal#2845
Could be a bug in JDK that is fixed in JDK 14/15 but not 11.

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

I've been trying with 8.

I think I skipped that ticket as there a different error...
Thanks - waiting for the bug fix I think.

from spring-graalvm-native-plugin.

codexetreme avatar codexetreme commented on August 30, 2024

I've been having the exact same error, although, my investigations I think are a bit different,

I have the tool chain installed, cause when I do

gcc --version
I get,

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

so as you see the installed dir is /Library/Developer/CommandLineTools/usr/bin

however as @artemptushkin's log shows (which exactly similar to mine, except we are trying to compile an internal source), it is looking for the files in /usr/bin/cc,

is this path mismatch a possible solution? I am not 100% convinced this is the root cause of the issue, but I felt like pointing it out :)

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

@codexetreme what have you changed? mine gcc --version gives the same result, the same directory, but the error perists

from spring-graalvm-native-plugin.

codexetreme avatar codexetreme commented on August 30, 2024

I dowloaded, GraalVM from GitHub, 20.3.0, installed native-image on that , and compiled against that, it works ,

./native-image -cp picocli-4.5.2.jar --static -jar ~/mycode/build/ouptuts/cli-0.2.0-beta.0.0+20201207T212423Z.jar cli

this gets me a binary that I can run and execute

EDIT: yes, I am using this for picocli, so I am not sure if this gradle plugin correctly configured, but I highly doubt that to be the case

from spring-graalvm-native-plugin.

ayltai avatar ayltai commented on August 30, 2024

Thanks @codexetreme for building without this plugin so it does seem this is an issue with the command options generated by this plugin.

from spring-graalvm-native-plugin.

codexetreme avatar codexetreme commented on August 30, 2024

Could be the options issue? can you perhaps add an option to show what are the options generated, or something that gives better debug information? I tried the standard --info and --stacktrace but they aren't much help

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

should not, I see that Graalvm provides its own version of CC by the way
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home/languages/llvm/native/bin

ar                     graalvm-native-clang++ llvm-readelf
c++                    graalvm-native-ld      llvm-readobj
cc                     ld                     llvm-strip
clang                  ld.lld                 nm
clang++                ld64                   objcopy
g++                    lld                    objdump
gcc                    llvm-ar                ranlib
graalvm-clang          llvm-nm                readelf
graalvm-clang++        llvm-objcopy           readobj
graalvm-native-binutil llvm-objdump           strip
graalvm-native-clang   llvm-ranlib

but the running command use cc from the machine

from spring-graalvm-native-plugin.

artemptushkin avatar artemptushkin commented on August 30, 2024

I add maven setup to my https://github.com/artemptushkin/spring-boot-native-scale-zero/tree/master
by the samples: from spring-graalvm-native and is working with ./mvnw -Pnative clean package

Logs are different.
Part without JARs:
Gradle:

 Command: /Users/artemptushkin/JavaProjects/spint-boot-native-scale-zero/build/tmp/buildNativeImage/graalvm-ce-java11-20.3.0/Contents/Home/bin/native-image --allow-incomplete-classpath --report-unsupported-elements-at-runtime --no-fallback --no-server --install-exit-handlers -H:+ReportExceptionStackTraces -H:-CheckToolchain -Dspring.native.remove-unused-autoconfig=true -Dspring.native.remove-yaml-support=true -Dspring.native.remove-xml-support=false -Dspring.native.remove-spel-support=false -Dspring.native.remove-jmx-support=false -Dspring.native.verify=false -Dspring.native.verbose=false -Dspring.native.mode=reflection -J-Xmx4G -H:Name=spring-boot-native-scale-zero

Maven:

 -Dspring.native.remove-yaml-support=true -Dspring.spel.ignore=true -H:Class=io.github.artemptushkin.springbootnativescalezero.SpringBootNativeScaleZeroApplication -H:Name=commandlinerunner

Maven calls directly from my JAVA_HOME:
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home/bin/native-image -cp
and Gradle copies this into build dir

it would be rational to check all the props from the Gradle run in Maven project but it is so slow, I checked these:
-Dspring.native.mode=reflection -H:+ReportExceptionStackTraces -H:-CheckToolchain and it is okay

from spring-graalvm-native-plugin.

matus-gazo avatar matus-gazo commented on August 30, 2024

I tried installing GraalVM and native-image on the system, but not using this plugin. Change the working directory to <project root/build/native, run native-image ...(arguments) by copying and pasting the command using ./gradlew --debug buildNativeImage), it will work.

So the problem is related to the locally cached copy of GraalVM and native-image.

Or even easier, I installed GraalvM via Brew (also to PATH and JAVA_HOME) and added
nativeImage {
download = 'skip'
...
}

It builds fine now...

from spring-graalvm-native-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.