2014-05-13 75 views
3

我在Arch Linux x86_64上嘗試構建WebRTC庫。當我遇到編譯錯誤時:構建Chromium,無LTO的WebRTC

[[email protected] trunk]$ ninja -C out/Release peerconnection_server 
ninja: Entering directory `out/Release' 
[1/1] LINK peerconnection_server 
FAILED: c++ -Wl,-z,now -Wl,-z,relro -Wl,--fatal-warnings -pthread -Wl,-z,noexecstack -fPIC -B/home/ghilliard/Code/webrtc-attempt2/trunk/third_party/binutils/Linux_x64/Release/bin -Wl,--disable-new-dtags -m64 -Wl,--icf=none -fuse-ld=gold -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -o peerconnection_server -Wl,--start-group obj/talk/examples/peerconnection/server/peerconnection_server.data_socket.o obj/talk/examples/peerconnection/server/peerconnection_server.main.o obj/talk/examples/peerconnection/server/peerconnection_server.peer_channel.o obj/talk/examples/peerconnection/server/peerconnection_server.utils.o obj/talk/libjingle.a obj/net/third_party/nss/libcrssl.a obj/third_party/jsoncpp/libjsoncpp.a -Wl,--end-group -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -ldl -lcrypto -lrt -lXext -lX11 -lXcomposite -lXrender -lexpat 
/home/ghilliard/Code/webrtc-attempt2/trunk/third_party/binutils/Linux_x64/Release/bin/ld.gold: -plugin: unknown option 
/home/ghilliard/Code/webrtc-attempt2/trunk/third_party/binutils/Linux_x64/Release/bin/ld.gold: use the --help option for usage information 
collect2: error: ld returned 1 exit status 
ninja: build stopped: subcommand failed. 

鏈接時間優化似乎存在問題。但是,我無法弄清楚如何在未啓用LTO的情況下構建WebRTC。如果我手動運行失敗的命令並追加-fno-lto,它鏈接正常。如何在gyp配置中添加或更改編譯器/鏈接器標誌,以便將其應用於所有內容?

回答

2

忍者不尊重的環境變量,但GYP一樣。

所以在設置LDFAGS環境變量之後,必須運行gyp_chromium讓gyp生成正確的ninja構建文件。

export LDFLAGS='-fno-lto' build/gyp_chromium ninja -C out/Release peerconnection_server

+0

我現在有其他的構建錯誤(我也許應該弄清楚如何檢查出的WebRTC的穩定版本),但這似乎已經解決了連接器的牢騷。謝謝! – thirtythreeforty

0

您可能會嘗試構建之前設置的編譯器/連接器選項中的環境變量:

export CFLAGS="${CFLAGS} -fno-lto" 
export CXXFLAGS="${CXXFLAGS} -fno-lto" 
export LDFLAGS="${LDFLAGS} -fno-lto" 
ninja -C out/Release