开发者

No rule to make target ... libm.a

I get the 开发者_运维知识库following error when I try to compile my app:

*** No rule to make target `/mypath/lib/libm.a', needed by `/myPath/bin/appName'

Why is the linker looking for libm.a according to an absolute path?


I start thinking of swithcing programming to psychic career...

Why is the linker looking for libm.a according to an absolute path?

Because you told him to do so. Most likely you've typed

# There were some rules that build your own .a libs
myLib.a: ...
   ...

# Handy rule to direct your libs into lib/ folder!
vpath %.a /mypath/lib

appName: appName.o libm.a
   g++ $^ -o $@

Whoops! You need "system" libm.a (that's a math library, a part of glibc), but make thinks that you need your own static library. It then adds the proper prefix and doesn't find any rule to remake libm.a.

A solution could be moving libm.a out of prerequisites. That's the purpose of configure script or a special make sanity target to check the existence of system libraries.

EXT_LIBS=libm.a

appName: appName.o
   g++ $^ $(EXT_LIBS) -o $@
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