shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
637 stars 129 forks source link

Fix static with old cmake #418

Closed shibatch closed 3 years ago

shibatch commented 3 years ago

This patch addresses issue https://github.com/shibatch/sleef/issues/417.

shibatch commented 3 years ago

@friendlyanon Could you check this patch?

shibatch commented 3 years ago

CMake version is 3.5.1.

[hourglass]~/work/sleef3/sleef-master/build$ cmake -DBUILD_SHARED_LIBS=FALSE ..
-- The C compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
-- Setting build type to 'Release' (required for full support).
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long double
-- Check size of long double - done
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE - Success
-- Performing Test COMPILER_SUPPORTS_FLOAT128
-- Performing Test COMPILER_SUPPORTS_FLOAT128 - Success
-- Performing Test COMPILER_SUPPORTS_SSE2
-- Performing Test COMPILER_SUPPORTS_SSE2 - Success
-- Performing Test COMPILER_SUPPORTS_SSE4
-- Performing Test COMPILER_SUPPORTS_SSE4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX
-- Performing Test COMPILER_SUPPORTS_AVX - Success
-- Performing Test COMPILER_SUPPORTS_FMA4
-- Performing Test COMPILER_SUPPORTS_FMA4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_AVX512F
-- Performing Test COMPILER_SUPPORTS_AVX512F - Success
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- Performing Test COMPILER_SUPPORTS_OPENMP
-- Performing Test COMPILER_SUPPORTS_OPENMP - Success
-- Performing Test COMPILER_SUPPORTS_OMP_SIMD
-- Performing Test COMPILER_SUPPORTS_OMP_SIMD - Success
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES - Success
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH - Success
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM
-- Performing Test COMPILER_SUPPORTS_SYS_GETRANDOM - Success
CMake Error at src/libm/CMakeLists.txt:1066 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "sleef".

CMake Error at src/libm/CMakeLists.txt:1096 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "sleef".

-- Configuring build for SLEEF-v3.6.0
   Target system: Linux-5.4.0-62-generic
   Target processor: x86_64
   Host system: Linux-5.4.0-62-generic
   Host processor: x86_64
   Detected C compiler: GNU @ /usr/bin/cc
   CMake: 3.5.1
   Make program: /usr/bin/make
-- Using option `-Wall -Wno-unused-function -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : FALSE
-- Building static test bins: OFF
-- MPFR : /usr/lib/x86_64-linux-gnu/libmpfr.so
-- MPFR header file in /usr/include
-- GMP : /usr/lib/x86_64-linux-gnu/libgmp.so
-- RT : /usr/lib/x86_64-linux-gnu/librt.so
-- FFTW3 : /usr/lib/x86_64-linux-gnu/libfftw3.so
-- OPENSSL : 1.1.1f
-- SDE : SDE_COMMAND-NOTFOUND
-- RUNNING_ON_TRAVIS :
-- COMPILER_SUPPORTS_OPENMP : 1
-- A version of SLEEF compatible  with libm and libmvec in GNU libc will be produced (sleefgnuabi.so)

*** Note: Parallel build is only supported with Ninja ***

-- Configuring incomplete, errors occurred!
See also "/import/humpback/home/n-sibata/work/sleef3/sleef-master/build/CMakeFiles/CMakeOutput.log".
friendlyanon commented 3 years ago

Hm, I have run a test:

#!/bin/sh -ex

for ver in `seq 18 -1 0`; do
  docker run \
    --rm \
    -e DEBIAN_FRONTEND=noninteractive \
    -e CXX=/host/usr/bin/c++ \
    -e CC=/host/usr/bin/cc \
    -v "/home/vagrant/code/sleef:/host/sleef:ro" \
    -v "/usr:/host/usr:ro" \
    --tty \
    "drdanz/cmake:cmake-3.$ver" \
    sh -c "mkdir build && cd build && cmake /host/sleef"
done

and it gets stuck at 3.13. It seems the documentation is wrong/incomplete around using NAMELINK_ONLY.

Please close this PR, as it doesn't really address the cause of the issue. I will investigate it and provide the fix.

shibatch commented 3 years ago

Closing PR at the request of @friendlyanon.