Skip to content

Commit d0444f7

Browse files
alinaliBQjusting-bq
authored andcommitted
Enable Build on MacOS C++ CI
1 parent 98c2028 commit d0444f7

7 files changed

Lines changed: 31 additions & 17 deletions

File tree

.github/workflows/cpp.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ jobs:
194194
ARROW_BUILD_TESTS: ON
195195
ARROW_DATASET: ON
196196
ARROW_FLIGHT: ON
197+
ARROW_FLIGHT_SQL: ON
198+
ARROW_FLIGHT_SQL_ODBC: ON
197199
ARROW_GANDIVA: ON
198200
ARROW_GCS: ON
199201
ARROW_HDFS: ON
@@ -230,6 +232,9 @@ jobs:
230232
brew uninstall pkg-config || :
231233
brew uninstall pkg-config@0.29.2 || :
232234
brew bundle --file=cpp/Brewfile
235+
export LIBIODBC_DIR="$(brew --cellar libiodbc)/$(brew list --versions libiodbc | awk '{print $2}')"
236+
echo ODBC_INCLUDE_DIR="$LIBIODBC_DIR/include" >> $GITHUB_ENV
237+
echo ODBC_LIB_DIR="$LIBIODBC_DIR/lib" >> $GITHUB_ENV
233238
- name: Install MinIO
234239
run: |
235240
$(brew --prefix bash)/bin/bash \
@@ -257,20 +262,20 @@ jobs:
257262
restore-keys: cpp-ccache-macos-${{ matrix.macos-version }}-
258263
- name: Build
259264
run: |
260-
if [ "${{ matrix.macos-version }}" = "15-intel" ]; then
261-
# This is a workaround.
262-
#
263-
# Homebrew uses /usr/local as prefix. So packages
264-
# installed by Homebrew also use /usr/local/include. We
265-
# want to include headers for packages installed by
266-
# Homebrew as system headers to ignore warnings in them.
267-
# But "-isystem /usr/local/include" isn't used by CMake
268-
# because /usr/local/include is marked as the default
269-
# include path. So we disable -Werror to avoid build error
270-
# by warnings from packages installed by Homebrew.
271-
export BUILD_WARNING_LEVEL=PRODUCTION
272-
fi
265+
# Homebrew uses /usr/local as prefix. So packages
266+
# installed by Homebrew also use /usr/local/include. We
267+
# want to include headers for packages installed by
268+
# Homebrew as system headers to ignore warnings in them.
269+
# But "-isystem /usr/local/include" isn't used by CMake
270+
# because /usr/local/include is marked as the default
271+
# include path. So we disable -Werror to avoid build error
272+
# by warnings from packages installed by Homebrew.
273+
export BUILD_WARNING_LEVEL=PRODUCTION
273274
ci/scripts/cpp_build.sh $(pwd) $(pwd)/build
275+
- name: Register Flight SQL ODBC Driver
276+
run: |
277+
chmod +x cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh
278+
sudo cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh $(pwd)/build/cpp/debug/libarrow_flight_sql_odbc.dylib
274279
- name: Test
275280
shell: bash
276281
run: |

ci/scripts/cpp_build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ else
260260
-DCMAKE_BUILD_TYPE=${ARROW_BUILD_TYPE:-debug} \
261261
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE:-OFF} \
262262
-DCMAKE_C_FLAGS="${CFLAGS:-}" \
263-
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-}" \
263+
-DCMAKE_CXX_FLAGS="${CXXFLAGS:-} -I${ODBC_INCLUDE_DIR:-} -L${ODBC_LIB_DIR:-}" \
264264
-DCMAKE_CXX_STANDARD="${CMAKE_CXX_STANDARD:-17}" \
265265
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR:-lib} \
266266
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}} \
@@ -271,6 +271,7 @@ else
271271
-DgRPC_SOURCE=${gRPC_SOURCE:-} \
272272
-DGTest_SOURCE=${GTest_SOURCE:-} \
273273
-Dlz4_SOURCE=${lz4_SOURCE:-} \
274+
-DODBC_INCLUDE_DIR="${ODBC_INCLUDE_DIR:-}" \
274275
-Dopentelemetry-cpp_SOURCE=${opentelemetry_cpp_SOURCE:-} \
275276
-DORC_SOURCE=${ORC_SOURCE:-} \
276277
-DPARQUET_BUILD_EXAMPLES=${PARQUET_BUILD_EXAMPLES:-OFF} \

ci/scripts/cpp_test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ case "$(uname)" in
6161
n_jobs=$(sysctl -n hw.ncpu)
6262
# TODO: https://github.com/apache/arrow/issues/40410
6363
exclude_tests+=("arrow-s3fs-test")
64+
exclude_tests+=("arrow-flight-sql-odbc-test")
6465
;;
6566
MINGW*)
6667
n_jobs=${NUMBER_OF_PROCESSORS:-1}

cpp/Brewfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ brew "git"
2828
brew "glog"
2929
brew "googletest"
3030
brew "grpc"
31+
brew "libiodbc"
3132
brew "llvm"
3233
brew "lz4"
3334
brew "mimalloc"

cpp/cmake_modules/DefineOptions.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ macro(tsort_bool_option_dependencies)
107107
endmacro()
108108

109109
macro(resolve_option_dependencies)
110-
# Arrow Flight SQL ODBC is available only for Windows for now.
111-
if(NOT WIN32)
110+
# Arrow Flight SQL ODBC is available only for Windows and macOS for now.
111+
if(NOT WIN32 AND NOT APPLE)
112112
set(ARROW_FLIGHT_SQL_ODBC OFF)
113113
endif()
114114
if(MSVC_TOOLCHAIN)

cpp/src/arrow/flight/sql/odbc/install/mac/install_odbc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ USER_ODBCINST_FILE="$HOME/Library/ODBC/odbcinst.ini"
3636
DRIVER_NAME="Apache Arrow Flight SQL ODBC Driver"
3737
DSN_NAME="Apache Arrow Flight SQL ODBC DSN"
3838

39+
mkdir -p $HOME/Library/ODBC
40+
3941
touch "$USER_ODBCINST_FILE"
4042

4143
# Admin privilege is needed to add ODBC driver registration

cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
add_custom_target(tests)
1919

20-
include_directories(${ODBC_INCLUDE_DIRS})
20+
if(WIN32)
21+
include_directories(${ODBC_INCLUDE_DIRS})
22+
else()
23+
include_directories(${ODBC_INCLUDE_DIR})
24+
endif()
2125

2226
find_package(SQLite3Alt REQUIRED)
2327

0 commit comments

Comments
 (0)