Unable to debug chromium in Visual studio 2019

480 views
Skip to first unread message

Moiz Ahmed

unread,
Oct 7, 2021, 1:18:34 AM10/7/21
to Chromium-dev
Visual studio crashes while building all.sln. I have all the source files. Chrome.exe is also working fine. But, It's been a week, I am not able to build chromium from Visual Studio. It shows this error messageUnable to start program allocator_clang_newlib_x64The system can not find the file specified.

note: I want to make changes to the source code and see how those changes take effect. i.e making a simple button
WhatsApp Image 2021-10-06 at 14.17.28.jpeg

Takuto Ikuta

unread,
Oct 7, 2021, 1:33:06 AM10/7/21
to moiza...@cheapcard.com.au, Chromium-dev
Not sure, this works. But you may avoid that error by setting enable_nacl=false in args.gn.

On Thu, Oct 7, 2021 at 2:17 PM Moiz Ahmed <moiza...@cheapcard.com.au> wrote:
Visual studio crashes while building all.sln. I have all the source files. Chrome.exe is also working fine. But, It's been a week, I am not able to build chromium from Visual Studio. It shows this error messageUnable to start program allocator_clang_newlib_x64The system can not find the file specified.

note: I want to make changes to the source code and see how those changes take effect. i.e making a simple button

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/6fcbafb9-d071-453c-b354-bbab1d47683en%40chromium.org.

Bruce Dawson

unread,
Oct 7, 2021, 11:05:43 PM10/7/21
to Chromium-dev, tik...@chromium.org, Chromium-dev, moiza...@cheapcard.com.au
The solution files created by ninja (such as all.sln) are designed to allow code browsing. They are not designed for building Chrome. Building Chrome is best done using ninja, such as this:

ninja -C out\Default chrome

You can then debug chrome using Visual Studio but you have to configure one of the projects to do this.

I long ago decided that the overhead of creating and using the generated Visual Studio projects was too much for me so I manually created debugging only projects. See "Using Visual Studio without Intellisense" at https://chromium.googlesource.com/chromium/src/+/refs/heads/main/docs/windows_build_instructions.md for details about this technique. This gives me a project that loads very quickly and is tuned for easy debugging. I do my building from the command prompt. I use VsChromium and https://source.chromium.org/ to explore the code.

Message has been deleted

Moiz Ahmed

unread,
Oct 8, 2021, 1:06:37 AM10/8/21
to Chromium-dev, tik...@chromium.org, Chromium-dev, Moiz Ahmed
Visual studio does not crash now but the errors are still there:  

toolchain.ninja:40627: loading 'obj/net/backoff_entry_serializer_fuzzer_input.ninja': The system cannot find the path specified. allocator_clang_newlib_x64

MSB3073 The command "call ninja.exe -C build\src\new\Default\ clang_newlib_x64/obj/base/allocator/allocator.stamp" exited with code 1. allocator_clang_newlib_x64 build\src\new\Default\clang_newlib_x64\obj\base\allocator\allocator_clang_newlib_x64.vcxproj   



Bruce Dawson

unread,
Oct 8, 2021, 11:24:36 AM10/8/21
to Moiz Ahmed, Chromium-dev
What command did you run that gave you those error messages? Where did you run it from? Did it print anything else before it printed that error message?

Chromium development is complicated, and even a simple button is not simple. It requires experience with Visual Studio editing, using the command prompt, and modern C++ knowledge. This tutorial might be helpful: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/codelabs/cpp101/codelab.md

Some of the Chromium university talks could also be helpful: https://www.youtube.com/playlist?list=PLNYkxOF6rcICgS7eFJrGDhMBwWtdTgzpx

I would recommend starting smaller. Make sure you have enough C++ skills then try building, running, debugging, and modifying base_unittests to make sure you understand the workflow before moving on to more complex targets.

On Fri, Oct 8, 2021 at 5:27 AM Moiz Ahmed <moiza...@cheapcard.com.au> wrote:
Thanks Bruce, I want to know more about how can I edit the source code to make my own custom browser? Do I have to make changes in the contents of the src folder and build/compile them with ninja to view the change? Is there anyway I can see those changes before compilation? I want make a simple button at this stage! Thanks in advance..


--
Bruce Dawson, he/him

Moiz Ahmed

