Linux source build: electron binary is 1.35 GB!


#1

I just finished building electron from source, using the instructions for Linux.

The build failed; after some pain I found the linker needed a path to libgmodule, and (I know this wasn’t the correct way to do it) I manually added the link target to the build.ninja file. It then built successfully.

However, the resulting binary (0.27.1), which works just fine, is 1.357 gigabytes in size.

Did I do something wrong, or is there some sort of compressor available? The prebuilt binary is only 53MB.


#2

What Linux distro and version did you use and what options did you use for the Electron build? Where did you get the source code from? I’m not familiar with how Electron is built, but if you are asking a technical question like this, it helps to state exactly what you did. This way others experienced with the process can help.

Bob


#3

Hmmm. For fun and games, I tried building Electron on a CentOS 6.5 box (Node.js v0.12.4), but the bootstrap script script/bootstrap.py failed with an error while unzipping a file, and I suspect the problem is there is a hard requirement to run bootstrap.py under Python 2.7. I was using Python 2.6.6.

Since the build instructions for Linux (electron/docs/development/build-instructions-linux.md) list how to install the prerequisites on Ubuntu, and I have Ubuntu 14.04 LTS installed as a VirtualBox virtual machine, I fired up Ubuntu and started compiling Node.js v0.12.4 on this. Unfortunately, I ran out of disk space. I think it is a problem with how I set up the virtual machine: I used a dynamic vdi container, and that led the Ubuntu installer to think it only had 4 Gb of space for /. And I had already gobbled that up.

So I will build a new Ubuntu virtual machine with a large static container and try again.

Bob


#4

Yeah, I ran into this problem with VirtualBox yesterday. Now I have 20GB static VDIs for my Linux VMs.


#5

Slackware current, I installed clang and have python 2.7. Other than the missing library, the build went smoothly.

Source code came from github. There is a set of scripts to run (e.g. script/bootstrap.py, etc.) and then final command was “script/build.py -c R” which only built the release version, not the debugging one.

It works perfectly, but they must know a trick if the mine is huge and theirs (i.e. prebuilt) is only 57MB.


#6

I too just built a static VDI for my Ubuntu machine. When installing 14.04.2 LTS I specified configuring the disk without LVM, so they are ext4 partitions now. The vdi devices can be resized using a combination of VirtualBox’s ‘vboxmanage’, plus gparted. If you just happened to configure your partitioning as an LVM, then you will also need to resize the LVM as well. That is why when I reinstalled Ubuntu to a new virtual machine I skipped doing it with LVM.

Following that and some updating, I was able to get node 0.12.4 installed, so I’ll try electron tomorrow.


#7

I did attempt to build electron just now. With advice from @capouch (thanks for that!) it did indeed compile.

S/he is exactly right: the version of electron that is in directory out/R is 1,419,724,529 bytes in size. Running `readelf -s out/R/electron’ shows there must be more than 100,000 symbols in the executable file. I conclude that the debug version of electron must have been put accidentally in the out/R directory.

The version of electron which is in the out/D directory is 11,014,510 bytes.

I have not tried using either executable.

There was an undefined reference to symbol g_module_symbol. Adding ‘-lgmodule-2.0’ as a linker flag in the appropriate build.ninja files fixed that problem. Then I hit another issue where the Ubuntu libxss1 package needed to be installed. That allowed the build to succeed.

What I learned: you need to have Python 2.7 for the boostrap.py script to work. The requirement for libxss1 should also be published. I’ll contribute at least this back to the electron project https://github.com/atom/electron/issues/1830