I'm trying to build Swift 3 on FreeBSD. The last thing I need to do is run the build-script.

My problem is that at some point the script runs:

Linking CXX executable bin/llvm-lto

Which consistently kills my system by using all of its 16GB memory (1GB real + 15GB swap)

After doing some research, it seems that ld consumes ludicrous amounts of memory when in (default) debug mode.

According to the man page it can be disabled by using:

ld --strip-debug

How would I go about enabling that option, given that I'm never actually running the command?

  • What build system are you using? A GNU autotools-made Makefile, or CMake or similar? On can usually set the environment variable LDFLAGS to --strip-debug, but this is done differently in different make systems. – Kusalananda May 6 '17 at 22:29
  • I believe it is CMake (specifically ninja.) Also, prior to the problem, the messages: 'ninja: no work to do', and 'llvm: using gold linker' appear. '/usr/local/bin/cmake' then runs 'linking cxx executable bin/llvm-lto'. – Brandon Bradley May 6 '17 at 22:36
  • @BrandonBradley did you ever find a workaround or fix for this? I used Kusalananda's method, which allowed me to link bin/llvm-lto, however it then choked on linking bin/bugpoint – 410 gone Oct 25 '17 at 12:00
  • @EnergyNumbers Nope. If anyone has, it would still be greatly appreciated. – Brandon Bradley Nov 30 '17 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.