graalvm / fastr-examples Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
The README for r_java_embedding states to read the README for the GraalVM examples. Try this:
cd /tmp
bash <(curl -sL https://get.graalvm.org/jdk)
This suggests running the following commands:
$ export GRAALVM_HOME="/tmp/graalvm-ce-java17-22.3.0"
$ export PATH="/tmp/graalvm-ce-java17-22.3.0/bin:$PATH"
$ export JAVA_HOME="/tmp/graalvm-ce-java17-22.3.0"
There are three issues:
$
"prompt" is superfluous, prefer indenting the output instead, to make it copy/pasteable without having to delete the $
signs.PATH
environment for third-party programs should never supersede the system PATH
(i.e., /usr/bin and /bin and /usr/local/bin and $HOME/bin), it's a security hole and could break existing shell scripts. Prefer flipping to use export PATH="$PATH:/tmp/graalvm-ce-java17-22.3.0/bin"
.GRAALVM_HOME
isn't used by the build script.On the last point, continue as follows:
git clone https://github.com/graalvm/examples.git
cd examples/r_java_embedding/
./build.sh
Expected
The examples build.
Actual
The examples don't build and an error is shown:
./build.sh: line 21: GRAALVM_DIR: GRAALVM_DIR must point to a GraalVM image
Details
Consider updating build.sh in the examples to refer to GRAALVM_HOME
. If backwards-compatibility is required, then consider checking both and using GRAALVM_DIR
instead, if set.
I ran the following:
export GRAALVM_DIR="${GRAALVM_HOME}"
./build.sh
The compile succeeded.
Example: examples/weather_predictor/
Graal VM version: 0.31
OS: RHEL7 docker image with gcc installed
Issue:
The code in weatherServer.js does not include weatherInit.rb file and due to which openweather api is never getting called. If I add the weatherInit.rb file to weatherServer.js file, I get error asking for installtion of llvm and libc++abi file.
This is how I imported the weatherInit.rb in weatherServer.js file
// Load the Ruby module
console.log("Initializing Openweather");
var weatherInitScript = fs.readFileSync("weatherInit.rb", "utf8");
Interop.eval("application/x-ruby", weatherInitScript);
weatherInit.rb
require 'openweather2'
Openweather2.configure do |config|
# This is the endpoint and API key from the tests in the Openweather2 gem
config.endpoint = 'http://api.openweathermap.org/data/2.5/weather'
config.apikey = '7295c67949009c1bee1902192a08ccf1'
end
def tempInCity(name)
weather = Openweather2.get_weather(city: Truffle::Interop.from_java_string(name), units: 'metric')
weather.temperature;
end
Truffle::Interop.export('tempInCity', method(:tempInCity))
Error Trace:
Initializing Openweather
--
| com.oracle.truffle.llvm.runtime.LLVMContext$ExternalLibrary@a86168cc not found!
| libc++abi.so.1: cannot open shared object file: No such file or directory
| org.truffleruby.language.control.RaiseException: you may need to install LLVM and libc++abi - see doc/user/installing-llvm.md (libc++abi.so.1: cannot open shared object file: No such file or directory) (RuntimeError)
| unknown:0
| unknown
| ^
| Error: you may need to install LLVM and libc++abi - see doc/user/installing-llvm.md (libc++abi.so.1: cannot open shared object file: No such file or directory) (RuntimeError)
I tried to build this Docker image: https://github.com/graalvm/examples/blob/master/fastr_llvm_debug_demo/Dockerfile
But I got this error:
Step 15/40 : RUN mx build --projects SULONG_LLVM_ORG
---> Running in 0464234f5ac9
dependency named SULONG_LLVM_ORG was not found
What is this SULONG_LLVM_ORG
should be?
Thanks!
I'm trying to Java.extend(SomeClass, {});
with the javascript examples, and running into a TypeError TypeError: Could not determine a class loader with access to the JS engine and class com.thing.SomeClass
. I've tried both executing the node
binary directly with the javascript file, as well as starting in Java and using Context context = Context.newBuilder().allowHostAccess(true).engine(Engine.newBuilder().build()).build();
and context.eval("js", "...");
. It seems that the underlying polyglot engine is still made during the bootpath classloader creation and so is unable to extend application classloader types. I made a question over on stack overflow as well https://stackoverflow.com/questions/48728080/graalvm-nashorn-cannot-extend-classes and it looks like I might be one of the first to hit this :) I was hoping someone in this project might have more guidance, or a way to get the javascript executing in the application classloader.
Dear GraalVM demo maintaners,
First of all I am happy about FastR initiative and seeing embed R in java code as future deliverable as open souce.
I did set-up the IntelliJ IDE with JDK - extract of graalvm-0.26 (root dir), added Global lib dependency graalvm-0.26/jre/lib/truffle/truffle-api.jar and source code of the fastr_javaui compiles.
But in the run-time getting service load exception:
ServiceLoader.java:
private S nextService() { ... if (!service.isAssignableFrom(c)) { fail(service, "Provider " + cn + " not a subtype"); } ... }
Where service is interface com.oracle.truffle.api.TruffleRuntimeAccess
and c is class org.graalvm.compiler.truffle.hotspot.HotSpotTruffleRuntimeAccess
Imin:fastr_javaui pranas$ ./run.sh
Exception in thread "main" java.lang.InternalError
at com.oracle.truffle.api.Truffle$1.run(Truffle.java:120)
at com.oracle.truffle.api.Truffle$1.run(Truffle.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at com.oracle.truffle.api.Truffle.initRuntime(Truffle.java:61)
at com.oracle.truffle.api.Truffle.<clinit>(Truffle.java:49)
at com.oracle.truffle.api.impl.Accessor.<clinit>(Accessor.java:499)
at com.oracle.truffle.api.vm.PolyglotEngine.ensureInitialized(PolyglotEngine.java:217)
at com.oracle.truffle.api.vm.PolyglotEngine.<init>(PolyglotEngine.java:261)
at com.oracle.truffle.api.vm.PolyglotEngine.<clinit>(PolyglotEngine.java:210)
at com.oracle.truffle.r.fastrjavaui.FastRJavaUI.main(FastRJavaUI.java:104)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.oracle.truffle.api.Truffle$1.run(Truffle.java:117)
... 9 more
Caused by: java.util.ServiceConfigurationError: com.oracle.truffle.api.TruffleRuntimeAccess: Provider org.graalvm.compiler.truffle.hotspot.HotSpotTruffleRuntimeAccess not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at jdk.vm.ci.services.Services.loadSingle(Services.java:147)
... 14 more
Can you clarify how to set-up environment to have working project?
Thanks
Pranas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.