How do I go from src/out to binary with minimal files?

434 views
Skip to first unread message

Jake Shore

unread,
Aug 31, 2017, 2:36:55 AM8/31/17
to Chromium-dev
I can't seem to find this information anywhere, probably because it's obvious to everyone else.

Having successfully build chromium (with symbol_level=0, is_debug=false) how do I go from there to having the binary with the minimal files needed? 

Right now I have a 1.8GB directory and I'm not sure how to figure out which files are necessary and which files can be dispensed with, and how to go about this process.

Please be explicit and thorough -- state the obvious -- in the response, I may know less than you suspect.

Thanks. 

Jake Shore

unread,
Aug 31, 2017, 2:38:08 AM8/31/17
to Chromium-dev
I should mention that I've read through https://groups.google.com/a/chromium.org/forum/#!searchin/chromium-dev/size/chromium-dev/GaIYIzq6NGM/lJdJe_EwAgAJ and https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/mZSvbp9pids/ZE0A54v1AgAJ, which give the kind of minimal responses that are useful to people with experience packaging binaries, but not to noobs like me :)

Jake Shore

unread,
Aug 31, 2017, 3:24:03 AM8/31/17
to Chromium-dev
To be more clear about the question, for example in the src/out 1.8GB directory with the binary there is a folder src/out/obj which is 1.2GB. Is this folder needed, and can I remove it? How do I go about determining what's necessary for me to copy if I'm to use the binary on an embedded device with disk size constraints?

Dirk Pranke

unread,
Aug 31, 2017, 5:52:03 PM8/31/17
to amisi...@gmail.com, Chromium-dev
Hi,

The easiest way is to use GN. Figure out what GN label corresponds to the binary you care about, and then run `gn desc ... runtime_deps`. For example, if you were looking for the dependencies for chrome, the label is //chrome:chrome, and you'd run `gn desc //out/Default //chrome:chrome runtime_deps`.

That'll give you all of the files we think chrome needs to run. This is in theory accurate, but in practice may include some test files in there that aren't really needed but we that we haven't cleaned up.

You shouldn't need anything in the obj subdirectory.

If you find stuff that *is* listed in the runtime_deps, and isn't actually needed, it would be great to file a bug to list those things so we can remove them (i.e., fix the dependencies).

-- Dirk

--
--
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 view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/59c180cb-b8db-43ea-b3b9-ed8d1312ed16%40chromium.org.

Amisi Kiarie

unread,
Aug 31, 2017, 5:57:08 PM8/31/17
to Dirk Pranke, Chromium-dev

Thanks a bunch, let me try this.

Torne (Richard Coles)

unread,
Aug 31, 2017, 6:28:12 PM8/31/17
to amisi...@gmail.com, Dirk Pranke, Chromium-dev
Also, when building a build you intent to distribute and use as a browser, you should compile with is_official_build=true, not just turn off debug.

yang gu