unread,
Oct 8, 2021, 7:07:12 PM10/8/21
to Chromium-dev, Bruce Dawson, Chromium-dev, Moiz Ahmed
Thanks Bruce, I want to know more about how can I edit the source code to make my own custom browser? Do I have to make changes in the contents of the src folder and build/compile them with ninja to view the change? Is there anyway I can see those changes before compilation? I want make a simple button at this stage! Thanks in advance..

On Friday, October 8, 2021 at 8:05:43 AM UTC+5 Bruce Dawson wrote:

Bruce Dawson

unread,
Oct 9, 2021, 3:15:51 AM10/9/21
to Chromium-dev, moiza...@cheapcard.com.au, Bruce Dawson, Chromium-dev
You need to edit the source code (the contents of the src folder), perhaps using Visual Studio, and then build/compile them with ninja. You can then run chrome.exe to see the changes. You can use "git diff" to see the source-code changes prior to compilation, but to see the results of the changes you need to build/compile them with ninja and then run chrome.exe.

Moiz Ahmed

unread,
Oct 11, 2021, 7:40:41 PM10/11/21
to Chromium-dev, Bruce Dawson, Moiz Ahmed, Chromium-dev
Those error messages pop up when I try to run Local Machine Debugger on all.sln. It says build succeeded and then build error. But as you have answered my question I now know that all.sln is only for code browsing and I will not be able to build chrome browser from that.. Thanks!!

Petter Nilsen

unread,
Oct 12, 2021, 6:37:46 AM10/12/21
to Chromium-dev
As I responded to the other similar question a week or so ago, find Chrome in the solution browser, right click it and select "Set as Startup Project". 
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/07e283ad-1b07-42a0-bc27-78af6c0ddfcfn%40chromium.org.

-- 
--
Petter Nilsen, Senior Software Developer, Vivaldi Technologies AS

Bruce Dawson

unread,
Oct 14, 2021, 11:36:56 AM10/14/21
to Moiz Ahmed, Chromium-dev, pet...@vivaldi.com, tik...@chromium.org
autoninja -C out\default chrome is the only and therefore fastest way of building chromium, but there are some settings you can adjust for minor improvements.

I recommend building with symbol_level=1 or (better yet) symbol_level=2 in order to allow debugging. Most custom changes do not work the first time so being able to debug is very helpful.

That said, you can build with symbol_level=0 for slightly faster builds. But, Chromium builds take a while. It is a large project.

There are some suggestions here on how to get faster builds. Some gn args changes can make a difference, but the most important factors are hardware. You should have an SSD, as many cores as possible, and as much memory as possible:

On Thu, Oct 14, 2021 at 1:43 AM Moiz Ahmed <moiza...@cheapcard.com.au> wrote:
Is there a faster way to build chromium, other then autoninja -C out\default chrome
Note: This time I am building it with custom changes and have no intentions to debug it.


--
Bruce Dawson, he/him

Moiz Ahmed

unread,
Oct 15, 2021, 11:59:06 AM10/15/21
to Chromium-dev, pet...@vivaldi.com, chromi...@chromium.org, bruce...@google.com, tik...@chromium.org
Is there a faster way to build chromium, other then autoninja -C out\default chrome
Note: This time I am building it with custom changes and have no intentions to debug it.
On Tuesday, October 12, 2021 at 3:37:46 PM UTC+5 pet...@vivaldi.com wrote:

Moiz Ahmed

unread,
Oct 15, 2021, 11:59:37 AM10/15/21
to Chromium-dev, Bruce Dawson, Chromium-dev
I don't get how debug is helpful? When I run chrome.exe with visual studio, I only get to see some dlls loaded and the process/threads!

Bruce Dawson

unread,
Oct 15, 2021, 12:20:39 PM10/15/21
to Moiz Ahmed, Chromium-dev
Debugging with Visual Studio (or with windbg) lets you set breakpoints, single-step through code, view and adjust data, and more. This can let you verify that something is working correctly, or understand why something is not working. In the screen shot below you can see me debugging Chrome canary (details in crbug.com/1252564), stepping through code after sitting a breakpoint with the call stack and one of the function parameters displayed. Using the debugger is optional but I find it very useful. However this group cannot realistically teach you C++ development or debugging so if this sounds valuable I recommend looking for some other resources.

image.png
--
Bruce Dawson, he/him

Reply all
Reply to author
Forward
0 new messages