How to link lldb on i386


Lately, I haven’t been able to link lldb because it uses too much memory:

/usr/bin/ld: final link failed: Memory exhausted

As reported here:

(yes, I use shared libraries)

Any workaround?

PS: please cc me !

Don't generate debug info would be one that comes to mind. The other is to cross build for i386 on a 64 bit machine.


cross building on a 64-bit machine using a 64-bit toolchain is what we have to do on Windows.

Is it only lldb-server you are having problems with? (i.e., are you
able to link

If so, then you might be able to make it link by reducing the number
of things that go into it. Right now lldb-server uses only a fraction
of its linker input, but we still need to pass in everything (and rely
on linker garbage collection to make sense of it) because it is not
possible to make a clear cut. This has several problems, most
important being that it is very easy to drastically increase the size
of the executable by random code perturbations. Being able to remove
all of clang from linker inputs would be a massive improvement, and it
would solve your problem as well. However, it is not going to be


We hit similar problems in the past when building with debug info
enabled; using -gsplit-dwarf helped us.

I had similar problems on NetBSD/amd64 - using standalone builds helped
me. I'm building and installing LLVM, Clang and LLDB separately. It may
help on i386.

Also there might be a problem with using too many jobs. Try to build
with -j1.