microsoft / APSI

APSI is a C++ library for Asymmetric (unlabeled or labeled) Private Set Intersection.
MIT License
186 stars 42 forks source link

arm64-android cross compilation error on x64-linux host #32

Closed LGro closed 2 years ago

LGro commented 2 years ago

To use APSI in an Android application, I'm trying to build it with vcpkg install apsi:arm64-android on an Arch Linux x64 machine but cmake fails with the output as given below.

Is setting APSI_FOURQ_ARM64_EXITCODE and APSI_FOURQ_ARM64_EXITCODE__TRYRUN_OUTPUT something I should do? From /vcpkg/buildtrees/apsi/arm64-android-dbg/TryRunResults.cmake:

# APSI_FOURQ_ARM64_EXITCODE
#    indicates whether the executable would have been able to run on its
#    target platform. If so, set APSI_FOURQ_ARM64_EXITCODE to
#    the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN".

/vcpkg/buildtrees/apsi/config-arm64-android-dbg-err.log

CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   APSI_FOURQ_ARM64_EXITCODE (advanced)
   APSI_FOURQ_ARM64_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see /vcpkg/buildtrees/apsi/arm64-android-dbg/TryRunResults.cmake
CMake Error at common/apsi/fourq/CMakeLists.txt:30 (add_subdirectory):
  add_subdirectory given source "arm64" which is not an existing directory.

/vcpkg/buildtrees/apsi/config-arm64-android-dbg-out.log

-- Build type (CMAKE_BUILD_TYPE): Debug
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- APSI debug mode: ON
-- APSI_USE_CXX17: ON
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Microsoft SEAL: found
-- Microsoft Kuku: found
-- Flatbuffers: found
-- flatc path: /vcpkg/installed/x64-linux/tools/flatbuffers/flatc
-- jsoncpp: found
-- log4cplus: found
-- ZeroMQ: found
-- cppzmq: found
-- FourQlib optimization: arch=ARM64
-- Looking for a ASM compiler
-- Looking for a ASM compiler - /usr/bin/cc
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- FourQlib optimization: asm=ON
-- Configuring incomplete, errors occurred!
kiromaru commented 2 years ago

Hello,

We have not tested cross-compiling APSI. I believe it should work, however, when you specify the appropriate cache variables. You would need to specify the variables that appear in the error messages when configuring the source code, setting them to a specific value that indicates success. For example:

-DAPSI_FOURQ_ARM64_EXITCODE=0
-DAPSI_FOURQ_ARM64_EXITCODE__TRYRUN_OUTPUT=''

The other error about "arm64" not being an existing directory has been fixed in the latest source code but has not been updated in the vcpkg port yet. If you are modifying the port file to add the previously mentioned settings, you can update it to get the latest version of the source code. You can use commit 8a0a5cce4f7a1cb2558f33d79ac26c65fb8ece84 for the latest version.

Hope this helps.

kiromaru commented 2 years ago

This should be fixed in the latest release, 0.8.2.