②Makefile

版权声明:转载请声明~ https://blog.csdn.net/weixin_38890593/article/details/82746533

在编译项目功能模块的时候遇到的問題:
在httpd目錄中直接make httpd會報錯:

[ll@team2 httpd]$ make httpd
错误信息:
Makefile:14: /.config: No such file or directory
cc -I. -I/shared -I/include -Wall -I/ -I../tmobile -s -O2 -M httpd.c > .httpd.depend
httpd.c:69:21: fatal error: cy_conf.h: No such file or directory
compilation terminated.

由錯誤信息可知:找不到.config這個文件,
查看httpd/Makefile的第14行:include $(TOP)/.config

明顯問題出在$(TOP)
    追蹤TOP变量可在router目錄的Makefile查到:

export TOP := $(shell pwd)
export SRCBASE := $(shell (cd $(TOP)/.. && pwd -P))

也就是说TOP使用了pwd这条命令,相当于为.config指定了路径
出差原因是: 在httptd目录中找不到.config,因为.config是上一級目錄router的文件,所以出錯!

在httpd的上一级目錄中make則不會出錯
    [ll@team2 router]$ make httpd 2>&1 | tee httpd.log 
    結果,順利編譯通過!
注意:凡是錯誤先看第一條error,因為下面的error有可能是第一個造成的連鎖error
同样的错误可能有不同的原因导致,仅供参考!重要的是自己学会排查错误的方法!

注:
0 表示stdin标准输入
1 表示stdout标准输出
2 表示stderr标准错误
2>&1相当于把标准错误重定向到标准输出,即是出错后错误讯息输出到屏幕
tee httpd.log,就是将编译产生的信息记录到httpd.log文件里面

猜你喜欢

转载自blog.csdn.net/weixin_38890593/article/details/82746533