linghengqian commented on issue #21347:
URL: 
https://github.com/apache/shardingsphere/issues/21347#issuecomment-1374455582

   @zhfeng 
   - You of course need to configure GraalVM's toolchain locally, and `mvn 
clean install -Pnative` doesn't make sense since I only defined the `package` 
task. What you need to do in `Linux` is somewhat similar to what I pointed out 
at 
https://shardingsphere.apache.org/document/5.3.0/en/user-manual/shardingsphere-proxy/startup/graalvm-native-image/
 .
   ```shell
   sudo apt install unzip zip curl sed -y
   curl -s "https://get.sdkman.io"; | bash
   source "$HOME/.sdkman/bin/sdkman-init.sh"
   sdk install java 22.3.r17-grl
   sdk use java 22.3.r17-grl
   gu install native-image
   sudo apt-get install build-essential libz-dev zlib1g-dev -y
   
   git clone [email protected]:apache/shardingsphere.git
   cd ./shardingsphere/
   ./mvnw -am -pl distribution/proxy-native -B -Pnative -DskipTests 
-Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true 
-Drat.skip=true clean package
   ```
   - I need to point out that the generated product is not available, because I 
was blocked by a series of issues I mentioned above, I first need to expose the 
SPI of ShardingSphere ActualDataNodes. The reason for the successful build is 
that I set the `--report-unsupported-elements-at-runtime` build args.
   
   - `nativeTest` in `maven-plugin` of `graalvm native build tools` is not 
actually available, need to wait for 
https://github.com/graalvm/native-build-tools/issues/260 to close. So I 
actually test the graalvm reachability metadata generated by shardingsphere at 
https://github.com/linghengqian/graalvm-trace-metadata-smoketest because 
`gradle-plugin` has agent mode.
   ```shell
   sdk install java 22.3.r17-grl
   sdk use java 22.3.r17-grl
   gu install native-image
   sudo apt-get install build-essential libz-dev zlib1g-dev -y
   
   git clone [email protected]:linghengqian/graalvm-trace-metadata-smoketest.git
   cd ./graalvm-trace-metadata-smoketest/shardingsphere-jdbc-core
   ./gradlew -Pagent clean test
   ./gradlew metadataCopy --task test
   ./gradlew clean nativeTest
   ```
   - This way, you can see why I need to avoid the use of GroovyShell for 
ShardingSphere ActualDataNodes. Refer to 
https://github.com/oracle/graal/issues/5522 and internal discussion in the 
Groovy and GraalVM Slack group.
   - By the way, ShardingSphere's CI actually uses GraalVM 23.0 Dev, because 
there are some bugs in GraalVM CE 22.3, if you want to explore, you can pay 
attention to the historical PR at 
https://github.com/oracle/graalvm-reachability-metadata.
   - Make sure your build machine has enough memory, at least **10GB** of build 
memory.
   - 
![image](https://user-images.githubusercontent.com/20187731/211149342-664ddacf-8615-41cb-bb06-da4d5c2a0fb1.png)
   - 
![image](https://user-images.githubusercontent.com/20187731/211149376-31acbfc7-f5a9-43b4-818d-a98bb81a24c3.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to