Building Toolchain

318 views
Skip to first unread message

Mike Acton

unread,
Jan 22, 2013, 2:50:53 PM1/22/13
to native-cli...@googlegroups.com
I'd like to build the toolchain(s) for a non-x86 host (arm). 
Q: Is this the best page for most-current information on building the toolchain? http://www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils

Mike.

Victor Khimenko

unread,
Jan 22, 2013, 6:52:07 PM1/22/13
to Native Client Discuss
On Tue, Jan 22, 2013 at 11:50 PM, Mike Acton <mac...@gmail.com> wrote:
I'd like to build the toolchain(s) for a non-x86 host (arm). 
Q: Is this the best page for most-current information on building the toolchain? http://www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils

That's about x86 toolchain. I'm not sure if we have any documents WRT ARM toolchain. Your best bet is probably to start looking on buildbot_toolchain_build.py and on what it does on buildbots:

Mike Acton

unread,
Jan 23, 2013, 3:42:17 AM1/23/13
to native-cli...@googlegroups.com
On Tuesday, January 22, 2013 3:52:07 PM UTC-8, khim wrote:
Your best bet is probably to start looking on buildbot_toolchain_build.py and on what it does on buildbots:
http://build.chromium.org/p/client.nacl.toolchain/builders/lucid64-toolchain_arm/builds/633/steps/annotate/logs/stdio

Thanks that got me going! There was also this earlier note:

12/4/12 Roland McGrath wrote: 
In the native_client source tree, you can run the Python script toolchain_build/toolchain_build.py to do it for you. The details of what  commands it actually runs to build the components are encapsulated in that file.

I did manage to run the build scripts on my ARM Chromebook. And it seems to have built the nacl-arm binaries (Yes!) Unfortunately, it seems to have done a canadian cross and I got executables intended for an x86 host (No!) I'm poking around the build scripts now to see if I can change the host to arm - but if anyone knows these scripts or has already done this, I'd appreciate any tips or advice. 

Mike.

Roland McGrath

unread,
Jan 23, 2013, 12:16:14 PM1/23/13
to native-cli...@googlegroups.com
On Wed, Jan 23, 2013 at 12:42 AM, Mike Acton <mac...@gmail.com> wrote:
> I did manage to run the build scripts on my ARM Chromebook. And it seems to
> have built the nacl-arm binaries (Yes!) Unfortunately, it seems to have done
> a canadian cross and I got executables intended for an x86 host (No!) I'm
> poking around the build scripts now to see if I can change the host to arm -
> but if anyone knows these scripts or has already done this, I'd appreciate
> any tips or advice.

If you just want vanilla default build details for your host, then comment
out the additions to CONFIGURE_HOST_ARCH in the script.

Mike Acton

unread,
Jan 24, 2013, 3:23:13 AM1/24/13
to native-cli...@googlegroups.com
If you just want vanilla default build details for your host, then comment out the additions to CONFIGURE_HOST_ARCH in the script.

