歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu下編譯insight錯誤解決

Ubuntu下編譯insight錯誤解決

日期:2017/2/28 16:32:42   编辑:Linux教程

Ubuntu下編譯insight錯誤:

cc1: warnings being treated as errors
.././gdb/cli/cli-cmds.c: In function ‘pwd_command’:
.././gdb/cli/cli-cmds.c:323: error: ignoring return value of ‘getcwd’, declared with attribute warn_unused_result
make[2]: *** [cli-cmds.o] 錯誤 1
make[2]:正在離開目錄 `/home/qiang/tools/insight-6.8-1/gdb'
make[1]: *** [all-gdb] 錯誤 2
make[1]:正在離開目錄 `/home/qiang/tools/insight-6.8-1'
make: *** [all] 錯誤 2

解決方案:

方法1.修改源代碼,
linux-nat.c:2879:error:ignoring return value of 'fgets',declared with attribute warn_unused_result

老代碼
fgets(buffer, MAXPATHLEN, procfile);
解決的方法是
char* temp_p = fgets(buffer, MAXPATHLEN, procfile);

類似的問題還有幾個,基本上都是gdb的問題,照著解決就行了,我就不一個個說了。

方法2.進入insight-6.8-1/gdb目錄,打開Makefile文件搜索-Werror
老代碼
WERROR_CFLAGS = -Werror
新代碼
WERROR_CFLAGS = #-Werror

這2個辦法都可以通過編譯,就可以使用insight了。

Copyright © Linux教程網 All Rights Reserved