[英]gcc: error: unrecognized command line option '-Wl' in Makfile
I run the command " make test " in this source code: 我在此源代码中运行命令“ make test ”:
https://github.com/sanandrea/CSecretKey https://github.com/sanandrea/CSecretKey
but it give me this error : 但是它给了我这个错误 :
gcc: error: unrecognized command line option '-Wl'
Makefile:18: recipe for target 'lib_plain' failed
make: *** [lib_plain] Error 1
This is the line 18 in the makefile gcc -shared -Wl -o libhmacenc.so hmac_256_plain.o sha2.o -lc 这是makefile gcc -shared -Wl -o libhmacenc.so hmac_256_plain.o sha2.o -lc中的第18行
This is the list of the files: 这是文件列表:
This is the complete "makefile": 这是完整的“ makefile”:
all: lib test
test: clean lib_plain
gcc -o test test.c -lhmacenc -L.
production: clean lib
gcc -o test test.c -lhmacenc -L.
hmac_256.o: hmac_sha256.c hmac_sha256.h
$(CC) -Wall -c hmac_sha256.c -o hmac_256.o
hmac_256_plain.o: hmac_sha256.c hmac_sha256.h
$(CC) -Wall -DSHOW_PASS -c hmac_sha256.c -o hmac_256_plain.o
lib: hmac_256.o sha2.o
gcc -shared -Wl -o libhmacenc.so hmac_256.o sha2.o -lc
lib_plain: hmac_256_plain.o sha2.o
gcc -shared -Wl -o libhmacenc.so hmac_256_plain.o sha2.o -lc
sha2.o: sha2.c sha2.h
$(CC) -c sha2.c -o sha2.o
clean:
- rm -rf *.o hmac *.so
Someone would knows how I can fix this error? 有人会知道我该如何解决这个错误?
Thanks! 谢谢!
As suggested by @missimer, there is option field not specified in your makefile for linker option '-Wl'. 如@missimer所建议,在您的makefile中没有为链接器选项“ -Wl”指定选项字段。
Generally, for creating shared library, the following syntax is used with '-Wl': 通常,对于创建共享库,以下语法与'-Wl'一起使用:
gcc -shared -Wl,-export-dynamic
Hope this helps you. 希望这对您有所帮助。
There is another branch of the code that deals with Cygwin and has a different Makefile. 该代码的另一个分支处理Cygwin,并具有一个不同的Makefile。
https://github.com/sanandrea/CSecretKey/tree/cygwin https://github.com/sanandrea/CSecretKey/tree/cygwin
Always try to use a GNU-Linux environment to compile programs in pure C. Avoid Cygwin because their behavior is different in the Makefile. 始终尝试使用GNU-Linux环境在纯C语言中编译程序。避免使用Cygwin,因为它们的行为在Makefile中有所不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.