From 897c186f475f3dd82c1ab47e5cfb87cb0fed8440 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 25 Aug 2022 15:08:39 +0900 Subject: [PATCH] ARROW-17433: [CI][C++] Use Visual Studio 2019 on AppVeyor (#13903) We can use /external:I for Boost to suppress warnings from Boost with Visual Studio 2019 or later. Lead-authored-by: Sutou Kouhei Co-authored-by: Antoine Pitrou Signed-off-by: Sutou Kouhei --- appveyor.yml | 33 +++++-------- ci/appveyor-cpp-build.bat | 41 +--------------- ci/appveyor-cpp-setup.bat | 54 +++++++++------------- ci/conda_env_gandiva_win.txt | 5 +- cpp/src/gandiva/gdv_function_stubs.cc | 7 ++- cpp/src/gandiva/precompiled/CMakeLists.txt | 12 +++-- 6 files changed, 47 insertions(+), 105 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 03a3597c9b7ba..b6ba6e6e1a487 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ # under the License. # Operating system (build VM template) -os: Visual Studio 2017 +os: Visual Studio 2019 only_commits: # Skip commits not related to Python or C++ @@ -36,35 +36,24 @@ matrix: environment: global: - # Make these variables visible in all jobs and build steps - MSVC_DEFAULT_OPTIONS: ON APPVEYOR_SAVE_CACHE_ON_ERROR: true + MSVC_DEFAULT_OPTIONS: ON + # Change the clcache dir to reset caches everywhere when a setting # is changed incompatibly (e.g. CLCACHE_COMPRESS). CLCACHE_DIR: C:\Users\Appveyor\clcache1 CLCACHE_SERVER: 1 CLCACHE_COMPRESS: 1 CLCACHE_COMPRESSLEVEL: 6 - ARROW_BUILD_FLIGHT: "OFF" - ARROW_BUILD_FLIGHT_SQL: "OFF" - ARROW_BUILD_GANDIVA: "OFF" - ARROW_LLVM_VERSION: "7.0.*" - ARROW_S3: "OFF" - PYTHON: "3.8" - ARCH: "64" - matrix: - # NOTE: clcache seems to work best with Ninja and worst with msbuild - # (as generated by cmake) - - JOB: "Toolchain" - GENERATOR: Ninja - ARROW_GCS: "ON" - ARROW_S3: "ON" - ARROW_BUILD_FLIGHT: "ON" - ARROW_BUILD_FLIGHT_SQL: "ON" - ARROW_BUILD_GANDIVA: "ON" - - JOB: "Build_Debug" - GENERATOR: Ninja + ARCH: "64" + ARROW_BUILD_FLIGHT: "ON" + ARROW_BUILD_FLIGHT_SQL: "ON" + ARROW_BUILD_GANDIVA: "ON" + ARROW_GCS: "ON" + ARROW_S3: "ON" + GENERATOR: Ninja + PYTHON: "3.8" before_build: - call ci\appveyor-cpp-setup.bat diff --git a/ci/appveyor-cpp-build.bat b/ci/appveyor-cpp-build.bat index e2c2d800d0ffe..4b90e49257c5e 100644 --- a/ci/appveyor-cpp-build.bat +++ b/ci/appveyor-cpp-build.bat @@ -31,51 +31,13 @@ set ARROW_DEBUG_MEMORY_POOL=trap set CMAKE_BUILD_PARALLEL_LEVEL=%NUMBER_OF_PROCESSORS% set CTEST_PARALLEL_LEVEL=%NUMBER_OF_PROCESSORS% -@rem -@rem In the configurations below we disable building the Arrow static library -@rem to save some time. Unfortunately this will still build the Parquet static -@rem library because of PARQUET-1420 (Thrift-generated symbols not exported in DLL). -@rem -if "%JOB%" == "Build_Debug" ( - mkdir cpp\build-debug - pushd cpp\build-debug - - cmake -G "%GENERATOR%" ^ - -DARROW_BOOST_USE_SHARED=OFF ^ - -DARROW_BUILD_EXAMPLES=ON ^ - -DARROW_BUILD_STATIC=OFF ^ - -DARROW_BUILD_TESTS=ON ^ - -DARROW_CXXFLAGS="/MP" ^ - -DARROW_ENABLE_TIMING_TESTS=OFF ^ - -DARROW_USE_PRECOMPILED_HEADERS=OFF ^ - -DARROW_VERBOSE_THIRDPARTY_BUILD=OFF ^ - -DCMAKE_BUILD_TYPE="Debug" ^ - -DCMAKE_UNITY_BUILD=ON ^ - .. || exit /B - - cmake --build . --config Debug || exit /B - ctest --output-on-failure || exit /B - popd - - @rem Finish Debug build successfully - exit /B 0 -) call activate arrow -@rem Use Boost from Anaconda -set BOOST_ROOT=%CONDA_PREFIX%\Library -set BOOST_LIBRARYDIR=%CONDA_PREFIX%\Library\lib - @rem The "main" C++ build script for Windows CI @rem (i.e. for usual configurations) -if "%JOB%" == "Toolchain" ( - set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=CONDA -DARROW_WITH_BZ2=ON -) else ( - @rem We're in a conda environment but don't want to use it for the dependencies - set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=AUTO -) +set CMAKE_ARGS=-DARROW_DEPENDENCY_SOURCE=CONDA -DARROW_WITH_BZ2=ON @rem Enable warnings-as-errors set ARROW_CXXFLAGS=/WX /MP @@ -119,6 +81,7 @@ cmake -G "%GENERATOR%" %CMAKE_ARGS% ^ -DCMAKE_BUILD_TYPE="Release" ^ -DCMAKE_CXX_COMPILER=clcache ^ -DCMAKE_CXX_FLAGS_RELEASE="/MD /Od /UNDEBUG" ^ + -DCMAKE_CXX_STANDARD=17 ^ -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^ -DCMAKE_UNITY_BUILD=ON ^ -DCMAKE_VERBOSE_MAKEFILE=OFF ^ diff --git a/ci/appveyor-cpp-setup.bat b/ci/appveyor-cpp-setup.bat index 1fa126cb0d243..f9390e9be5ae5 100644 --- a/ci/appveyor-cpp-setup.bat +++ b/ci/appveyor-cpp-setup.bat @@ -17,9 +17,7 @@ @echo on -set "PATH=C:\Miniconda37-x64;C:\Miniconda37-x64\Scripts;C:\Miniconda37-x64\Library\bin;%PATH%" -set BOOST_ROOT=C:\Libraries\boost_1_67_0 -set BOOST_LIBRARYDIR=C:\Libraries\boost_1_67_0\lib64-msvc-14.0 +set "PATH=C:\Miniconda38-x64;C:\Miniconda38-x64\Scripts;C:\Miniconda38-x64\Library\bin;%PATH%" @rem @rem Avoid picking up AppVeyor-installed OpenSSL (linker errors with gRPC) @@ -31,6 +29,8 @@ rd /s /q C:\OpenSSL-v11-Win32 rd /s /q C:\OpenSSL-v11-Win64 rd /s /q C:\OpenSSL-v111-Win32 rd /s /q C:\OpenSSL-v111-Win64 +rd /s /q C:\OpenSSL-v30-Win32 +rd /s /q C:\OpenSSL-v30-Win64 @rem @rem Configure miniconda @@ -52,9 +52,8 @@ conda install -q -y -c conda-forge mamba python=3.9 || exit /B mamba update -q -y -c conda-forge --all || exit /B @rem -@rem Create conda environment for Build and Toolchain jobs +@rem Create conda environment @rem -@rem Avoid Boost 1.70 because of https://github.com/boostorg/process/issues/85 set CONDA_PACKAGES= @@ -62,37 +61,26 @@ if "%ARROW_BUILD_GANDIVA%" == "ON" ( @rem Install llvmdev in the toolchain if building gandiva.dll set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_gandiva_win.txt ) -if "%JOB%" == "Toolchain" ( - @rem Install pre-built "toolchain" packages for faster builds - set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_cpp.txt -) -if "%JOB%" NEQ "Build_Debug" ( - @rem Arrow conda environment is only required for the Build and Toolchain jobs - mamba create -n arrow -q -y -c conda-forge ^ - --file=ci\conda_env_python.txt ^ - %CONDA_PACKAGES% ^ - "cmake" ^ - "ninja" ^ - "nomkl" ^ - "pandas" ^ - "fsspec" ^ - "python=%PYTHON%" ^ - || exit /B -) +@rem Install pre-built "toolchain" packages for faster builds +set CONDA_PACKAGES=%CONDA_PACKAGES% --file=ci\conda_env_cpp.txt +@rem Arrow conda environment +mamba create -n arrow -q -y -c conda-forge ^ + --file=ci\conda_env_python.txt ^ + %CONDA_PACKAGES% ^ + "cmake" ^ + "ninja" ^ + "nomkl" ^ + "pandas" ^ + "fsspec" ^ + "python=%PYTHON%" ^ + || exit /B @rem @rem Configure compiler @rem -if "%GENERATOR%"=="Ninja" set need_vcvarsall=1 -if defined need_vcvarsall ( - if "%APPVEYOR_BUILD_WORKER_IMAGE%" NEQ "Visual Studio 2017" ( - @rem ARROW-14070 Visual Studio 2015 no longer supported - exit /B - ) - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 - set CC=cl.exe - set CXX=cl.exe -) +call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 +set CC=cl.exe +set CXX=cl.exe @rem @rem Use clcache for faster builds @@ -109,7 +97,7 @@ powershell.exe -Command "Start-Process clcache-server" || exit /B @rem Download Minio somewhere on PATH, for unit tests @rem if "%ARROW_S3%" == "ON" ( - appveyor DownloadFile https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -FileName C:\Windows\Minio.exe || exit /B + appveyor DownloadFile https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2022-05-26T05-48-41Z -FileName C:\Windows\Minio.exe || exit /B ) diff --git a/ci/conda_env_gandiva_win.txt b/ci/conda_env_gandiva_win.txt index 9098b53d1f53c..621b6f5a99d0d 100644 --- a/ci/conda_env_gandiva_win.txt +++ b/ci/conda_env_gandiva_win.txt @@ -15,6 +15,5 @@ # specific language governing permissions and limitations # under the License. -# llvmdev=9 or later require Visual Studio 2017 -clangdev=8 -llvmdev=8 +clangdev +llvmdev diff --git a/cpp/src/gandiva/gdv_function_stubs.cc b/cpp/src/gandiva/gdv_function_stubs.cc index 40fb656bd40b6..cf0f4f9b917c3 100644 --- a/cpp/src/gandiva/gdv_function_stubs.cc +++ b/cpp/src/gandiva/gdv_function_stubs.cc @@ -754,14 +754,13 @@ GANDIVA_EXPORT gdv_timestamp from_utc_timezone_timestamp(gdv_int64 context, gdv_timestamp time_miliseconds, const char* timezone, gdv_int32 length) { - using arrow_vendored::date::make_zoned; using arrow_vendored::date::sys_time; + using arrow_vendored::date::zoned_time; using std::chrono::milliseconds; - sys_time tp{milliseconds{time_miliseconds}}; - const auto utc_tz = make_zoned(std::string("Etc/UTC"), tp); + const sys_time tp{milliseconds{time_miliseconds}}; try { - const auto local_tz = make_zoned(std::string(timezone, length), utc_tz); + const zoned_time local_tz{std::string(timezone, length), tp}; gdv_timestamp offset = local_tz.get_time_zone()->get_info(tp).offset.count() * 1000; return time_miliseconds + static_cast(offset); } catch (...) { diff --git a/cpp/src/gandiva/precompiled/CMakeLists.txt b/cpp/src/gandiva/precompiled/CMakeLists.txt index 650b80f6bd9a4..fefabf883657a 100644 --- a/cpp/src/gandiva/precompiled/CMakeLists.txt +++ b/cpp/src/gandiva/precompiled/CMakeLists.txt @@ -31,10 +31,14 @@ set(PRECOMPILED_SRCS ../../arrow/util/basic_decimal.cc) if(MSVC) - # clang pretends to be a particular version of MSVC. 191[0-9] is - # Visual Studio 2017, and the standard library uses C++14 features, - # so we have to use that -std version to get the IR compilation to work - if(MSVC_VERSION MATCHES "^191[0-9]$") + # clang pretends to be a particular version of MSVC. Thestandard + # library uses C++14 features, so we have to use that -std version + # to get the IR compilation to work. + # See https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html + # for MSVC_VERSION and Visual Studio version. + if(MSVC_VERSION LESS 1930) + set(FMS_COMPATIBILITY 19.20) + elseif(MSVC_VERSION LESS 1920) set(FMS_COMPATIBILITY 19.10) else() message(FATAL_ERROR "Unsupported MSVC_VERSION=${MSVC_VERSION}")