2015-10-13 81 views
-1

我運行命令在此源代碼「化妝測試」:GCC:錯誤:無法識別的命令行選項「輪候冊」在Makfile

https://github.com/sanandrea/CSecretKey

,但它給我這個錯誤

gcc: error: unrecognized command line option '-Wl' 
Makefile:18: recipe for target 'lib_plain' failed 
make: *** [lib_plain] Error 1 

這是線路18中生成文件 的gcc -shared -Wl -o libhmacenc.so hmac_256_plain.o sha2.o -lc

這是文件列表:

  • Android.mk
  • hmac_sha256.c
  • hmac_sha256.h
  • reverse_test.py
  • sha2.c
  • sha2.h
  • test.c

這是完整的「生成文件」:

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 

會有人知道我該如何解決這個問題?

謝謝!

+3

它看起來像'-Wl'被認爲是'-Wall',或者他們試圖將一個選項傳遞給鏈接器並忘記它是什麼。請參閱https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html – missimer

+1

是的,這只是一個破解的makefile。和(我沒有看過代碼),但我會認爲**非常仔細**關於使用這樣的「隨機」加密代碼。 –

+0

@EtanReisner「非常小心」是什麼意思?感謝您的回覆 – josemwarrior

回答

2

如@missimer所示,在makefile中沒有爲鏈接器選項'-Wl'指定選項字段。

一般情況下,用於創建共享庫,以下語法使用與「輪候冊」:

gcc -shared -Wl,-export-dynamic 

希望這有助於你。

相關問題