unread,
Sep 1, 2017, 3:02:25 AM9/1/17
to Chromium-dev, amisi...@gmail.com
I'm also curious about the answer to this question. After running "gn desc //out/Default //chrome:chrome runtime_deps", I got below outputs:
./chrome
resources.pak
chrome_100_percent.pak
locales/en-US.pak
locales/fr.pak
gen/mojo/public/interfaces/bindings/interface_control_messages.mojom.js
gen/mojo/public/interfaces/bindings/pipe_control_messages.mojom.js
../../mojo/public/js/associated_bindings.js
../../mojo/public/js/bindings.js
../../mojo/public/js/buffer.js
../../mojo/public/js/codec.js
../../mojo/public/js/connector.js
../../mojo/public/js/core.js
../../mojo/public/js/interface_types.js
../../mojo/public/js/lib/control_message_handler.js
../../mojo/public/js/lib/control_message_proxy.js
../../mojo/public/js/lib/interface_endpoint_client.js
../../mojo/public/js/lib/interface_endpoint_handle.js
../../mojo/public/js/lib/pipe_control_message_handler.js
../../mojo/public/js/lib/pipe_control_message_proxy.js
../../mojo/public/js/router.js
../../mojo/public/js/support.js
../../mojo/public/js/threading.js
../../mojo/public/js/unicode.js
../../mojo/public/js/validator.js
pyproto/google/__init__.py
pyproto/google/third_party/six/six.py
pyproto/google/protobuf/__init__.py
pyproto/google/protobuf/descriptor.py
pyproto/google/protobuf/descriptor_database.py
pyproto/google/protobuf/descriptor_pool.py
pyproto/google/protobuf/json_format.py
pyproto/google/protobuf/message.py
pyproto/google/protobuf/message_factory.py
pyproto/google/protobuf/proto_builder.py
pyproto/google/protobuf/reflection.py
pyproto/google/protobuf/service.py
pyproto/google/protobuf/service_reflection.py
pyproto/google/protobuf/symbol_database.py
pyproto/google/protobuf/text_encoding.py
pyproto/google/protobuf/text_format.py
pyproto/google/protobuf/descriptor_pb2.py
pyproto/google/protobuf/internal/__init__.py
pyproto/google/protobuf/internal/_parameterized.py
pyproto/google/protobuf/internal/api_implementation.py
pyproto/google/protobuf/internal/containers.py
pyproto/google/protobuf/internal/decoder.py
pyproto/google/protobuf/internal/encoder.py
pyproto/google/protobuf/internal/enum_type_wrapper.py
pyproto/google/protobuf/internal/message_listener.py
pyproto/google/protobuf/internal/python_message.py
pyproto/google/protobuf/internal/type_checkers.py
pyproto/google/protobuf/internal/well_known_types.py
pyproto/google/protobuf/internal/wire_format.py
icudtl.dat
swiftshader/libGLESv2.so
swiftshader/libEGL.so
./libEGL.so
./libGLESv2.so
angledata/VkLayer_core_validation.json
angledata/VkLayer_object_tracker.json
angledata/VkLayer_parameter_validation.json
angledata/VkLayer_swapchain.json
angledata/VkLayer_threading.json
angledata/VkLayer_unique_objects.json
angledata/VkLayer_core_validation.json
angledata/VkLayer_object_tracker.json
angledata/VkLayer_parameter_validation.json
angledata/VkLayer_swapchain.json
angledata/VkLayer_threading.json
angledata/VkLayer_unique_objects.json
./libVkLayer_core_validation.so
./libVkLayer_object_tracker.so
./libVkLayer_unique_objects.so
./libVkLayer_parameter_validation.so
./libVkLayer_swapchain.so
./libVkLayer_threading.so
./libGLESv2.so
./ui.service
mus_app_resources_100.pak
mus_app_resources_200.pak
mus_app_resources_strings.pak
./test_ime_driver.service
keyboard_resources.pak
./font_service.service
natives_blob.bin
snapshot_blob.bin 


I think the ones starting with "gen/" and "../" are also useless. How about python files like "pyproto/google/xxx"? Are there any other files we can exclude?

Dirk Pranke

unread,
Sep 1, 2017, 12:50:30 PM9/1/17
to yan...@intel.com, Chromium-dev, amisi...@gmail.com
Good question. I would expect that you can get rid of the pyproto files and the angle files, at least. I haven't seen the libVk files before; I'd hope those were optional. And, some of the other .so's also seem redundant. Given that this isn't a component build, we should have as few .so's as possible.

-- Dirk 

--
--
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.

bruce...@chromium.org

unread,
Sep 1, 2017, 1:30:51 PM9/1/17
to Chromium-dev, yan...@intel.com, amisi...@gmail.com
It sounds like the original question is in regards to Linux but for completeness I'll give the answer for Windows - and maybe it will be informative for the Linux side.

> ninja -C out\Default mini_installer

This will generate out\Default\mini_installer.exe which is a stand-alone installer. It also creates chrome.7z which is a package that contains all of the files which mini_installer.exe installs. Unfortunately the mini_installer and chrome.7z targets don't exist on Linux. I'm surprised.

Looking at the contents of chrome.7z could be helpful for understanding Linux packaging, maybe?

Steve Kobes

