Unable create Static build on OSX

Hi, I’m trying to build Brave from source, but I can’t produce a statically-linked app. I’ve been following the instructions on the wiki, and successfully created component builds with npm run build and a debug build with npm run build -- Debug, but I get failures if I use npm run build Release or npm run build -- Static.

This is the error if I use npm run build -- Static:

[1/425] ACTION //tools/v8_context_snap...pshot(//build/toolchain/mac:clang_x64)
FAILED: v8_context_snapshot.bin 
python ../../build/gn_run_binary.py ./v8_context_snapshot_generator --output_file=v8_context_snapshot.bin
[0124/144655.852718:FATAL:protected_memory.h(218)] Check failed: SetMemoryReadWrite(&writers, &writers + 1). 
0   v8_context_snapshot_generator       0x00000001085db039 base::debug::CollectStackTrace(void**, unsigned long) + 9
1   v8_context_snapshot_generator       0x0000000108540fb3 base::debug::StackTrace::StackTrace() + 19
2   v8_context_snapshot_generator       0x0000000108549059 logging::LogMessage::~LogMessage() + 233
3   v8_context_snapshot_generator       0x000000010887e8df base::AutoWritableMemory::AutoWritableMemory(void*, void*) + 239
4   v8_context_snapshot_generator       0x000000010887e521 MojoEmbedderSetSystemThunks(MojoSystemThunks const*) + 257
5   v8_context_snapshot_generator       0x00000001068da55b main + 91
6   libdyld.dylib                       0x00007fff6ddd77fd start + 1
7   ???                                 0x0000000000000002 0x0 + 2

./v8_context_snapshot_generator failed with exit code -5
[2/425] ACTION //components/resources:...edits(//build/toolchain/mac:clang_x64)
ninja: build stopped: subcommand failed.

When doing a build via npm run build Release I get this error:

[4/430] ACTION //tools/v8_context_snapshot:generate...8_context_snapshot(//build/toolchain/mac:clang_x64
FAILED: v8_context_snapshot.bin 
python ../../build/gn_run_binary.py ./v8_context_snapshot_generator --output_file=v8_context_snapshot.bin
./v8_context_snapshot_generator failed with exit code -5
[5/430] ACTION //components/resources:about_credits(//build/toolchain/mac:clang_x64)
ninja: build stopped: subcommand failed.

I’m currently on the master branch of brave-browser, commit hash e1d40258780112f64611817d7801677e7650abff.

I’m running macOS Catalina 10.15.2. Inside my XCode SDKs directory I have:

DriverKit19.0.sdk
MacOSX.sdk
MacOSX10.14.sdk
MacOSX10.15.sdk

As a slight departure from the instructions on the wiki, the 10.14 SDK is copied into the SDK directory rather than symlinked. (I got errors while symlinking it). I’m running node.js version 12.14.1 (installed and managed by nvm).

I’m currently using sccache version 0.2.12 with a local filesystem cache during the build. When I attempted this with npm run build, I tried it both with and without sccache, and had the same result each time.

I have also attempted this on Ubuntu, and the build succeeded in that case. I can provide version information on the ubuntu machine as well if that would be helpful.

python is python2 for me, version 2.7.16. I also have python3 installed.

What are the next steps for debugging this? I’ve been trying to figure out Chromium and Brave builds for a while now, and have some understanding of the major components (ninja, gn, depot_tools, etc.) and am comfortable reading python scripts, but I seem stuck here and don’t know how to debug further. Are there any known issues or glaring flaws in my setup here? Any help would be greatly appreciated.

This issue resolved itself with the most recent commits to Brave.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.