servo: Unable to build Servo on a Mac with Xcode 10 (crash / freeze)

I’ve recently noticed(in the last week) that it has become impossible to do a successful ./mach build -d -p servo on a machine with 4GB of RAM.

At the dsymutil stage of the build, memory usage skyrockets, the UI becomes unresponsive, and finally the machine reboots…

For the past two years, it was always quite slow, however with enough patience it was possible. dsymutil was always the most memory-consuming part, yet it would build-up slowly instead of skyrocketing like it seems to be doing now.

My machine is probably coming towards the end of it’s lifetime, so this might be a temporary problem for me personally, however, I am wondering if we’re not setting the bar too high for new contributors in terms of machine specs? A slow build is one thing, an impossible one is quite another…

I’m also wondering what caused this sudden change in behavior of the build? Could this be prevented with a flag of some sorts? I remember a while back I had a problem of too much memory usage with dsymutil(although not to the point of reboot) because both libsimpleservo and libservo would build, and using the -p servo flag solved that.

Could be related to https://github.com/servo/servo/issues/21745

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 38 (35 by maintainers)

Commits related to this issue

Most upvoted comments

tl;dr: The reason why the linker can’t find lstd++ is because Apple no longer places the /usr/include directory when installing XCode 10 and CLI tools. You need to run the package in /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg after installing the command line tools with xcode-select --install.

I was experiencing the issue noted by @Walther here as well as here and was unsatisfied by the ‘install xcode 9’ solution. I experienced the linking issue on 10.14.1 and 10.14.2 with no relief. I started digging and eventually found this stackoverflow post that also explained issues I was having with Homebrew. The /usr/include/ directory is no longer being placed by Apple when installing XCode/XCode CLI tools. The net result is random breaks when installing certain packages from Homebrew. More importantly, unix-style build chain tools malfunction on OS X Mojave with XCode 10. Apple actually notes this in the release notes for XCode 10.

The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk or the Command Line Tools at: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk depending on which is selected using xcode-select.

The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. You can find this package at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg To make sure that you’re using the intended version of the command line tools, run xcode-select -s <path to Xcode> or xcode select -s /Library/Developer/CommandLineTools after installing.

With respect to the freezing/crash issue, I observed during the compilation of layout-thread, rustc uses about 5.5 gb of memory. On Macs with <8 GB of ram I can see that causing freezes/crashes. During the compilation of libservo, the wired memory usage on my MBP topped 13 GB, though I couldn’t find which process it was being attributed to. My MBP started freezing up and lead to me panic closing every application. My guess is its either some sort of bug in 10.14.x that the final linking causes to go bonkers or something is opening too many file handles. I’ll dig some more now that I’m able to successfully compile.

I’m gonna go ahead and close the bug on Apple’s side. Memory doesn’t blow up anymore, and there is not perceptible freeze.

I will keep this issue open until Apple officially release Xcode 10.2.

For now, if you want to work around the problem, install Xcode 10.2 beta, xcode-select -s ./Xcode-beta.app, then mach clean, and rebuild servo.

So reverting to xcode 9.4.1 appears to solve the problem.

It’s a temporary workaround, but here is how to do it:

Xcode 10.2 works for me, too! 🎉🎉🎉

I am on MacOS 10.14.6 with Xcode 10.3. Every time I start installing the .dmg file it crashes my laptop. Any ideas?

I just upgraded my macOS to 10.14.4 which includes Xcode 10.2 (https://developer.apple.com/documentation/macos_release_notes/macos_mojave_10_14_4_release_notes).

However, I will still be freezed with Xcode that I need to keep using the Xcode-beta 🤔

Using:

  • MacBook Pro 3.3 GHz Intel Core i7
  • OSX 10.14.1 (18B75)
  • Xcode 10.1 (10B61)
  • Apple LLVM version 10.0.0 (clang-1000.11.45.5)

A OSX debug build does freeze my laptop.

I’m running into this issue as well. On my Mac, which is very recent (2016, 16 GB), at link time, the OS becomes unresponsive to a point that I can’t do any work, for about 5 minutes, then my Mac restarts.

dsymutil + kernel_tasks are full CPU/memory.

This is fairly recent.

By the way, ./mach build -r -p servo still works fine, and there is perhaps something we can improve about the feedback received when trying to run the wpt tests after having done a release build.

Currently, doing ./mach test-wpt will print out “The dev profile is not built. Please run ‘./mach build’ and try again.”

This actually gave me the impression that the wpt tests can only be run with a dev profile, while actually doing a /.mach test-wpt <name of the test> --relase will work fine.

I’m assuming using the dev build will be crucial for some type of debugging, yet for someone currently unable to do a ./mach build -d due to machine specs, using a release profile to run the unit-test might be a good solution to be aware of, instead of rushing to the store to buy a new machine 😃

see https://github.com/servo/servo/blob/647796ede66ad84acf6239d8b556ee3735bfc6a6/python/servo/command_base.py#L396

from a quick glance I would actually expect this conditional to return the release path in case it has been build, and no other argument have been passed to the command: https://github.com/servo/servo/blob/647796ede66ad84acf6239d8b556ee3735bfc6a6/python/servo/command_base.py#L390

It instead appears that dev is True by default(although not in the function signature) when doing a ./mach test-wpt without further arguments…

We could also change the print statement to read something like: “The dev profile is not built and you haven’t specified --release. Please build a dev profile or specify that you want to use a release profile”.