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

Error when running cd kyber/ref && make shared #52

Open
GianDragon opened this issue Apr 4, 2023 · 1 comment
Open

Error when running cd kyber/ref && make shared #52

GianDragon opened this issue Apr 4, 2023 · 1 comment

Comments

@GianDragon
Copy link

GianDragon commented Apr 4, 2023

When I am running the follow command: cd kyber/ref && make shared, I got this message:

cc -shared -fPIC -I/usr/local/opt/[email protected]/include -Wall -Wextra -Wpedantic -Wmissing-prototypes -Wredundant-decls -Wshadow -Wpointer-arith -O3 -fomit-frame-pointer -DKYBER_K=2 kex.c kem.c indcpa.c polyvec.c poly.c ntt.c cbd.c reduce.c verify.c symmetric-shake.c -o libpqcrystals_kyber512_ref.so
Undefined symbols for architecture x86_64:
  "_pqcrystals_kyber_fips202_ref_sha3_256", referenced from:
      _pqcrystals_kyber512_ref_keypair in kem-9bb932.o
      _pqcrystals_kyber512_ref_enc in kem-9bb932.o
      _pqcrystals_kyber512_ref_dec in kem-9bb932.o
  "_pqcrystals_kyber_fips202_ref_sha3_512", referenced from:
      _pqcrystals_kyber512_ref_enc in kem-9bb932.o
      _pqcrystals_kyber512_ref_dec in kem-9bb932.o
      _pqcrystals_kyber512_ref_indcpa_keypair in indcpa-c434fa.o
  "_pqcrystals_kyber_fips202_ref_shake128_absorb_once", referenced from:
      _pqcrystals_kyber512_ref_kyber_shake128_absorb in symmetric-shake-9d277b.o
  "_pqcrystals_kyber_fips202_ref_shake128_squeezeblocks", referenced from:
      _pqcrystals_kyber512_ref_gen_matrix in indcpa-c434fa.o
  "_pqcrystals_kyber_fips202_ref_shake256", referenced from:
      _kex_uake_sharedB in kex-3b6c2e.o
      _kex_uake_sharedA in kex-3b6c2e.o
      _kex_ake_sharedB in kex-3b6c2e.o
      _kex_ake_sharedA in kex-3b6c2e.o
      _pqcrystals_kyber512_ref_enc in kem-9bb932.o
      _pqcrystals_kyber512_ref_dec in kem-9bb932.o
      _pqcrystals_kyber512_ref_kyber_shake256_prf in symmetric-shake-9d277b.o
      ...
  "_randombytes", referenced from:
      _pqcrystals_kyber512_ref_keypair in kem-9bb932.o
      _pqcrystals_kyber512_ref_enc in kem-9bb932.o
      _pqcrystals_kyber512_ref_indcpa_keypair in indcpa-c434fa.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libpqcrystals_kyber512_ref.so] Error 1

I installed openSSL (I am on MacOS) and exported this flags:

export CFLAGS="-I/usr/local/opt/[email protected]/include"
export NISTFLAGS="-I/usr/local/opt/[email protected]/include"
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"

What's the issue?

Thanks

@GianDragon GianDragon changed the title Error when running cd kyber/ref && Make Error when running cd kyber/ref && Make shared Apr 4, 2023
@GianDragon GianDragon changed the title Error when running cd kyber/ref && Make shared Error when running cd kyber/ref && make shared Apr 4, 2023
@KursatCAKAL
Copy link

KursatCAKAL commented Jun 11, 2023

Hi,

I had same issue. If you installed openssl by using homebrew. You can use following FLAGS:

export CFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export NISTFLAGS="-I/opt/homebrew/opt/[email protected]/include"
export LDFLAGS="-I/opt/homebrew/opt/[email protected]/lib"

These flags can help you but not to me. I have another issue after specified flags correctly.

pcs@pcs-MacBook-Air avx2 % make
cc -I/opt/homebrew/opt/[email protected]/include -Wall -Wextra -Wpedantic -Wmissing-prototypes -Wredundant-decls -Wshadow -Wpointer-arith -mavx2 -mbmi2 -mpopcnt -maes -march=native -mtune=native -O3 -fomit-frame-pointer -c keccak4x/KeccakP-1600-times4-SIMD256.c -o keccak4x/KeccakP-1600-times4-SIMD256.o
clang: warning: argument unused during compilation: '-mavx2' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-mbmi2' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-mpopcnt' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-maes' [-Wunused-command-line-argument]
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/tmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/tmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/pmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/pmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/emmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/pmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/emmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
In file included from keccak4x/KeccakP-1600-times4-SIMD256.c:19:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/smmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/tmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/pmmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/emmintrin.h:17:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/xmmintrin.h:17:
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
^
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:54:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:133:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:163:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:193:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:220:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:243:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:264:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:291:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:314:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:335:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:356:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:377:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.3/include/mmintrin.h:398:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

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

No branches or pull requests

2 participants