Skip to content

Commit

Permalink
CI: Fix Android failure (#50)
Browse files Browse the repository at this point in the history
* ci: upgrade image to ubuntu-22.04

* ci: temporary disable windows/osx jobs

* ci: provide ANDROID_NDK_HOME

* run debug mode to detect compiler

* [eigen3] sync port with microsoft/vcpkg

* disable fortran in android

* Revert "ci: temporary disable windows/osx jobs"

This reverts commit 6e45c10.

* ci: remove log report
  • Loading branch information
luncliff authored Jun 25, 2022
1 parent 3ad439d commit e1c1c2a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 15 deletions.
23 changes: 14 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ stages:
- job: "triplet_android"
displayName: "Android"
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-22.04
variables:
- name: vcpkg.overlay.triplets # VCPKG_OVERLAY_TRIPLETS
value: $(Build.SourcesDirectory)/triplets # --overlay-triplets $(Build.SourcesDirectory)/triplets
Expand Down Expand Up @@ -165,7 +165,7 @@ stages:
- job: "port_linux"
displayName: "Linux"
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-22.04
timeoutInMinutes: "300"
steps:
- powershell: sudo apt-get install -y libnuma-dev libopenmpi-dev nasm libx11-dev libx11-xcb-dev
Expand All @@ -191,19 +191,24 @@ stages:
- job: "port_android"
displayName: "Android"
pool:
vmImage: ubuntu-20.04
vmImage: ubuntu-22.04
strategy:
matrix:
arm64:
arm64_ndk24:
vcpkg.default.triplet: "arm64-android"
arm32:
android.ndk.home: "/usr/local/lib/android/sdk/ndk/24.0.8215888"
arm32_ndk21:
vcpkg.default.triplet: "arm-android"
x64:
android.ndk.home: "/usr/local/lib/android/sdk/ndk/21.4.7075529"
x64_ndk24:
vcpkg.default.triplet: "x64-android"
variables:
- name: ANDROID_NDK_HOME
value: "/usr/local/lib/android/sdk/ndk/24.0.8215888" # see ANDROID_NDK_LATEST_HOME of the image
android.ndk.home: "/usr/local/lib/android/sdk/ndk/24.0.8215888"
steps:
- task: run-vcpkg@0
displayName: "Detect Compiler"
inputs:
vcpkgArguments: "eigen3 --debug"
vcpkgGitCommitId: $(vcpkg.commit)
- task: run-vcpkg@0
displayName: "Default Triplet"
inputs:
Expand Down
26 changes: 26 additions & 0 deletions ports/eigen3/fix-vectorized-reductions-half.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/Eigen/src/Core/PartialReduxEvaluator.h b/Eigen/src/Core/PartialReduxEvaluator.h
index 29abf35..4051fcf 100644
--- a/Eigen/src/Core/PartialReduxEvaluator.h
+++ b/Eigen/src/Core/PartialReduxEvaluator.h
@@ -54,12 +54,19 @@ struct packetwise_redux_traits
/* Value to be returned when size==0 , by default let's return 0 */
template<typename PacketType,typename Func>
EIGEN_DEVICE_FUNC
-PacketType packetwise_redux_empty_value(const Func& ) { return pset1<PacketType>(0); }
+PacketType packetwise_redux_empty_value(const Func& ) {
+ const typename unpacket_traits<PacketType>::type zero(0);
+ return pset1<PacketType>(zero);
+}
+

/* For products the default is 1 */
template<typename PacketType,typename Scalar>
EIGEN_DEVICE_FUNC
-PacketType packetwise_redux_empty_value(const scalar_product_op<Scalar,Scalar>& ) { return pset1<PacketType>(1); }
+PacketType packetwise_redux_empty_value(const scalar_product_op<Scalar,Scalar>& ) {
+ return pset1<PacketType>(Scalar(1));
+}
+

/* Perform the actual reduction */
template<typename Func, typename Evaluator,
21 changes: 17 additions & 4 deletions ports/eigen3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,37 @@ vcpkg_from_gitlab(
REPO libeigen/eigen
REF 3.4.0
SHA512 ba75ecb760e32acf4ceaf27115468e65d4f77c44f8d519b5a13e7940af2c03a304ad433368cb6d55431f307c5c39e2666ab41d34442db3cf441638e51f5c3b6a
HEAD_REF master
PATCHES
remove_configure_checks.patch # This removes unnecessary configure checks. Eigen3 just installs headers not anything more.
fix-vectorized-reductions-half.patch # Remove this patch in the next update
)

if(VCPKG_TARGET_IS_ANDROID)
list(APPEND PLATFORM_OPTIONS -DCMAKE_Fortran_COMPILER=OFF)
endif()

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_TESTING=OFF
-DEIGEN_BUILD_PKGCONFIG=ON
${PLATFORM_OPTIONS}
OPTIONS_RELEASE
-DCMAKEPACKAGE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/share/eigen3
-DPKGCONFIG_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/lib/pkgconfig
OPTIONS_DEBUG
-DCMAKEPACKAGE_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/share/eigen3
-DPKGCONFIG_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH share/${PORT})
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
file(GLOB INCLUDES "${CURRENT_PACKAGES_DIR}/include/eigen3/*")
# Copy the eigen header files to conventional location for user-wide MSBuild integration
file(COPY ${INCLUDES} DESTINATION "${CURRENT_PACKAGES_DIR}/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")

file(INSTALL ${SOURCE_PATH}/COPYING.README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING.README" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
37 changes: 37 additions & 0 deletions ports/eigen3/remove_configure_checks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3e69b845..12fb2188d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,12 +66,14 @@ option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tens


macro(ei_add_cxx_compiler_flag FLAG)
+ if(FALSE) # Since eigen3 is header only and vcpkg does not build tests this can be disabled by default.
string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})
string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})
check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})
if(COMPILER_SUPPORT_${SFLAG})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
endif()
+ endif()
endmacro()

check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)
@@ -142,7 +144,7 @@ endif()

set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320")

-if(NOT MSVC)
+if(NOT MSVC AND FALSE)
# We assume that other compilers are partly compatible with GNUCC

# clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag
@@ -330,7 +332,7 @@ if(NOT MSVC)
endif()
endif()

-else()
+elseif(FALSE)

# C4127 - conditional expression is constant
# C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively)
4 changes: 3 additions & 1 deletion ports/eigen3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "eigen3",
"version-string": "3.4.0",
"version": "3.4.0",
"port-version": 2,
"description": "C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.",
"homepage": "http://eigen.tuxfamily.org",
"license": "MPL-2.0",
"dependencies": [
{
"name": "vcpkg-cmake",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"eigen3": {
"baseline": "3.4.0",
"port-version": 0
"port-version": 2
},
"farmhash": {
"baseline": "2021-10-28",
Expand Down
5 changes: 5 additions & 0 deletions versions/e-/eigen3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c9f4e629ff1f523399faa7adbd5ece366649465c",
"version": "3.4.0",
"port-version": 2
},
{
"git-tree": "95034c0a717759172968eff19cfae76a020e25de",
"version-string": "3.4.0",
Expand Down

0 comments on commit e1c1c2a

Please sign in to comment.