Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(c++): fix the 'multiple definition' bug when linking libarrow.a and libgraphar_bundled_dependencies.a in one CMakeLists.txt #657

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

Elssky
Copy link
Contributor

@Elssky Elssky commented Nov 8, 2024

fix the issues in #628

…nd libgraphar_bundled_dependencies.a in one CMakeLists.txt
@Elssky
Copy link
Contributor Author

Elssky commented Nov 11, 2024

Hi,@acezen @jasinliu. This should solve the problem in #628, please review this.

"${GAR_DATASET_STATIC_LIB}"
"${GAR_ARROW_ACERO_STATIC_LIB}"
"${GAR_ARROW_BUNDLED_DEPS_STATIC_LIB}" -Wl,--no-whole-archive)
target_link_libraries(graphar PRIVATE -Wl,--exclude-libs,ALL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove -Wl,--whole-archive and -Wl,--no-whole-archive

@jasinliu
Copy link
Contributor

Hi,@acezen @jasinliu. This should solve the problem in #628, please review this.

Thanks! I think you can create some tests following #628 . Or you can provide the verification process through comments.

@Elssky
Copy link
Contributor Author

Elssky commented Nov 11, 2024

Hi,@acezen @jasinliu. This should solve the problem in #628, please review this.

Thanks! I think you can create some tests following #628 . Or you can provide the verification process through comments.

Yes, I used the totally same exmaple in the comment for testing and the installation steps are exactly the same, the results show that we can run this code correctly
image

Other example

test_read.cc

#include <cstdlib>
#include <iostream>
#include "arrow/api.h"
#include "graphar/api/arrow_reader.h"



int main() {
    std::string path = "/workspaces/incubator-graphar/testing/ldbc_sample/parquet/ldbc_sample.graph.yml";
    std::string src_type = "person", edge_type = "knows", dst_type = "person";
    std::string vertex_property_name = "id";
    std::string edge_property_name = "creationDate";
    auto maybe_graph_info = graphar::GraphInfo::Load(path);
    auto graph_info = maybe_graph_info.value();
    auto vertex_info = graph_info->GetVertexInfo(src_type);


    auto maybe_reader = graphar::VertexPropertyArrowChunkReader::Make(
    graph_info, src_type, vertex_property_name);
    auto reader = maybe_reader.value();
    std::cout << "Chunknum " << reader->GetChunkNum() << std::endl;

    auto result = reader->GetChunk();
    auto table = result.value();
    std::cout << "num_rows " << table->num_rows() << std::endl;

}

CMakeLists.txt

cmake_minimum_required(VERSION 3.15)

project(test_read)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall")

set(TARGET test_read)

find_package(graphar REQUIRED)
find_package(Arrow REQUIRED)

add_executable(${TARGET} test_read.cc)
target_link_libraries(${TARGET} PRIVATE graphar Arrow::arrow_static)

build

cmake . && make
image

@lixueclaire lixueclaire requested a review from acezen November 19, 2024 02:34
Copy link
Contributor

@acezen acezen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lixueclaire lixueclaire merged commit 8f14af4 into apache:main Dec 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants