Our Google Cloud Dataflow pipeline program calls some library which dynamically links to *.so files, so to run it I need to set linux environment variable LD_LIBRARY_PATH. There is a hack to do that: https://groups.google.com/forum/#!topic/comp.lang.java.programmer/LOu18-OWAVM, but I wonder is there a way to do that using some job that will run shell script before executing pipeline?
我们的Google Cloud Dataflow管道程序调用一些动态链接到* .so文件的库,因此要运行它我需要设置linux环境变量LD_LIBRARY_PATH。有一个黑客可以做到这一点:https://groups.google.com/forum/#!topic / comp.lang.java.programmer / LOU18-OWAVM,但我想知道有没有办法做到这一点使用一些工作,将在执行管道之前运行shell脚本?
1 个解决方案
#1
0
Are you using JNI for this? Can you set the environment variable in the Java code before your setup your JNI code?
你在使用JNI吗?您可以在设置JNI代码之前在Java代码中设置环境变量吗?
You may also want to just load the .so file from the classpath and pass it in a stream. Is it possible to link in the .so file that way?
您可能还想从类路径加载.so文件并将其传递到流中。是否有可能以这种方式链接.so文件?
See filesToStage here for how to lookup the file. https://cloud.google.com/dataflow/pipelines/specifying-exec-params
有关如何查找文件的信息,请参阅filesToStage。 https://cloud.google.com/dataflow/pipelines/specifying-exec-params
Perhaps the suggestions in these links could work as well, and you could package the .so file in your jar: How to bundle a native library and a JNI library inside a JAR?
也许这些链接中的建议也可以正常工作,您可以将.so文件打包到jar中:如何在JAR中捆绑本机库和JNI库?
https://www.adamheinrich.com/blog/2012/12/how-to-load-native-jni-library-from-jar/
https://www.adamheinrich.com/blog/2012/12/how-to-load-native-jni-library-from-jar/
#1
0
Are you using JNI for this? Can you set the environment variable in the Java code before your setup your JNI code?
你在使用JNI吗?您可以在设置JNI代码之前在Java代码中设置环境变量吗?
You may also want to just load the .so file from the classpath and pass it in a stream. Is it possible to link in the .so file that way?
您可能还想从类路径加载.so文件并将其传递到流中。是否有可能以这种方式链接.so文件?
See filesToStage here for how to lookup the file. https://cloud.google.com/dataflow/pipelines/specifying-exec-params
有关如何查找文件的信息,请参阅filesToStage。 https://cloud.google.com/dataflow/pipelines/specifying-exec-params
Perhaps the suggestions in these links could work as well, and you could package the .so file in your jar: How to bundle a native library and a JNI library inside a JAR?
也许这些链接中的建议也可以正常工作,您可以将.so文件打包到jar中:如何在JAR中捆绑本机库和JNI库?
https://www.adamheinrich.com/blog/2012/12/how-to-load-native-jni-library-from-jar/
https://www.adamheinrich.com/blog/2012/12/how-to-load-native-jni-library-from-jar/