unread,
Sep 1, 2017, 3:39:54 PM9/1/17
to bruce...@chromium.org, Chromium-dev, yan...@intel.com, amisi...@gmail.com
You can also try chrome/tools/build/linux/make_zip, which uses this file list.  (I think it's the same list the bots use to archive continuous builds.)

Dirk Pranke

unread,
Sep 1, 2017, 3:53:01 PM9/1/17
to Steve Kobes, Bruce Dawson, Chromium-dev, yan...@intel.com, Amisi Kiarie
Yes, the FILES.cfg list(s) are the whitelists we use for the actual installer binaries for Chrome (and for content_shell, and remoting_host, and possibly a couple other things).

But, those work only for those specific binaries. The `gn analyze` approach is the generic solution for an arbitrary binary. Either approach can work, depending on what you're trying to do.

-- Dirk

Luke Whiting

unread,
Sep 6, 2017, 3:12:07 PM9/6/17
to Chromium-dev
ELK swag!

Michael Giuffrida

unread,
Sep 6, 2017, 9:39:15 PM9/6/17
to dpr...@chromium.org, Steve Kobes, Bruce Dawson, Chromium-dev, yan...@intel.com, Amisi Kiarie
On Fri, Sep 1, 2017 at 12:52 PM Dirk Pranke <dpr...@chromium.org> wrote:
Yes, the FILES.cfg list(s) are the whitelists we use for the actual installer binaries for Chrome (and for content_shell, and remoting_host, and possibly a couple other things).

But, those work only for those specific binaries. The `gn analyze` approach is the generic solution for an arbitrary binary. Either approach can work, depending on what you're trying to do.

Could //tools/mb/mb.py be modified to work for non-test binaries?
 

Dirk Pranke

unread,
Sep 6, 2017, 10:00:56 PM9/6/17
to Michael Giuffrida, Steve Kobes, Bruce Dawson, Chromium-dev, yang gu, Amisi Kiarie
On Wed, Sep 6, 2017 at 6:37 PM, Michael Giuffrida <mich...@chromium.org> wrote:


On Fri, Sep 1, 2017 at 12:52 PM Dirk Pranke <dpr...@chromium.org> wrote:
Yes, the FILES.cfg list(s) are the whitelists we use for the actual installer binaries for Chrome (and for content_shell, and remoting_host, and possibly a couple other things).

But, those work only for those specific binaries. The `gn analyze` approach is the generic solution for an arbitrary binary. Either approach can work, depending on what you're trying to do.

Could //tools/mb/mb.py be modified to work for non-test binaries?

mb.py uses `gn analyze`, and that (already) works for any gn target (or label), test binary, non-test binary, group, action, whatever ... :).

-- Dirk

Amisi Kiarie

unread,
Sep 8, 2017, 8:51:23 AM9/8/17
to Dirk Pranke, Michael Giuffrida, Steve Kobes, Bruce Dawson, Chromium-dev, yang gu
Using the `gn desc` approach I'm getting this when running the binary:

[0908/124210.355366:ERROR:resource_bundle.cc(810)] Failed to load /path/to/chromium/chrome_200_percent.pak
Some features may not be available.
[0908/124210.458500:ERROR:resource_bundle.cc(810)] Failed to load /path/to/chromium/chrome_200_percent.pak
Some features may not be available.

Any thoughts?

Dirk Pranke

unread,
Sep 11, 2017, 7:19:11 PM9/11/17
to Amisi Kiarie, Michael Giuffrida, Steve Kobes, Bruce Dawson, Chromium-dev, yang gu
Not offhand, I *think* that file should be built as part of the build? 

-- Dirk

Amisi Kiarie

unread,
Sep 12, 2017, 12:50:01 AM9/12/17
to Dirk Pranke, Michael Giuffrida, Steve Kobes, Bruce Dawson, Chromium-dev, yang gu

It is indeed part of the build, but not part of the list output by `gn desc`. That's my confusion.

mj Maghsoudi

unread,
Sep 13, 2017, 4:15:12 AM9/13/17
to Chromium-dev

just delete *.ilk *.lib *.exp files. also u need just these folders(locales. swiftshader, resources ) it will reduse size to 300-400 mg 
pooooooolie

Dirk Pranke

unread,
Sep 13, 2017, 2:43:35 PM9/13/17
to Amisi Kiarie, Michael Giuffrida, Steve Kobes, Bruce Dawson, Chromium-dev, yang gu
If that's the case, then that would suggest that the file not declared as a data dependency, and that would be bad. But, I haven't looked into the details of this.

-- Dirk

Lei Zhang

unread,
Dec 8, 2017, 6:04:29 PM12/8/17
to amisi...@gmail.com, Chromium-dev
(3 months late reply)

There is a Linux equivalent to mini_installer on Windows, thanks to
work done by thomasanderson@ this year.

