Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
Reported by Radu on the mailing list.
I can reproduce the symptoms on Ubuntu 16.04, using the system compiler (GCC 7.5.0). CMake command:
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
CMakeLists.txt:
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)
example.cc:
#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; }
When building, this results in a long string of linker errors.
Link command:
/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
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.
Attachments
Issue Links
- is related to
-
ARROW-15859 [C++] Add nightly test for static build with arrow_flight_static and arrow_bundled_dependencies
- Open
-
ARROW-15662 [C++][FlightRPC] Try to upgrade bundled gRPC version
- Closed
- relates to
-
ARROW-17231 [C++] Exported arrow_static requires needless dependencies
- Resolved
- links to