当我尝试编译脚本时,我收到错误:
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lecc
collect2:错误:ld返回1退出状态 make:*** [Makefile:9:sample]错误1
####################################
HEADERS = eccapi.h
default: sample
sample.o: sample.c $(HEADERS)
gcc -c sample.c -o sample.o
sample: sample.o
gcc sample.o -o sample -I./ -lecc
clean:
-rm -f sample.o
-rm -f sample
#
/*After Add libecc.a file in the lib folder of my compiler, I'm getting some other error, below are the error */
$ make
gcc -c sample.c -o sample.o
sample.c: In function ‘crypto_main’:
sample.c:173:13: warning: implicit declaration of function ‘emberSerialGuaranteedPrintf’ [-Wimplicit-function-declaration]
emberSerialGuaranteedPrintf(APP_SERIAL, "ZSE_ECCGenerateKey ERROR 0x%x\n",rc);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc sample.o -o sample -I./ -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../libecc.a whe n searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../libecc.a whe n searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libecc.a when searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libecc.a when searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../libecc.a whe n searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libecc.a when searching for -lecc
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../../i686-pc-cygwin/bin/ld: cannot find -lecc
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: sample] Error 1
答案 0 :(得分:2)
您告诉编译器链接“libecc.a”。您在编译器的“lib”文件夹中没有此库,或者您的编译器所在的路径中没有该库。尝试将-L添加到链接步骤或检查您的lib文件夹并确保您拥有该库。
<强> UPD 强>
另请注意error: ld returned 1 exit status
错误来自链接器。您可以检查所需的库ecc
是否已安装like this:
ldconfig -p | grep libecc