How to build chrome in 32bit machine or cross build 32bit chrome in 64 bit machine?

1,711 views
Skip to first unread message

Pengfei Sun

unread,
Nov 3, 2015, 6:45:44 PM11/3/15
to Chromium-dev
Hi,

I try to compile 32 bit chrome binary. I have searched online and groups. I saw someone mentioned that we cannot build 32 bit chrome in 32 bit machine. I have tried to compile chrome in 32 bit machine. I was compiling error or linking problem ( memory exhausted), even if I changed linker to gold, it cannot make it after more than 1 hour. Now I want to try to cross build 32 bit chrome in 64 bit machine. But I don't know how to change the configure file or where I need to change to make it. Can you guys give me some hints?

Thank you very much!

Best Regards,
Pengfei

Lei Zhang

unread,
Nov 3, 2015, 6:54:18 PM11/3/15
to shaot...@gmail.com, Chromium-dev
Sounds like Linux? One way is to make a 32-bit chroot on a 64-bit
machine and build in there.
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev

Will Harris

unread,
Nov 3, 2015, 6:54:58 PM11/3/15
to shaot...@gmail.com, Chromium-dev
Which platform are you trying to build for? Linux/Windows/Mac? The instructions vary per platform but they should be accurate as linked from the Chromium page - https://www.chromium.org/Home

Will



On Tue, Nov 3, 2015 at 3:45 PM, Pengfei Sun <shaot...@gmail.com> wrote:

--

Dirk Pranke

unread,
Nov 3, 2015, 7:01:44 PM11/3/15
to shaot...@gmail.com, Chromium-dev
Hi Pengfei,

Are you trying to build the desktop linux configuration, or something else?

You are correct that we do not support building chrome on any 32-bit machines; you need more than 4GB of memory to link chrome.

For desktop linux, doing a 32-bit build is more complicated than it should be at the moment, but basically you want to pull down a 32-bit sysroot and compile against that using a GN build:

% GYP_CHROMIUM_NO_ACTION=1 gclient sync

% python build/linux/sysroot_scripts/install-sysroot.py --arch=i386

% gn gen //out/Release.gn --args='target_cpu="x86" sysroot=<absolute-path-to-src>/build/linux/debian_wheezy_i386-sysroot'

% ninja -C out/Release.gn chrome

(At least, I think the above should work, though I haven't actually tried it. Let me know if it doesn't, because I need something like this to work soon :).

-- Dirk

On Tue, Nov 3, 2015 at 3:45 PM, Pengfei Sun <shaot...@gmail.com> wrote:

--

Pengfei Sun

unread,
Nov 3, 2015, 9:46:51 PM11/3/15
to Dirk Pranke, Chromium-dev
Hi Drik,

Yes, I build the desktop linux version. I have followed your steps to build 32 bit machines. Now I met one error as following.

sun@sun:~/project/chromium/src$ gn gen //out/Release.gn --args='target_cpu="x86" sysroot=/home/sun/project/chromium/src/build/linux/debian_wheezy_i386-sysroot'
ERROR at the command-line "--args":1:26: Invalid token.
target_cpu="x86" sysroot=/home/sun/project/chromium/src/build/linux/debian_wheezy_i386-sysroot
                                         ^
I have no idea what this is.

Do you have any suggestion? Thank you very much!

Best Regards,
Pengfei

Pengfei Sun

unread,
Nov 3, 2015, 9:50:18 PM11/3/15
to Dirk Pranke, Chromium-dev
Hi Dirk, I change --args to --arg. Now the step works well.

Pengfei Sun

unread,
Nov 4, 2015, 8:04:48 AM11/4/15
to Dirk Pranke, Chromium-dev
HI Dirk,

I have followed your steps to finish the compiling after more than two hours. However, I still don't get the 32-bit chrome. I only get the 64-bit chrome. When I compiled the chrome, the only different was I changed --args to --arg. You can find why I change to --arg in previous email. Do you have any suggestion?

sun@sun:~/project/chromium/src/out/Release.gn$ file chrome
chrome: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=bb3827b425712a753c396a8d523ba5e72681150d, not stripped

Build.ninja

Inline image 1 

Best Regards,
Pengfei

Colin Blundell

unread,
Nov 4, 2015, 8:28:55 AM11/4/15
to shaot...@gmail.com, Dirk Pranke, Chromium-dev
Hi Pengfei,

