1
votes

I am trying to compile this code for some time. Specifically, I am trying to compile the avx2 code using the given mac. However, I am always getting the following error. I have looked up a lot but unable to find a solution. I will be very glad if you help me to find a solution.

/usr/bin/ld: cannot find -lc

collect2: error: ld returned 1 exit status

make: *** [test/test_kyber] Error 1

gcc version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Clang version :

clang version 3.4.2 (tags/RELEASE_34/dot2-final)

Target: x86_64-redhat-linux-gnu

Thread model: posix

Output running the make command.

/usr/bin/gcc -Wall -Wextra -O3 -fomit-frame-pointer -msse2avx -mavx2 -march=native -static -o test/test_kyber kyber.c poly.c polyvec.c fips202.o fips202x4.c precomp.c ntt.c verify.c indcpa.c consts.c kex.c nttlevels0t4.s nttlevels5t7.s mul_coefficients.s polyvec_pointwise_acc.s poly_add.s poly_sub.s cbd.s poly_freeze.s crypto_stream_aes256ctr.c keccak4x/KeccakP-1600-times4-SIMD256.o randombytes.c test/test_kyber.c

/usr/bin/ld: cannot find -lc

collect2: error: ld returned 1 exit status

make: *** [test/test_kyber] Error 1

1
well, that's a make fail. scnr ... but to be serious, cannot find -lc sounds like a serious problem with your toolchain installation ... are you even able to compile anything on that machine? - user2371524
Usually, I use gcc. And it works all the time. - Rick
Ok, this is strange then ... can you give enough context of your output to show which command actually failed? - user2371524
Your image of text isn't very helpful. It can't be read aloud or copied into an editor, and it doesn't index very well, meaning that other users with the same problem are less likely to find the answer here. Please edit your post to incorporate the relevant text directly (preferably using copy+paste to avoid transcription errors). - Toby Speight
DO NOT POST LINKS. post the actual text as EDITS to your question. - user3629249

1 Answers

1
votes

thanks a lot for your help and time. I understood the problem. The makefile adds a -static flag, but on our office machines we don't have static libc.a. Hence, the error "cannot find -lc". I removed the static flag and it works fine for now. I think we don't need a static libc.a, but I will have to check more closely.