簡體   English   中英

在Windows上使用MinGW構建黃金鏈接器,FLEX / bison'YYSTYPE'未在此范圍內聲明

[英]Building gold linker with MinGW on Windows, FLEX/bison 'YYSTYPE' was not declared in this scope

我正在嘗試使用mingw構建GNU binutils中包含的黃金鏈接器。 我采取的步驟 -

  1. 使用安裝程序安裝所有包的mingw。
  2. 使用Windows安裝程序將Windows版本的FLEX安裝到默認位置。
  3. 從mingw shell中的gold鏈接器目錄中運行./configure,這似乎工作正常
  4. 運行make,這是我遇到一些錯誤的地方。

我已經將./configure的完整輸出包含在一個pastebin中: http//pastebin.com/1XLkZVVm

但重要的是這個:

make[2]: Entering directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
g++ -DHAVE_CONFIG_H -I.  -I. -I./../include -I./../elfcpp -DLOCALEDIR="\"/usr/lo
cal/share/locale\"" -DBINDIR="\"/usr/local/bin\"" -DTOOLBINDIR="\"/usr/local//bi
n\"" -DTOOLLIBDIR="\"/usr/local//lib\""   -W -Wall    -Wno-format -Werror -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=expression.o  -MT expression.
o -MD -MP -MF .deps/expression.Tpo -c -o expression.o expression.cc
In file included from expression.cc:33:0:
script-c.h:221:7: エラー: 'yylex' initialized and declared 'extern' [-Werror]
script-c.h:221:7: エラー: 'YYSTYPE' was not declared in this scope
script-c.h:221:15: エラー: expected primary-expression before ',' token
script-c.h:221:17: エラー: expected primary-expression before 'void'
script-c.h:221:30: エラー: expression list treated as compound expression in ini
tializer [-fpermissive]
cc1plus.exe: all warnings being treated as errors
make[2]: *** [expression.o] Error 1
make[2]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make: *** [all] Error 2

我查看了script-ch文件,它有這個功能:

/* Called by the bison parser skeleton to return the next token.  */

extern int
yylex(YYSTYPE*, void* closure);

但是YYSTYPE沒有在我能找到的任何地方定義。

我是新手使用mingw和msys所以我可能錯過了某些地方的某些步驟。 任何幫助建立這個將非常感激。

由於這個問題在幾個月內沒有得到答復,我調查了這個問題。

我下載了binutils-2.25(此時為最新版本),並嘗試按照您的操作。

我發現,如果你只是在沒有剩余binutils的情況下構建黃金,那么它就不會構建。 如果你執行./configure並在頂層make它會構建金幣。 如果你然后cd gold並執行./configuremake (雖然不必要),那么它也可以正常工作。

我確實發現,當它單獨使用黃金時,它比你的構建更進一步。

我還注意到你的短語FLEX到默認位置 使用FLEX的說明清楚地表明您不應該依賴於默認位置(可能是/Program Files/或類似),但必須使用不包含任何空格的路徑。 如果你沒有注意到這一點,那那就是你的錯。

作為最新版本,您可以通過確保在非空間路徑中正確安裝flex(和bison),然后下載2.25並構建整個binutils而不是單獨使用gold來獲得黃金。

我希望這種分析對於后來出現類似問題的人有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM