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

倾然丶 夕夏残阳落幕 提交于 2019-12-13 02:20:46

问题


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:


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


来源:https://stackoverflow.com/questions/52397191/usr-bin-x86-64-linux-gnu-ld-cannot-find

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!