https://opendal.apache.org/ logo
use OpenDAL for connecting to hdfs
# general
s
Hi, I am trying to use OpenDAL in my rust application for connecting to hdfs. I am running it locally on mac. Downloaded hadoop 3.2.4 locally, brought up hdfs and setup the run time envs as mentioned - https://opendal.apache.org/docs/services/hdfs#environment Build for my code fails with the error
Copy code
"/Users/<username>/.rustup/toolchains/1.71.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-6840aac782a5387e.rlib" "-ljvm" "-lhdfs" "-framework" "Security" "-framework" "Security" "-framework" "SystemConfiguration" "-lz" "-framework" "CoreFoundation" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/<username>/.rustup/toolchains/1.71.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/<username>/Projects/shbhm-forks/timeline-rust/target/debug/deps/tlb2-38efc16b827f3c33" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: unknown file type in '/opt/homebrew/Cellar/hadoop-3.2.4/lib/native/libhdfs.so.0.0.0'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems the libhdfs.so library is built for x86-64 architecture (ELF 64-bit LSB shared object, x86-64) and is not supported for mac aarch64. Please help me with the following queries 1. How is OpenDAL connecting to hdfs ? I read it uses hdrs internally which relies on hdfs-sys. hdfs-sys uses JNI to call functions provided by jars that provided by hadoop releases. - https://github.com/Xuanwo/hdfs-sys#runtime But why does the error rely on a native library libhdfs.so 2. If the native library is a hard dependency how do I work around the libhdfs.so (x86) file type. Do I need to build these libs for aarch64 ? How to go about it ? Thank you!
x
Thanks for reaching out!
> How is OpenDAL connecting to hdfs ? OpenDAL connect hdfs via: opendal -> hdrs -> hdfs-sys -> jni -> libhdfs -> hdfs java client
So we will need libhdfs to connect.
And sadly, hadoop doesn't provide built-in macos support, so you will need to add
hdrs
into deps and enable the
vendored
feature.
s
Thank you! The build worked 🙂 For the order of connection, would it be opendal -> hdrs -> hdfs-sys -> libhdfs ->jni -> hdfs java client Since hdfs-sys is binding to C native Api.
x
Correct!
By the way, would you like to submit a PR to add the docs for running hdfs service under macos?
s
Sure, that would be great.
Please help on how to go about it.
x
I have created an issue for that https://github.com/apache/incubator-opendal/issues/3557, please take a look.
s
x
Great! Thanks a lot.
16 Views