incubator-graphar icon indicating copy to clipboard operation
incubator-graphar copied to clipboard

[Bug][Java]: Bridge dynamic library gar-jni build fatal with Apache Arrow 14.0.0

Open Thespica opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When link arrow as static:

[INFO]      [exec] -- Found re2Alt: /usr/lib/x86_64-linux-gnu/libre2.so  
[INFO]      [exec] -- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.8") 
[INFO]      [exec] -- Looking for BZ2_bzCompressInit
[INFO]      [exec] -- Looking for BZ2_bzCompressInit - found
[INFO]      [exec] -- Found utf8proc: /usr/lib/x86_64-linux-gnu/libutf8proc.so (found version "2.7.0") 
[INFO]      [exec] -- Found nlohmann_json: /usr/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found version "3.10.5") 
[INFO]      [exec] -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.81.0")  
[INFO]      [exec] -- Arrow version: 14.0.0
[INFO]      [exec] -- Found the Arrow shared library: /usr/lib/x86_64-linux-gnu/libarrow.so.1400.0.0
[INFO]      [exec] -- Found the Arrow import library: ARROW_IMPORT_LIB-NOTFOUND
[INFO]      [exec] -- Found the Arrow static library: /usr/lib/x86_64-linux-gnu/libarrow.a
[INFO]      [exec] -- Configuring done (2.6s)
[INFO]      [exec] -- Generating done (0.1s)
[INFO]      [exec] CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Arrow/ArrowTargets.cmake:74 (set_target_properties):
[INFO]      [exec]   The link interface of target "Arrow::arrow_static" contains:
[INFO]      [exec] 
[INFO]      [exec]     protobuf::libprotobuf
[INFO]      [exec] 
[INFO]      [exec]   but the target was not found.  Possible reasons include:
[INFO]      [exec] 
[INFO]      [exec]     * There is a typo in the target name.
[INFO]      [exec]     * A find_package call is missing for an IMPORTED target.
[INFO]      [exec]     * An ALIAS target is missing.
[INFO]      [exec] 
[INFO]      [exec] Call Stack (most recent call first):
[INFO]      [exec]   /usr/lib/x86_64-linux-gnu/cmake/Arrow/ArrowConfig.cmake:135 (include)
[INFO]      [exec]   CMakeLists.txt:23 (find_package)
[INFO]      [exec] 
[INFO]      [exec] 
[INFO]      [exec] CMake Generate step failed.  Build files cannot be regenerated correctly.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.156 s
[INFO] Finished at: 2023-11-02T13:55:00Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.0.0:run (make-and-link-bitcode) on project gar-java: An Ant BuildException has occured: The following error occurred while executing this line:
Error:  /home/runner/work/GraphAr/GraphAr/java/build.xml:20: exec returned: 1
Error:  around Ant part ...<ant antfile="/home/runner/work/GraphAr/GraphAr/java/build.xml">... @ 5:69 in /home/runner/work/GraphAr/GraphAr/java/target/antrun/build-main.xml
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error: Process completed with exit code 1.

When link arrow as shared:

