2014-05-13 40 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