wutingcindy / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

build.ninja uses seemingly invalid ld flags for cxx program #235

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

git clone git://github.com/springmeyer/hello-gyp.git
cd hello-gyp
gyp mylib.gyp --depth=. -f ninja
ninja -v -C out/Default/ -f build.ninja
# linking fails on 'ld: unknown option: --threads'

What is the expected output? What do you see instead?

I expect linking to work, but it fails. This apears to be because gyp generates 
the 'out/Default/build.ninja'
file with `ld = $cxx -Wl,--threads -Wl,--thread-count=4`

man ld on my system does not show any sign of those flags being valid, so I'm 
confused.

What version of the product are you using? On what operating system?

$ svn info
Path: .
URL: http://gyp.googlecode.com/svn/trunk
Repository Root: http://gyp.googlecode.com/svn
Repository UUID: 78cadc50-ecff-11dd-a971-7dbc132099af
Revision: 1086
Node Kind: directory
Schedule: normal
Last Changed Author: bradnelson@google.com
Last Changed Rev: 1086
Last Changed Date: 2011-11-06 21:39:32 -0800 (Sun, 06 Nov 2011)

Please provide any additional information below.

Original issue reported on code.google.com by d...@dbsgeo.com on 9 Nov 2011 at 8:15

GoogleCodeExporter commented 9 years ago
forgot to mention I am on OS X 10.7 which uses new llvm-gcc by default.

Original comment by d...@dbsgeo.com on 9 Nov 2011 at 8:16

GoogleCodeExporter commented 9 years ago
I get the same build problem on ubuntu karmic:

dane@haiti:~/projects/hello-gyp$ ninja -v -C out/Default/ -f build.ninja
[1/4] g++ -MMD -MF obj/src/mylib.implementation.o.d  -I../../include   -c 
../../src/implementation.cc -o obj/src/mylib.implementation.o
[2/4] rm -f obj/mylib.a && ar rcsT obj/mylib.a obj/src/mylib.implementation.o
[3/4] g++ -MMD -MF obj/bin/myapp.myapp.o.d  -I../../include   -c 
../../bin/myapp.cc -o obj/bin/myapp.myapp.o
[4/4] g++ -Wl,--threads -Wl,--thread-count=4  -o myapp -Wl,-rpath=\$ORIGIN/lib 
-Wl,--start-group obj/bin/myapp.myapp.o obj/mylib.a -Wl,--end-group -lz
FAILED: g++ -Wl,--threads -Wl,--thread-count=4  -o myapp 
-Wl,-rpath=\$ORIGIN/lib -Wl,--start-group obj/bin/myapp.myapp.o obj/mylib.a 
-Wl,--end-group -lz
/usr/bin/ld: unrecognized option '--threads'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Original comment by d...@dbsgeo.com on 9 Nov 2011 at 8:21

GoogleCodeExporter commented 9 years ago
gyp's ninja generator assumes gold. I'm working on changing that, for Mac at 
least.

Original comment by jere...@chromium.org on 29 Nov 2011 at 3:43

GoogleCodeExporter commented 9 years ago
ahh, its a gold linker flag, gocha. Let me know if I can help with testing.

Original comment by d...@dbsgeo.com on 29 Nov 2011 at 7:17

GoogleCodeExporter commented 9 years ago
The issue may not be Mac-specific. I encountered this issue on a Ubuntu 12.04 
LTS that was not used for Chromium development.

Original comment by rous...@chromium.org on 12 May 2014 at 8:39