apache / apache/arrow

[Java][Gandiva][ARM v8] Exception thrown when JAVA calls libgandiva_jni.so on ARM (but successfully on x86 platform)

Open
#41,935 8 comments 0 reactions 0 assignees View on GitHub
Component: Gandiva Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Hello,
We have encountered a wierd issue about libgandiva_jni.so. Same Java program calls Arrow 9.0.0's libgandiva_jni.so (compiled successfully) with different results on ARM and x86 platform. On ARM platform, it throwed out an exception as below,

```text
undefined symbol: _ZN4llvm3sys14DynamicLibrary19getPermanentLibraryEPKcPSs
```

Then we traced this problem, and found it was blocked in the method:

```text
llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::basic_string, std::allocator >)
```

Furthermore, we have found this method lies in "libLLVMSupport.a", but we are sure this libLLVMSupport.a file has been linked in shared lib. Below is the command we used:

```text
_/usr/bin/c++ -fPIC -Wno-noexcept-type -fdiagnostics-color=always -O3 -DNDEBUG -Wall -fno-semantic-interposition -march=armv8-a -O3 -DNDEBUG -Wl,--version-script=/path/to/arrow-9.0.0/cpp/src/gandiva/jni/symbols.map -shared -Wl,-soname,libgandiva_jni.so.900 -o ../../../release/libgandiva_jni.so.900.0.0 CMakeFiles/gandiva_jni_objlib.dir/config_builder.cc.o CMakeFiles/gandiva_jni_objlib.dir/config_holder.cc.o CMakeFiles/gandiva_jni_objlib.dir/expression_registry_helper.cc.o CMakeFiles/gandiva_jni_objlib.dir/jni_common.cc.o CMakeFiles/gandiva_jni_objlib.dir/Types.pb.cc.o ../../../protobuf_ep-install/lib/libprotobuf.a ../../../release/libgandiva.a ../../../release/libarrow.a ../../../protobuf_ep-install/lib/libprotobuf.a ../../../brotli_ep/src/brotli_ep-install/lib/libbrotlienc-static.a ../../../brotli_ep/src/brotli_ep-install/lib/libbrotlidec-static.a ../../../brotli_ep/src/brotli_ep-install/lib/libbrotlicommon-static.a ../../../bzip2_ep-install/lib/libbz2.a ../../../lz4_ep-prefix/src/lz4_ep/lib/liblz4.a ../../../snappy_ep/src/snappy_ep-install/lib/libsnappy.a ../../../zstd_ep-install/lib64/libzstd.a ../../../orc_ep-install/lib/liborc.a ../../../jemalloc_ep-prefix/src/jemalloc_ep/dist//lib/libjemalloc_pic.a -pthread /usr/local/llvm/lib/libLLVMMCJIT.a /usr/local/llvm/lib/libLLVMExecutionEngine.a /usr/local/llvm/lib/libLLVMOrcTargetProcess.a /usr/local/llvm/lib/libLLVMOrcShared.a /usr/local/llvm/lib/libLLVMRuntimeDyld.a /usr/local/llvm/lib/libLLVMipo.a /usr/local/llvm/lib/libLLVMFrontendOpenMP.a /usr/local/llvm/lib/libLLVMIRReader.a /usr/local/llvm/lib/libLLVMAsmParser.a /usr/local/llvm/lib/libLLVMVectorize.a /usr/local/llvm/lib/libLLVMInstrumentation.a /usr/local/llvm/lib/libLLVMLinker.a /usr/local/llvm/lib/libLLVMAArch64CodeGen.a /usr/local/llvm/lib/libLLVMAsmPrinter.a /usr/local/llvm/lib/libLLVMDebugInfoMSF.a /usr/local/llvm/lib/libLLVMGlobalISel.a /usr/local/llvm/lib/libLLVMSelectionDAG.a /usr/local/llvm/lib/libLLVMCodeGen.a /usr/local/llvm/lib/libLLVMTarget.a /usr/local/llvm/lib/libLLVMBitWriter.a /usr/local/llvm/lib/libLLVMScalarOpts.a /usr/local/llvm/lib/libLLVMAggressiveInstCombine.a /usr/local/llvm/lib/libLLVMInstCombine.a /usr/local/llvm/lib/libLLVMTransformUtils.a /usr/local/llvm/lib/libLLVMAnalysis.a /usr/local/llvm/lib/libLLVMProfileData.a /usr/local/llvm/lib/libLLVMDebugInfoDWARF.a /usr/local/llvm/lib/libLLVMObject.a /usr/local/llvm/lib/libLLVMBitReader.a /usr/local/llvm/lib/libLLVMTextAPI.a /usr/local/llvm/lib/libLLVMCFGuard.a /usr/local/llvm/lib/libLLVMCore.a /usr/local/llvm/lib/libLLVMRemarks.a /usr/local/llvm/lib/libLLVMBitstreamReader.a /usr/local/llvm/lib/libLLVMAArch64AsmParser.a /usr/local/llvm/lib/libLLVMMCParser.a /usr/local/llvm/lib/libLLVMAArch64Disassembler.a /usr/local/llvm/lib/libLLVMAArch64Desc.a /usr/local/llvm/lib/libLLVMMCDisassembler.a /usr/local/llvm/lib/libLLVMAArch64Info.a /usr/local/llvm/lib/libLLVMMC.a /usr/local/llvm/lib/libLLVMBinaryFormat.a /usr/local/llvm/lib/libLLVMDebugInfoCodeView.a /usr/local/llvm/lib/libLLVMAArch64Utils.a /usr/local/llvm/lib/libLLVMSupport.a /usr/lib64/libz.so -lrt -ldl -lpthread -lm /usr/lib64/libtinfo.so /usr/local/llvm/lib/libLLVMDemangle.a /usr/lib64/libssl.so /usr/lib64/libcrypto.so ../../../re2_ep-install/lib/libre2.a ../../../utf8proc_ep-install/lib/libutf8proc.a__
```

Environment details:
**OS:** CentOS v7.6
**Tools:** GCC 8.3.1, LLVM 14

If I missed anything, please let me know.

Thanks,

NaiYan.

### Component(s)

C++ - Gandiva

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.