/usr/bin/x86_64-linux-gnu-ld: cannot find?

Viewed 6438

I study C language in ubuntu 18.04(gcc 7.3)

When the make all command is entered, this error occurrs:

/usr/bin/x86_64-linux-gnu-ld: can not find -lkeccak

The Makefile is as follows.

CC=gcc
CFLAGS=-03 -fomit-frame-pointer -msse2avx -mavx2 -march=native -std=c99

all:
    $(CC) $(CFLAGS) -c Lizard.c main.c randombytes.c sha512.c
    $(CC) $(CFLAGS) -o Lizard Lizard.o main.o randobytes.o sha512.o -lkeccak

run: all
    ./Lizard

new:
    make clean
    make all
    ./Lizard

Currently the libkeccak.a file is in the same directory as the Makefile and it is also in the /usr/include directory.

I do not know the solution method at all.

Please, Help me.

1 Answers

The -l option is for linking dynamic libraries (like libkeccak.so). Static libraries are linked into the executable already if they're in one of the "standard" directories, so there's no need to provide the option -lkeccak.

If you want to explicitly tell GCC to link a static library,

gcc -l:/path/to/libkeccak.a
Related