Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/conda_env_cpp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ make
meson
ninja
nodejs>=16
orc<2.1.0
orc
pkg-config
python
rapidjson
Expand Down
9 changes: 9 additions & 0 deletions cpp/examples/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ if(ARROW_FLIGHT)
EXTRA_SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
if(NOT MSVC)
# Work around absl::Mutex::Dtor ABI mismatch in debug builds against
# an NDEBUG-built Abseil. See absl_mutex_ndebug.h.
# Same issue as:
# https://github.com/apache/arrow/blob/d58f83f3131cb57ede40d99ac4d0978748d1a970/cpp/src/arrow/flight/transport/grpc/customize_grpc.h#L25-L59
target_compile_options(flight-grpc-example
PRIVATE "SHELL:-include ${CMAKE_CURRENT_SOURCE_DIR}/absl_mutex_ndebug.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does this CMake syntax do (the SHELL:-include thing)? Is there any documentation about this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the option:
https://cmake.org/cmake/help/latest/command/target_compile_options.html#option-de-duplication

It tokenizes the command as if it would be a shell command using it as two arguments instead of a single quoted argument. Otherwise it fails, minor example:

raulcd@limgrave:~/code/arrow (GH-55754) $ gcc "-include test.h" test.cc
<command-line>: fatal error:  test.h: No such file or directory
compilation terminated.
raulcd@limgrave:~/code/arrow (GH-55754) $ gcc -include test.h test.cc
/usr/bin/x86_64-linux-gnu-ld.bfd: /usr/lib/gcc/x86_64-linux-gnu/16/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status

I can add a comment to the CMake option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, I see. But then we're hard-coding -include which is a gcc option. Does this work on other compilers, such as MSVC?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is guarded with if(NOT MSVC) and should work with GCC and Clang. I don't think this is required for MSVC (at least we haven't found the issue there).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oops, sorry. Well, let's do this then. Sorry for delaying :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not at all! Thanks for the careful review! I think with the increase of AI usage we should validate all those that are not so obvious carefully and ensure they are indeed necessary.

)
endif()

if(ARROW_FLIGHT_SQL)
if(ARROW_BUILD_SHARED AND ARROW_GRPC_USE_SHARED)
Expand Down
38 changes: 38 additions & 0 deletions cpp/examples/arrow/absl_mutex_ndebug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

#pragma once

// Force-included into the flight-grpc-example sources (including the
// protoc-generated ones, which we can't edit). Same workaround as
// arrow/flight/transport/grpc/customize_grpc.h, added in GH-45885:
// Abseil built with NDEBUG (e.g. conda-forge) doesn't export
// Mutex::Dtor(), so debug TUs that inline ~Mutex() (via
// grpc::CompletionQueue) fail to link.
// See https://github.com/abseil/abseil-cpp/issues/1624
// and https://github.com/conda-forge/abseil-cpp-feedstock/issues/104
#if __has_include(<absl/synchronization/mutex.h>)
# ifndef NDEBUG
# define ARROW_EXAMPLE_NO_NDEBUG
# define NDEBUG
# endif
# include <absl/synchronization/mutex.h>
# ifdef ARROW_EXAMPLE_NO_NDEBUG
# undef NDEBUG
# undef ARROW_EXAMPLE_NO_NDEBUG
# endif
#endif
8 changes: 6 additions & 2 deletions cpp/src/arrow/flight/flight_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ Status DoSinglePerfRun(FlightClient* client, const FlightClientOptions client_op
// Plan the query
FlightDescriptor descriptor;
descriptor.type = FlightDescriptor::CMD;
perf.SerializeToString(&descriptor.cmd);
if (!perf.SerializeToString(&descriptor.cmd)) {
return Status::Invalid("cannot serialize perf command");
}

ARROW_ASSIGN_OR_RAISE(auto plan, client->GetFlightInfo(call_options, descriptor));

Expand All @@ -307,7 +309,9 @@ Status DoSinglePerfRun(FlightClient* client, const FlightClientOptions client_op
}

perf::Token token;
token.ParseFromString(endpoint.ticket.ticket);
if (!token.ParseFromString(endpoint.ticket.ticket)) {
return Status::Invalid("cannot parse ticket");
}

const auto& result = test_loop(data_client, call_options, token, endpoint, stats);
if (result.ok()) {
Expand Down
Loading