Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current master - McEliece AVX2 is broken #940

Closed
mouse07410 opened this issue Mar 12, 2021 · 3 comments · Fixed by #945
Closed

Current master - McEliece AVX2 is broken #940

mouse07410 opened this issue Mar 12, 2021 · 3 comments · Fixed by #945

Comments

@mouse07410
Copy link

MacOS 10.15.7, Xcode-12.4, current master.

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ur20980/src/liboqs/build
[1272/2236] Building ASM object src/kem/classic_mceliece/CMakeFile...ic_mceliece_8192128_avx.dir/pqclean_mceliece8192128_avx/consts.S.
FAILED: src/kem/classic_mceliece/CMakeFiles/classic_mceliece_8192128_avx.dir/pqclean_mceliece8192128_avx/consts.S.o 
/opt/local/bin/clang  -Iinclude -I../src/kem/classic_mceliece/pqclean_mceliece8192128_avx -I../src/common/pqclean_shims -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -fPIC -Werror -Wall -Wextra -Wpedantic -Wno-unused-command-line-argument -O3 -fomit-frame-pointer -mavx2 -mpopcnt -Wno-language-extension-token -MD -MT src/kem/classic_mceliece/CMakeFiles/classic_mceliece_8192128_avx.dir/pqclean_mceliece8192128_avx/consts.S.o -MF src/kem/classic_mceliece/CMakeFiles/classic_mceliece_8192128_avx.dir/pqclean_mceliece8192128_avx/consts.S.o.d -o src/kem/classic_mceliece/CMakeFiles/classic_mceliece_8192128_avx.dir/pqclean_mceliece8192128_avx/consts.S.o -c ../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:19:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK0_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:20:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK0_1
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:21:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK1_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:22:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK1_1
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:23:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK2_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:24:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK2_1
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:25:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK3_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:26:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK3_1
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:27:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK4_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:28:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK4_1
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:29:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK5_0
^
../src/kem/classic_mceliece/pqclean_mceliece8192128_avx/consts.S:30:1: error: unknown directive
.hidden PQCLEAN_MCELIECE8192128_AVX_MASK5_1
^
[1293/2236] Building C object src/kem/sike/CMakeFiles/sike.dir/external/P610/P610_compressed.c.o
ninja: build stopped: subcommand failed.

How do I configure the build to exclude algorithms?

@dstebila
Copy link
Member

Weird.

To disable it temporarily, you can use cmake -DOQS_ENABLE_KEM_CLASSIC_MCELIECE=OFF as per https://github.com/open-quantum-safe/liboqs/wiki/Customizing-liboqs.

@jschanck Any idea what might have gone wrong in #932?

@mouse07410
Copy link
Author

To disable it temporarily, you can use cmake -DOQS_ENABLE_KEM_CLASSIC_MCELIECE=OFF

Thank you! As I don't really need McEliece, this will work for me.

Also, when I add to src/kem/classic_mceliece/CMakeLists.txt file the following code (to attempt compiling .S files with YASM instead of Clang):

# Locate YASM executable first
find_program(YASM_EXE NAMES yasm)
if(YASM_EXE_NOTFOUND)
   message("YASM executable NOT found!")
   message("YASM_EXE value is ${YASM_EXE}")
   message(FATAL_ERROR "Cannot compile AES-NI assembly code without YASM - aborting...")
else(YASM_EXE_NOTFOUND)
   message("-- Found Yasm executable at ${YASM_EXE}")
   set(CMAKE_ASM_COMPILER ${YASM_EXE})
endif(YASM_EXE_NOTFOUND)

set(CMAKE_ASM_COMPILER "${YASM_EXE}")
message("-- Setting CMAKE_ASM_COMPILER for McEliece to ${YASM_EXE} for ${ARCH} build")
enable_language(ASM)

# YASM flags for Linux and MacOS differ - accommodate for that
if (APPLE)
   set(ASM_OPTIONS "-m amd64 -f macho${ARCH_BITS} -p gas -X gnu")
else (APPLE)       
   set(ASM_OPTIONS "-D__linux__ -m amd64 -f elf${ARCH_BITS} -p gas -X gnu -g dwarf2")
endif (APPLE)
set(CMAKE_ASM_FLAGS "${ASM_OPTIONS}")

the following command gets into infinite loop with the following repeating output:

env RUN_TESTS_PARALLEL_UPPER=FALSE cmake -GNinja .. -DOQS_USE_OPENSSL=ON -DOQS_USE_CPU_EXTENSIONS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/opt/local -DOQS_KEM_DEFAULT="OQS_KEM_alg_ntru_hps4096821" -DOQS_SIG_DEFAULT="OQS_SIG_alg_falcon_1024" -DCMAKE_BUILD_TYPE=Release

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /opt/local/bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Yasm executable at /opt/local/bin/yasm
-- Setting CMAKE_ASM_COMPILER for McEliece to /opt/local/bin/yasm for  build
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /opt/local/lib/libcrypto.dylib (found suitable version "1.1.1j", minimum required is "1.1.1")  
-- Looking for OPENSSL_NO_EC2M
-- Looking for OPENSSL_NO_EC2M - not found
-- Found Doxygen: /opt/local/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_ASM_COMPILER= /opt/local/bin/clang

.  .  .  .  .

In short, McEliece and it's CMakeLists.txt appear to be screwed up.

@jschanck
Copy link
Contributor

This is fixed by PQClean/PQClean@6f22c50. It will trickle down to liboqs when we pull the latest PQClean for #937.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants