Ninja and "/usr/bin/ld: unrecognized option '--threads'" issue

1,030 views
Skip to first unread message

Jorge Lucangeli Obes

unread,
Nov 3, 2011, 2:39:35 PM11/3/11
to ninja...@googlegroups.com
Hi all,

I was trying to set up Ninja for building Chromium on Linux, and I'm
hitting that problem mentioned in the wiki page:

http://code.google.com/p/chromium/wiki/NinjaBuild#Troubleshooting

I've tried updating my version of gold, but that didn't fix it.

$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303

Any ideas?

Thanks,
Jorge

Evan Martin

unread,
Nov 3, 2011, 2:49:02 PM11/3/11
to ninja...@googlegroups.com
This is actually a gyp bug. The gyp ninja generator assumes you're
using gold compiled with threads support as the linker. (The gyp
Makefile generator attempts to detect whether you support it at
runtime.)

See http://code.google.com/p/chromium/wiki/NinjaBuild and search for "threads".

Jorge Lucangeli Obes

unread,
Nov 3, 2011, 2:57:34 PM11/3/11
to ninja...@googlegroups.com
On Thu, Nov 3, 2011 at 11:49 AM, Evan Martin <mar...@danga.com> wrote:
> This is actually a gyp bug.  The gyp ninja generator assumes you're
> using gold compiled with threads support as the linker.  (The gyp
> Makefile generator attempts to detect whether you support it at
> runtime.)
>
> See http://code.google.com/p/chromium/wiki/NinjaBuild and search for "threads".

So, the section that mentions "threads" in that wiki is the one I linked below:

>> http://code.google.com/p/chromium/wiki/NinjaBuild#Troubleshooting
>>
>> I've tried updating my version of gold, but that didn't fix it.
>>
>> $ ld -v
>> GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303

The solution from the wiki is to run ./build/install-build-deps.sh
(which I ran). That resulted in the gold version I show above, which
does not fix the problem.

Any ideas?
Thanks,
Jorge

Evan Martin

unread,
Nov 3, 2011, 3:36:10 PM11/3/11
to ninja...@googlegroups.com
On Thu, Nov 3, 2011 at 11:57 AM, Jorge Lucangeli Obes
<jor...@chromium.org> wrote:
>> See http://code.google.com/p/chromium/wiki/NinjaBuild and search for "threads".
>
> So, the section that mentions "threads" in that wiki is the one I linked below:

Sorry for my poor reading comprehension!

>>> I've tried updating my version of gold, but that didn't fix it.
>>>
>>> $ ld -v
>>> GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
>
> The solution from the wiki is to run ./build/install-build-deps.sh
> (which I ran). That resulted in the gold version I show above, which
> does not fix the problem.

Ah, you'll need to adjust your path such that the install-build-deps
build of gold is what you get when you run "ld". The instructions are
broken due to that script changing; you might bring it up on
chromium-dev.

Evan Martin

unread,
Nov 3, 2011, 3:36:35 PM11/3/11
to ninja...@googlegroups.com
On Thu, Nov 3, 2011 at 12:36 PM, Evan Martin <mar...@danga.com> wrote:
>>>> I've tried updating my version of gold, but that didn't fix it.
>>>>
>>>> $ ld -v
>>>> GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
>>
>> The solution from the wiki is to run ./build/install-build-deps.sh
>> (which I ran). That resulted in the gold version I show above, which
>> does not fix the problem.
>
> Ah, you'll need to adjust your path such that the install-build-deps
> build of gold is what you get when you run "ld".  The instructions are
> broken due to that script changing; you might bring it up on
> chromium-dev.

To be clear, the version output you pasted is *not* gold, it's the system ld.

Jorge Lucangeli Obes

unread,
Nov 3, 2011, 3:42:00 PM11/3/11
to ninja...@googlegroups.com

Yes, Craig Schlenter mentioned that in a private email. I ended up
installing binutils-gold with apt and that configured gold as 'ld'.

Thanks for the help!
Jorge

Evan Martin

unread,
Nov 3, 2011, 3:51:46 PM11/3/11
to ninja...@googlegroups.com
On Thu, Nov 3, 2011 at 12:42 PM, Jorge Lucangeli Obes
<jor...@chromium.org> wrote:
> Yes, Craig Schlenter mentioned that in a private email. I ended up
> installing binutils-gold with apt and that configured gold as 'ld'.

Be careful -- if you have nvidia drivers, when they upgrade they
attempt to recompile themselves and using gold to do so makes your
system unbootable. (Also, the Lucid version of gold doesn't work;
people filed bugs against Ubuntu but they don't seem interested in
fixing them...)

Jorge Lucangeli Obes

unread,
Nov 3, 2011, 4:33:58 PM11/3/11
to ninja...@googlegroups.com

OK, thanks for the heads-up =).

Reply all
Reply to author
Forward
0 new messages