歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux命令make報錯總結

Linux命令make報錯總結

日期:2017/2/28 16:00:51   编辑:Linux教程

Linux環境報錯原因、解決方法記錄(逐步總結)

1:/bin/sh: lex: command not found
make[1]: Leaving directory `/home/ksj/testCUnit/ltp-full-20081130/lib'
make[1]: Entering directory `/home/ksj/testCUnit/ltp-full-20081130/pan'
lex -l -w -t scan.l > scan.c
/bin/sh: lex: command not found
解決方法:下載flex apt-get install flex
http://www.gnu.org/software/flex/
或者在http://flex.sourceforge.net/ 上下載

2:
編譯一個linux下的c系統,包含詞法和語法分析模塊,Linux上用bison和flex。
  yacc是一個文法分析器的生成器,bison即是yacc的GNU版本.Lex和YACC是用於構造詞法分析機和語法解釋器的工具,利用Lex和YACC你可以輕松的構造一個語法解釋器。
  一開始make
  錯誤1:
  debian:/home/a/boa-0.94.13/src# make
  yacc -d boa_grammar.y
  make: yacc: Command not found
  make: *** [y.tab.c] Error 127
  解決方法:
  debian:/home/a/boa-0.94.13/src# apt-get install bison
  錯誤2:
  debian:/home/a/boa-0.94.13/src# make
  lex boa_lexer.l
  make: lex: Command not found
  make: *** [lex.yy.c] Error 127
  解決方法:
  debian:/home/a/boa-0.94.13/src# apt-get install flex
  錯誤3:
  debian:/home/a/sss/boa-0.94.13/src# make
  gcc -g -O2 -pipe -Wall -I. -c -o util.o util.c
  util.c:100:1: error: pasting "t" and "->" does not give a valid preprocessing token
  make: *** [util.o] Error 1
  解決方法:
  修改 src/compat.h
  找到
  #define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
  修改成
  #define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
  然後
  debian:/home/a/sss/boa-0.94.13/src# make clean
  debian:/home/a/sss/boa-0.94.13/src# make
  出現:
  debian:/home/a/sss/boa-0.94.13/src# make
  make: Nothing to be done for `all'.
  說明make沒有檢查到需要編譯的東西,庫或者應用程序已經編譯好了。
  make主要檢查的是時間戳,只要target比依賴的文件時間靠後它就認為不需要編譯。

Copyright © Linux教程網 All Rights Reserved