homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.14k stars 765 forks source link

cmake && make on macOS immediately fails #363

Closed thomergil closed 4 years ago

thomergil commented 4 years ago

Your Contact: Your environment (OS/HW): macOS Catalina 10.15.5

Detailed Description: Running cmake and then make fails:


thomer@crisis:~/src/HElib/build $ cmake -DPACKAGE_BUILD=ON ..
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/thomer/src/HElib/build
thomer@crisis:~/src/HElib/build $ make
[  0%] Built target setup_install_dir
[  4%] Performing configure step for 'gmp_fetched'
configure: loading cache config.cache
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=64
checking whether /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc is gcc... yes
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O2 -pedantic -fomit-frame-pointer -m64 ... no, gnupro alpha ev6 char spilling
checking ABI=x32
checking whether /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc is gcc... yes
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O2 -pedantic -fomit-frame-pointer -mx32 ... no, gnupro alpha ev6 char spilling
checking ABI=32
checking whether /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc is gcc... yes
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -m32 -O2 -pedantic -fomit-frame-pointer ... no, program does not run
checking compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O2 -pedantic -fomit-frame-pointer ... no, gnupro alpha ev6 char spilling
configure: error: could not find a working compiler, see config.log for details
make[2]: *** [dependencies/Stamp/gmp_fetched/gmp_fetched-configure] Error 1
make[1]: *** [dependencies/gmp/CMakeFiles/gmp_fetched.dir/all] Error 2
make: *** [all] Error 2

thomer@crisis:~/src/HElib/build $ brew list
adns            emacs           gnupg           lame            libogg          lua         pam_reattach        shared-mime-info    vim
aom         exiftool        gnutls          leptonica       libomp          lzo         pcre            snappy          w3m
arping          ffmpeg          go          libass          libpng          mono            pcre2           speex           watch
autoconf        flac            gpgme           libassuan       libpq           mpfr            perl            sqlite          watchman
automake        fontconfig      gradle          libbluray       libsamplerate       ncurses         pinentry        srt         webp
bat         freetype        graphite2       libde265        libsndfile      nettle          pixman          sshfs           wget
bdw-gc          frei0r          harfbuzz        libevent        libsoxr         node            pkg-config      sslscan         woff2
bfg         fribidi         httpie          libffi          libtasn1        notmuch         portaudio       swaks           x264
brotli          gcc         icu4c           libgcrypt       libtiff         npth            python          talloc          x265
cairo           gdbm            ilmbase         libgpg-error        libtool         nvm         python@3.8      tcping          xapian
cmake           gettext         imagemagick     libheif         libunistring        opencore-amr        qpdf            telnet          xmlto
cocoapods       ghostscript     imgcat          libidn          libusb          openexr         rav1e           tesseract       xvid
coreutils       giflib          ios-deploy      libidn2         libvidstab      openjdk         readline        theora          xz
dav1d           git         ipcalc          libksba         libvorbis       openjpeg        rpl         tmux            yarn
dep         glib            isl         liblqr          libvpx          openssl         rtmpdump        tokyo-cabinet       yuicompressor
dict            gmime           jpeg            libmaa          libyaml         openssl@1.1     rubberband      unbound         zlib
docbook         gmp         jsonpp          libmpc          little-cms2     opus            ruby            unison          zsh
docbook-xsl     gnu-getopt      krb5            libnet          lmdb            p11-kit         sdl2            utf8proc```
XuesongHu commented 4 years ago

I found out that if you comment out two places where configure, you can fix it.

  1. dependencies/gmp/CMakeLists.txt, comment out lines 27 and 28
  2. dependencies/ntl/CMakeLists.txt, comment out line 64
XuesongHu commented 4 years ago

checkout PR #359

faberga commented 4 years ago

Hi @thomergil and @XuesongHu We have investigated the issue reported and found that it is caused by an idiosyncrasy introduced in macOS >= 10.14.x where Command Line Tools package installs the macOS system headers inside the macOS SDK itself. CMake correctly identifies CC and CXX and the location of the header files which it passes to the compilation it controls. But, as GMP and NTL run their own "configure", passing CC and CCX is not enough it also requires -isysroot flag as additional CFLAGS options. This is a bug that we will be fixing.

The easiest workarounds when building HElib package on macOS >= 10.14.x is to invoke cmake with the the options -DCMAKE_CXX_COMPILER=/usr/bin/c++ and -DCMAKE_C_COMPILER=/usr/bin/cc

cmake -DCMAKE_CXX_COMPILER=/usr/bin/c++ -DCMAKE_C_COMPILER=/usr/bin/cc -DPACKAGE_BUILD=ON ..

We will issue a bug fix for issue #363 shortly.

faberga commented 4 years ago

Hi @thomergil, can you confirm that the workaround suggested worked for you, pls?

Thank you. -Flavio

hamishun commented 4 years ago

This issue has been resolved in the new versions of HElib so the workaround should no longer be required.