You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2021/11/13 19:55:00 UTC

[jira] [Created] (ARROW-14708) [C++] Can't link to installed arrow_flight_static due to missing symbols in libarrow_bundled_dependencies

David Li created ARROW-14708:
--------------------------------

             Summary: [C++] Can't link to installed arrow_flight_static due to missing symbols in libarrow_bundled_dependencies
                 Key: ARROW-14708
                 URL: https://issues.apache.org/jira/browse/ARROW-14708
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++, FlightRPC, Packaging
            Reporter: David Li


Reported by Radu on the [mailing list|https://lists.apache.org/thread/6os2v92h6msvxqtd4f9bpb3kdgovmklm].

I can reproduce the symptoms on Ubuntu 16.04, using the system compiler (GCC 7.5.0). CMake command:
{noformat}
cmake ../cpp -DClangTools_PATH=/home/lidavidm/Code/clang/bin -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_INSTALL_PREFIX=(pwd)/../install -DCMAKE_INSTALL_LIBDIR=lib -DARROW_USE_GLOG=ON -DARROW_PARQUET=ON -DARROW_WITH_SNAPPY=ON -DARROW_DATASET=ON -DARROW_CSV=ON -DARROW_JSON=ON -DARROW_PYTHON=ON -DARROW_WITH_LZ4=ON -DARROW_FLIGHT=ON -DARROW_DEPENDENCY_SOURCE=BUNDLED {noformat}
CMakeLists.txt:
{noformat}
cmake_minimum_required(VERSION 3.18)

project(ArrowMinimalExample)

find_package(Arrow REQUIRED)
find_package(ArrowFlight REQUIRED)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)

message(STATUS "Arrow version: ${ARROW_VERSION}")
message(STATUS "Arrow SO version: ${ARROW_FULL_SO_VERSION}")

add_executable(arrow_example example.cc)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(arrow_example PRIVATE arrow_static arrow_flight_static Threads::Threads){noformat}
 
example.cc:
{code:cpp}
#include <arrow/flight/api.h>
#include <arrow/status.h>

#include <iostream>

namespace flight = ::arrow::flight;

using arrow::Status;

namespace {

// Flight service
class SimpleFlightServer : public flight::FlightServerBase {};

Status RunMain(int argc, char** argv) {
  std::unique_ptr<flight::FlightServerBase> server;
  server.reset(new SimpleFlightServer());

  flight::Location bind_location;
  ARROW_RETURN_NOT_OK(flight::Location::ForGrpcTcp("0.0.0.0", 3003, &bind_location));
  flight::FlightServerOptions options(bind_location);

  ARROW_RETURN_NOT_OK(server->Init(options));
  ARROW_RETURN_NOT_OK(server->SetShutdownOnSignals({SIGTERM}));
  ARROW_RETURN_NOT_OK(server->Serve());

  return Status::OK();
}

}  // namespace

int main(int argc, char** argv) {
  Status st = RunMain(argc, argv);
  if (!st.ok()) {
    std::cerr << st << std::endl;
    return 1;
  }
  return 0;
}
{code}
When building, this results in a long string of linker errors.

Link command:
{noformat}
/usr/bin/c++ -O3 -DNDEBUG  CMakeFiles/arrow_example.dir/example.cc.o -o arrow_example  /home/lidavidm/Code/upstream/arrow-deps/install/lib/libarrow.a  /home/lidavidm/Code/upstream/arrow-deps/install/lib/libarrow_flight.a  -pthread  /usr/lib/x86_64-linux-gnu/libssl.so  /usr/lib/x86_64-linux-gnu/libcrypto.so  -lrt  /home/lidavidm/Code/upstream/arrow-deps/install/lib/libarrow_bundled_dependencies.a {noformat}
At first glance:
 * Some Abseil libraries aren't bundled, e.g. str_format_internal
 * Even when bundled, they don't actually make it into the final static archive! (confirmed with nm) Playing around with ar myself, it works fine if I just combine a subset of the libraries, but with all the libraries, we end up with undefined symbols.
 * The dependencies aren't ordered correctly - OpenSSL needs to come after {{libarrow_bundled_dependencies.a}} not before.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)