If you build with "is_component_build = false" set in GN on Linux,
then you can build a Chromium .deb or .rpm package, similar to the
Google Chrome packages. The build target is
"chrome/installer/linux:stable_deb", where you can substitute "deb"
with "rpm", and "stable" with "beta" or "unstable" as desired. See
chrome/installer/linux/BUILD.gn for details.

On Fri, Sep 1, 2017 at 10:30 AM, <bruce...@chromium.org> wrote:
> https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/ef9256e3-8667-4f92-a3df-30e31b7d55cf%40chromium.org.

Vinicius Silva

unread,
Jan 28, 2019, 7:19:58 PM1/28/19
to Chromium-dev, amisi...@gmail.com
Okay, I've done that, but I dont seem to be able to find the generated .deb file. In my "out/Release" folder I can see a folder called installer that contains 4 other folders and one text file, namely: 
common
debian
rpm
theme
version.txt

inside the debian folder I can find a build.sh file, but it fails when executed. Here is the message I get:

./installer/debian/build.sh: line 241: CHANNEL: unbound variable
./installer/debian/build.sh: line 132: log_cmd: command not found

I have reasons to believe that this build.sh file is the same as the one that can be found here:


....but I'm not so sure.

Can someone please help this complete helpless noob?

Lei Zhang

unread,
Jan 28, 2019, 7:37:57 PM1/28/19
to viniciu...@bigdata.inf.br, Chromium-dev, Amisi Kiarie
Can you elaborate on what exactly you did?
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/6581b54d-a39c-4554-9592-052ad36c9cc6%40chromium.org.

Vinicius Silva

unread,
Jan 29, 2019, 5:49:55 AM1/29/19
to Chromium-dev, viniciu...@bigdata.inf.br, amisi...@gmail.com
Sure I can, here's a detailed explanation:


1- Installed depot_tools and put it in the PATH:
    
 
  1.1 - Added this line to my ~/.bashrc
  export PATH="$PATH:/home/ubuntu/depot_tools/"

    1.2 - Sourced bashrc:
    source ~/.bashrc 

2- Downloaded the code:
   
    mkdir ~/chromium && cd ~/chromium
  fetch --nohooks chromium
  cd src

3- Installed additional build dependencies:

    ./build/install-build-deps.sh


4- Ran the hooks:

    gclient runhooks


5- Altered the gn args as seen in Hassen's message here: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/3PXe8AxbW1s

    gn args out/Release --> vi started and I added the following lines to the file:
 
  is_debug=false
  symbol_level=0 
  enable_nacl=true 
  remove_webcore_debug_symbols=true 
  enable_linux_installer=true

     Please note that contrary to what Hassen said, I did not set is_component_build=true (but I also didnt explicitly set it to false)

6- Set up the build:

    gn gen out/Release

7- Built Chrome:
    
    ninja -C out/Release "chrome/installer/linux:unstable_deb" 
    
8- Waited forever, checked whether the .deb file was generated and tried to run build.sh (as I described in my original message), but no success.

    ./src/out/Release/installer/debian/build.sh


I also think it's important to mention that between steps 2 and 3 I did modify the code itself. I was following freesoul's answer from this question on StackOverflow: https://stackoverflow.com/questions/42169488/how-to-make-chromedriver-undetectable
More specifically, I commented line 41 of this file: /src/third_party/blink/renderer/core/frame/navigator.idl  
Please note that this is not the exact same file that freesoul said I should modify, however, the correct file (src/third_party/WebKit/Source/core/frame/Navigator.idl) doesn´t exist and I assumed it existed at some point but was replaced to an equivalent during the development of the project since his answer was posted. 
I used find . -name "navigator.idl" in order to find this equivalent and the only match was "/src/third_party/blink/renderer/core/frame/navigator.idl" so I altered it.

I think that's all   

Thank you for your patience in helping a complete noob as myself.

Lei Zhang

unread,
Feb 13, 2019, 3:40:28 PM2/13/19
to viniciu...@bigdata.inf.br, Chromium-dev, Amisi Kiarie
What happened at the end of step 7? Did it succeed? If it did, there
should be a .deb file. If it did not, what error messages showed up?
You shouldn't need to do step 8 manually.
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/0bc9dc1a-0181-4177-a748-2131d54949d1%40chromium.org.
Reply all
Reply to author
Forward
0 new messages