The solution to the "--args" problem isn't to change to "--arg" (which GN doesn't know anything about and ignores, hence your ending up with a vanilla 64-bit build). Instead, the value of the sysroot arg needs to be also encased in double-quotes (that's the error that GN was actually reporting). I also think that you need to specify target_sysroot instead of sysroot based on examining //build/config/sysroot.gni.  i.e., I think the command line should be

gn gen //out/Release.gn --args='target_cpu="x86" target_sysroot="/home/sun/project/chromium/src/build/linux/debian_wheezy_i386-sysroot"'

On Wed, Nov 4, 2015 at 2:04 PM Pengfei Sun <shaot...@gmail.com> wrote:
HI Dirk,

I have followed your steps to finish the compiling after more than two hours. However, I still don't get the 32-bit chrome. I only get the 64-bit chrome. When I compiled the chrome, the only different was I changed --args to --arg. You can find why I change to --arg in previous email. Do you have any suggestion?

sun@sun:~/project/chromium/src/out/Release.gn$ file chrome
chrome: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=bb3827b425712a753c396a8d523ba5e72681150d, not stripped

Build.ninja

image.png 

Best Regards,
Pengfei

Pengfei Sun

unread,
Nov 4, 2015, 10:14:33 AM11/4/15
to Colin Blundell, Dirk Pranke, Chromium-dev
Hi Colin,

Thanks for your suggestion. I follow your step. I think you are right. I can get x86 compilation tools and libraries in out/Release.gn.
Inline image 1

But there is also one dependency error. I think it cannot find clang_x86.
Inline image 2

Now I try to solve this problem. Do you have any idea?


Best Regards,
Pengfei



Stephen Lanham

unread,
Nov 4, 2015, 11:02:22 AM11/4/15
to shaot...@gmail.com, Colin Blundell, Dirk Pranke, Chromium-dev
Pengfei,

That error means that the //breakpad:symupload target is not found for the x86 toolchain. This is because the target is only declared for the host toolchain (x64) for linux builds: https://code.google.com/p/chromium/codesearch#chromium/src/breakpad/BUILD.gn&l=392

I posted a quick CL which should resolve the problem:  https://codereview.chromium.org/1426293005/ 

I think you'll find if you implement the change locally, the issue should be resolved.

Dirk Pranke

unread,
Nov 4, 2015, 11:54:58 AM11/4/15
to Stephen Lanham, Pengfei Sun, Colin Blundell, Chromium-dev
Colin is right about the changes needed to --args, and Stephen is right about the fix for symupload.

Apologies for the confusion,

-- Dirk

Pengfei Sun

unread,
Nov 4, 2015, 7:40:04 PM11/4/15
to Dirk Pranke, Stephen Lanham, Colin Blundell, Chromium-dev
Dear Dirk,

Finally, I have followed your steps and the fix of Stephen and Colin to finish compiling. Thanks for you guys.
For the whole compiling process, I spent almost 7 hours. More than 5 hours is for final link. My machine is Dell Optiplex 9020, 16G memory. When linking chrome, my machine always show me there is no free memory. I don't know how long and how much memory do you guys need? If I want the minimum chromium features (e.g. I want to remove nacl module), which configure files do I need to change?
 
Now, the 32-bit chrome can run in the 64-bit Ubuntu machine well. But it still cannot execute in 32-bit ubuntu machine. The error is:
Inline image 1

The whole steps will be:
Thanks again :-)

Best Regards,
Pengfei

Lei Zhang

unread,
Nov 4, 2015, 7:45:51 PM11/4/15
to Pengfei Sun, Dirk Pranke, Stephen Lanham, Colin Blundell, Chromium-dev
Well, with 5 hours, can you check top to see what linker binary it's actually running and how much memory it's taking?

If you copied it over to a 32-bit Ubuntu machine, you need to copy all the necessary files, not just the chrome binary. The error shows you are missing icudtl.dat.

Pengfei Sun

unread,
Nov 4, 2015, 8:16:12 PM11/4/15
to Lei Zhang, Dirk Pranke, Stephen Lanham, Colin Blundell, Chromium-dev
HI Lei,

It works now after I copy the whole Release.gn folder.  Thanks a lot.

I left my machine to compile and I went to my classes. When I came back this afternoon. I found the machine was really really slow and it was very difficult to do any operations. At that time, I didn't check top. Next time, I will check. 

If I want the minimum chromium features (e.g. I want to remove nacl module), which configure files do I need to change?

Best Regards,
Pengfei


Reply all
Reply to author
Forward
0 new messages