Question

I'm on Arch Linux x86_64, attempting to build the WebRTC libraries. I get compile errors when I do:

[ghilliard@diadem 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.

There appears to be a problem with link time optimization. However, I cannot figure out how to build WebRTC without LTO enabled. If I manually run the command that failed and append -fno-lto, it links fine. How can I add or change the compiler/linker flags within the gyp configuration so that it gets applied to everything?

Was it helpful?

Solution

ninja does not respect environment variables, but gyp does.

So after setting the LDFAGS environment variables, you have to run gyp_chromium to let the gyp generate correct ninja build file.

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

OTHER TIPS

You might try to set compiler/linker flags in environment variables before build:

export CFLAGS="${CFLAGS} -fno-lto"
export CXXFLAGS="${CXXFLAGS} -fno-lto"
export LDFLAGS="${LDFLAGS} -fno-lto"
ninja -C out/Release
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top