Sweet! So below you can (hopefully) see arm-nacl-gcc (target=arm-nacl) running on an arm chromebook (host=arm)
  1. Running ChromeOS. (With ArchLinux userspace. See: http://solvitor.com/2013/01/02/lamp-stack-on-an-arm-chromebook/)
  2. Running native gcc 4.7.2. The gcc_arm and gcc_libs_arm sources only needed a small patch to build. (See: http://openrisc.2316802.n4.nabble.com/OpenRISC-PATCH-GCC-4-5-1-patch-to-support-host-GCC-4-6-3-td4641002.html)
  3. arm-nacl-gcc built for ARM + GNU/Linux 2.6.7
  4. arm-nacl-gcc runs! (and newlib is built, etc.)
After a bit of trial and error, this is what I ended up using for CONFIGURE_HOST_ARCH:
CONFIGURE_HOST_ARCH += [
'CC=gcc -std=c99 -Wno-psabi',
'CXX=g++ -Wno-psabi -static-libstdc++',
'--enable-clocale=gnu',
'--disable-multilib',
]

Now what I have is a fully self-contained dev and test environment on the Chromebook. 
Next up: Actually getting some nacl projects to run. :) 

Inline image 1

Also for those interested, these are all the packages I have installed (pacman -Qet) - Note: I don't have it narrowed to just the minimum amount here, this is everything.
  • bison 2.7-1
  • cronie 1.4.9-2
  • cryptsetup 1.5.1-1
  • dash 0.5.7-2
  • dhcpcd 5.6.4-1
  • diffutils 3.2-1.1
  • elfutils 0.155-1
  • flex 2.5.37-1
  • gcc 4.7.2-3
  • gettext 0.18.2-1
  • git 1.8.1.1-1
  • gperf 3.0.4-4
  • heirloom-mailx 12.5-3
  • inetutils 1.9.1-4
  • initscripts 2012.10.1-1
  • iputils 20121221-1
  • jfsutils 1.1.15-3
  • less 451-1
  • licenses 2.9-1.1
  • linux-headers-imx6 3.0.15-1
  • linux-imx6 3.0.15-1
  • lvm2 2.02.98-1
  • make 3.82-5
  • man-db 2.6.3-1
  • man-pages 3.45-1
  • mdadm 3.2.6-1
  • nano 2.2.6-2
  • net-tools 1.60.20120804git-2
  • openssh 6.1p1-4
  • pacman 4.0.3-5
  • patch 2.7.1-2
  • pciutils 3.1.10-1
  • ppp 2.4.5-5
  • procps-ng 3.3.5-1
  • psmisc 22.19-1
  • python2 2.7.3-4
  • reiserfsprogs 3.6.21-4
  • subversion 1.7.8-1
  • sudo 1.8.6.p4-1
  • syslog-ng 3.3.7-1
  • sysvinit 2.88-9
  • tar 1.26-2
  • tcp_wrappers 7.6-12
  • unzip 6.0-6
  • usbutils 006-1
  • vi 1:050325-3
  • wget 1.14-2
  • which 2.20-5
  • wpa_supplicant 1.0-2
  • xfsprogs 3.1.10-1
  • zip 3.0-3
image.png

Mike Acton

unread,
Jan 26, 2013, 4:01:00 AM1/26/13
to native-cli...@googlegroups.com
Update: After some fiddling about getting the arm toolchain installed with in the appropriate place with the nacl_sdk, everything seems to build and run. (Yay!)
#tip Building gcc will take tons of space. I ended up moving my whole dev environment to an external sdcard. More info: https://gist.github.com/4632677

Q: How do I build the x86 toolchain? (Looks like the toolchain_build.py is only for arm.)

Building nacl_sdk/pepper_25/examples/hello_world on arm chromebook (I removed the x86 and x64 targets in the makefile):
Inline image 2

Running nacl_sdk/pepper_25/examples/hello_world on arm chromebook:
Inline image 3
Screenshot 2013-01-26 at 12.52.16 AM.png
Screenshot 2013-01-26 at 12.52.10 AM.png

Victor Khimenko

unread,
Jan 26, 2013, 6:04:28 AM1/26/13
to Native Client Discuss
On Sat, Jan 26, 2013 at 1:01 PM, Mike Acton <mac...@gmail.com> wrote:
Update: After some fiddling about getting the arm toolchain installed with in the appropriate place with the nacl_sdk, everything seems to build and run. (Yay!)
#tip Building gcc will take tons of space. I ended up moving my whole dev environment to an external sdcard. More info: https://gist.github.com/4632677

Q: How do I build the x86 toolchain? (Looks like the toolchain_build.py is only for arm.)

That's explained in the original document. You probably will want to look on the Mac's buildbot and start from there.


Why not Linux? Because our version of glibc is built in weird kind-of-native-but-not-really-mode and I doubt you'll be able to build it on anything else then Linux x86. Windows and Mac bots download pre-built version of glibc from common data storage.
 
Building nacl_sdk/pepper_25/examples/hello_world on arm chromebook (I removed the x86 and x64 targets in the makefile):
Inline image 2

Running nacl_sdk/pepper_25/examples/hello_world on arm chromebook:
Inline image 3

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To post to this group, send email to native-cli...@googlegroups.com.
To unsubscribe from this group, send email to native-client-di...@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Screenshot 2013-01-26 at 12.52.16 AM.png
Screenshot 2013-01-26 at 12.52.10 AM.png

Mike Acton

unread,
Jan 26, 2013, 10:55:46 PM1/26/13
to native-cli...@googlegroups.com
That's explained in the original document. You probably will want to look on the Mac's buildbot and start from there.

Great! Thanks. I got the x64 toolchain built and a running. I only needed to do some minor patching to the Makefile to remove the "-m32" flags from a couple of places.

...and once I got the binaries installed in the expected place in nacl_sdk and iptables to open up a web port up on the chromebook I could run the nacl-x64 binaries just fine. :)

Why not Linux? Because our version of glibc is built in weird kind-of-native-but-not-really-mode and I doubt you'll be able to build it on anything else then Linux x86. Windows and Mac bots download pre-built version of glibc from common data storage

Meh. I'm not going to support glibc. There are limits to my masochism. 

nacl-x64 binary (pepper_25/examples/hello_world) running on Chrome/Win8 served (and built) from arm chromebook:
Inline image 1
image.png

Mike Acton

unread,
Jan 27, 2013, 2:38:45 AM1/27/13
to native-cli...@googlegroups.com
I've uploaded the prebuilt toolchains here if anyone else needs them: https://github.com/macton/arm_nacl_toolchain_pepper_25
Reply all
Reply to author
Forward
0 new messages