[INFO]      [exec] /usr/bin/c++ -fPIC  -std=c++17 -Wall -O3 -DNDEBUG -O3 -g -shared -Wl,-soname,libgar.so -o libgar.so CMakeFiles/gar.dir/src/arrow_chunk_reader.cc.o CMakeFiles/gar.dir/src/arrow_chunk_writer.cc.o CMakeFiles/gar.dir/src/chunk_info_reader.cc.o CMakeFiles/gar.dir/src/data_type.cc.o CMakeFiles/gar.dir/src/edges_builder.cc.o CMakeFiles/gar.dir/src/expression.cc.o CMakeFiles/gar.dir/src/filesystem.cc.o CMakeFiles/gar.dir/src/graph.cc.o CMakeFiles/gar.dir/src/graph_info.cc.o CMakeFiles/gar.dir/src/reader_util.cc.o CMakeFiles/gar.dir/src/util.cc.o CMakeFiles/gar.dir/src/version_parser.cc.o CMakeFiles/gar.dir/src/vertices_builder.cc.o CMakeFiles/gar.dir/src/yaml.cc.o "CMakeFiles/gar.dir/thirdparty/mini-yaml/yaml/Yaml.cpp.o"  -ldl -Wl,--exclude-libs,ALL -Wl,--whole-archive /usr/lib/x86_64-linux-gnu/libarrow.a /usr/lib/x86_64-linux-gnu/libparquet.a /usr/lib/x86_64-linux-gnu/libarrow_dataset.a /usr/lib/x86_64-linux-gnu/libarrow_acero.a -Wl,--no-whole-archive /usr/lib/x86_64-linux-gnu/libssl.so -lcurl /usr/lib/x86_64-linux-gnu/libparquet.a /usr/lib/x86_64-linux-gnu/libthrift.so /usr/lib/x86_64-linux-gnu/libarrow.a /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libarrow_bundled_dependencies.a /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libbrotlienc.so /usr/lib/x86_64-linux-gnu/libbrotlidec.so /usr/lib/x86_64-linux-gnu/libbrotlicommon.so /usr/lib/x86_64-linux-gnu/libbz2.so /usr/lib/x86_64-linux-gnu/liblz4.so /usr/lib/x86_64-linux-gnu/libsnappy.so.1.1.8 /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libzstd.so /usr/lib/x86_64-linux-gnu/libcurl.so /usr/lib/x86_64-linux-gnu/libutf8proc.so /usr/lib/x86_64-linux-gnu/libre2.so -lprotobuf::libprotobuf -ldl -lrt 
[INFO]      [exec] /usr/bin/ld: cannot find -lprotobuf::libprotobuf: No such file or directory
[INFO]      [exec] make[5]: Leaving directory '/home/runner/work/GraphAr/GraphAr/java/target/native/graphar_ep-build'
[INFO]      [exec] make[4]: Leaving directory '/home/runner/work/GraphAr/GraphAr/java/target/native/graphar_ep-build'
[INFO]      [exec] make[3]: Leaving directory '/home/runner/work/GraphAr/GraphAr/java/target/native/graphar_ep-build'
[INFO]      [exec] make[2]: Leaving directory '/home/runner/work/GraphAr/GraphAr/java/target/native'
[INFO]      [exec] make[1]: Leaving directory '/home/runner/work/GraphAr/GraphAr/java/target/native'
[INFO]      [exec] collect2: error: ld returned 1 exit status
[INFO]      [exec] make[5]: *** [CMakeFiles/gar.dir/build.make:344: libgar.so] Error 1
[INFO]      [exec] make[4]: *** [CMakeFiles/Makefile2:112: CMakeFiles/gar.dir/all] Error 2
[INFO]      [exec] make[3]: *** [Makefile:136: all] Error 2
[INFO]      [exec] make[2]: *** [CMakeFiles/graphar_ep.dir/build.make:86: graphar_ep-prefix/src/graphar_ep-stamp/graphar_ep-build] Error 2
[INFO]      [exec] make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/graphar_ep.dir/all] Error 2
[INFO]      [exec] make: *** [Makefile:91: all] Error 2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:44 min
[INFO] Finished at: 2023-11-02T13:13:18Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.0.0:run (make-and-link-bitcode) on project gar-java: An Ant BuildException has occured: The following error occurred while executing this line:
Error:  /home/runner/work/GraphAr/GraphAr/java/build.xml:24: exec returned: 2
Error:  around Ant part ...<ant antfile="/home/runner/work/GraphAr/GraphAr/java/build.xml">... @ 5:69 in /home/runner/work/GraphAr/GraphAr/java/target/antrun/build-main.xml
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error: Process completed with exit code 1.

Expected Behavior

Build libgar-jni.so successfully.

Minimal Reproducible Example

See CI.

Environment

  • Operating system: ubuntu latest
  • GraphAr version: 0.10.0
  • System installed Arrow 14.0.0

Link to GraphAr Logs

No response

Further Information

Refer to https://cmake.org/cmake/help/latest/command/target_link_libraries.html and Arrow to find more information.

Consider the difference between linking arrow as static and linking arrow as shared, and choose the better one.

Further features:

  • [ ] When arrow is not installed, let gar-jni link to graphar_ep's arrow library(shared or static? why?).
  • [ ] Keep source code and gar library generated by CMake after running mvn clean

Thespica avatar Nov 02 '23 14:11 Thespica

If arrow 14.0.0 is not fit to JAVA SDK, you change the CI install dependency: https://github.com/alibaba/GraphAr/blob/1d714605fadf37f4a311b0f158535e9415a1599c/.github/workflows/java.yml#L39

to

    sudo apt install -y libarrow-dev=13.0.0-1 libarrow-dataset-dev=13.0.0-1 libarrow-acero-dev=13.0.0-1 libparquet-dev=13.0.0-1

as a temporary solution to fix CI.

acezen avatar Nov 03 '23 09:11 acezen