Building NaCl SDK from source for ARM-32

110 views
Skip to first unread message

Vasant k

unread,
Sep 19, 2015, 6:36:01 AM9/19/15
to Native-Client-Discuss
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

Victor Khimenko

unread,
Sep 19, 2015, 7:03:30 AM9/19/15
to Native Client Discuss
On Sat, Sep 19, 2015 at 12:36 PM, Vasant k <vsn...@gmail.com> wrote:
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

You've found the instructions for the original (as in: very old) toolchain. As such it only supports x86. I don't know if there are exist any documentation for the build process of a newer toolchain, but the toolchain could be build by toolchain_build/toolchain_build.py as was already discussed: https://groups.google.com/d/topic/native-client-discuss/md37MPuokwQ

Message has been deleted
Message has been deleted

Vasant k

unread,
Sep 19, 2015, 12:40:21 PM9/19/15
to Native-Client-Discuss
To be precise,  this is what I am getting when I run toolchain_build.py:
@@@BUILD_STEP binutils_arm_arm_linux_gnueabihf (build)@@@
Running: subprocess.check_call(['/bin/chmod', '+x', 'strip_for_target'], cwd='/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work')
Running: subprocess.check_call(['/bin/sh', '../../src/binutils/configure', '--with-pkgversion=Native Client SDK [a9b9286cb331416c96834875c78d15de55ce953e]', '--with-bugurl=http://gonacl.com/reportissue', '--prefix=', '--disable-silent-rules', 'CXX=g++ -static-libstdc++', '--without-gcc-arch', '--without-zlib', '--target=arm-nacl', '--with-sysroot=/arm-nacl', 'STRIP_FOR_TARGET=/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work/strip_for_target', '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl', '--enable-deterministic-archives', '--enable-gold', '--enable-plugins'], cwd='/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work')
/bin/sh: 0: Can't open ../../src/binutils/configure

Error building binutils_arm_arm_linux_gnueabihf: Command '['/bin/sh', '../../src/binutils/configure', '--with-pkgversion=Native Client SDK [a9b9286cb331416c96834875c78d15de55ce953e]', '--with-bugurl=http://gonacl.com/reportissue', '--prefix=', '--disable-silent-rules', 'CXX=g++ -static-libstdc++', '--without-gcc-arch', '--without-zlib', '--target=arm-nacl', '--with-sysroot=/arm-nacl', 'STRIP_FOR_TARGET=/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work/strip_for_target', '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl', '--enable-deterministic-archives', '--enable-gold', '--enable-plugins']' returned non-zero exit status 127

Vasant k

unread,
Sep 19, 2015, 1:06:20 PM9/19/15
to Native-Client-Discuss
I also tried to run toolchain_build.py on x86-64 machine also. Getting the same error as on ARM machine.

Victor Khimenko

unread,
Sep 20, 2015, 9:35:47 AM9/20/15
to Native Client Discuss
On Sat, Sep 19, 2015 at 7:06 PM, Vasant k <vsn...@gmail.com> wrote:
I also tried to run toolchain_build.py on x86-64 machine also. Getting the same error as on ARM machine.

Hmm... Are you sure you even have a buildable NaCl source, not just checkout of the main repo? See "Getting buildable source code" in the main NaCl repo:
 

On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.
To post to this group, send email to native-cli...@googlegroups.com.
Visit this group at http://groups.google.com/group/native-client-discuss.
For more options, visit https://groups.google.com/d/optout.

Vasant k

unread,
Sep 20, 2015, 9:38:45 AM9/20/15
to Native-Client-Discuss
 Yeah, pretty sure that is how I checked out following the instructions on that page.


On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 20, 2015, 9:56:55 AM9/20/15
to Native Client Discuss
On Sun, Sep 20, 2015 at 3:38 PM, Vasant k <vsn...@gmail.com> wrote:
 Yeah, pretty sure that is how I checked out following the instructions on that page.

Then your best bet is to see how buildbots are doing it:

This is log of actual continuous build.

You could even use the very same scripts buildbots are using! You'll need to set few BUILDBOT_* environment variables (look into the buildbot_selector.py to see which variables it checks) but then everything should work as it does on the buildbot.

P.S. Last steps (where finished tar file is uploaded) should fail by design: you don't have credintials to upload to official google storage place. But everything before that should succeed.

Vasant k

unread,
Sep 20, 2015, 10:02:27 AM9/20/15
to native-cli...@googlegroups.com
That's great. I am ready to explore all the options. I hope you don't mind helping me when I am stuck.  Thanks for your help.

--
You received this message because you are subscribed to a topic in the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/native-client-discuss/A5IcVoZD5pw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to native-client-di...@googlegroups.com.

Vasant k

unread,
Sep 20, 2015, 11:04:54 AM9/20/15
to Native-Client-Discuss
In the above log, I can see that bot builds gdb only for x86-64 and x86-32 (in steps 39 and 40 respectively).   It still doesn't talk about ARM 32.


On Saturday, 19 September 2015 10:36:01 UTC, Vasant k wrote:

Victor Khimenko

unread,
Sep 20, 2015, 11:36:40 AM9/20/15
to Native Client Discuss
On Sun, Sep 20, 2015 at 5:04 PM, Vasant k <vsn...@gmail.com> wrote:
In the above log, I can see that bot builds gdb only for x86-64 and x86-32 (in steps 39 and 40 respectively).   It still doesn't talk about ARM 32.

i686_w64_mingw32 (Windows, 32bit) and x86_64_linux (Linux, 64bit) are host platforms and as was mentioned before ARM is not supported currently as host platform. These gdbs are supposed to work with ARM target. You could download them and see if that's indeed the case (step 44 where everything is put to Google Storage).

Message has been deleted

Vasant k

unread,
Sep 20, 2015, 12:03:08 PM9/20/15
to Native-Client-Discuss
I found a gdb for arm 32 in the mentioned link.  However it is of type  ELF x86-64 executable.  I don't even understand the meaning of this gdb. How can you debug an ARM binary on x86-64!



On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 20, 2015, 12:16:58 PM9/20/15
to Native Client Discuss

On Sun, Sep 20, 2015 at 5:57 PM, Vasant k <vsn...@gmail.com> wrote:
I found a gdb for arm 32 in the mentioned link.  However it is of type  ELF x86-64 executable.  I don't even understand the meaning of this gdb. How can you debug an ARM binary on x86-64.

 
On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to native-client-di...@googlegroups.com.

Vasant k

unread,
Sep 20, 2015, 12:33:11 PM9/20/15
to Native-Client-Discuss

Sounds good. This is the closest I have been to solving this toochain problem. But, life is not that simple. I have a raspberry Pi on ARMV7 for which there is no Chrome OS available so far. 

On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 20, 2015, 12:45:19 PM9/20/15
to Native Client Discuss
On Sun, Sep 20, 2015 at 6:33 PM, Vasant k <vsn...@gmail.com> wrote:

Sounds good. This is the closest I have been to solving this toochain problem. But, life is not that simple. I have a raspberry Pi on ARMV7 for which there is no Chrome OS available so far. 

You'll need to invent your own solution then, I'm afraid. NaCl for ARM is only supported on ARM Chromebooks.

I think there are guys who tried to build Chromium for Raspberry Pi and in theory NaCl for ARM should work there, too, but I'm not sure what happened to these efforts. I know that these efforts were crippled for a long time because NaCl for ARM requires ARMv7 and Raspberry Pi had only ARMv6, Raspberry Pi 2 should be compatible in theory, but I don't know if anyone tried to build NaCl for it.

Vasant k

unread,
Sep 20, 2015, 1:04:51 PM9/20/15
to Native-Client-Discuss
Hmm..  Yes.  I am still hopeful that if someone who has built gdb/SDK toolchain for ARM from source on Chrome OS helps me, I might be able to emulate that on my Raspberry Pi 2.   What do you think might be the problem when I run toolchain_build/toolchain_build.py to get the following error? 

/bin/sh: 0: Can't open ../../src/binutils/configure

Error building binutils_arm_arm_linux_gnueabihf: Command '['/bin/sh', '../../src/binutils/configure', '--with-pkgversion=Native Client SDK [a9b9286cb331416c96834875c78d15de55ce953e]', '--with-bugurl=http://gonacl.com/reportissue', '--prefix=', '--disable-silent-rules', 'CXX=g++ -static-libstdc++', '--without-gcc-arch', '--without-zlib', '--target=arm-nacl', '--with-sysroot=/arm-nacl', 'STRIP_FOR_TARGET=/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work/strip_for_target', '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl', '--enable-deterministic-archives', '--enable-gold', '--enable-plugins']' returned non-zero exit status 127




On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 20, 2015, 1:59:58 PM9/20/15
to Native Client Discuss
On Sun, Sep 20, 2015 at 7:04 PM, Vasant k <vsn...@gmail.com> wrote:
Hmm..  Yes.  I am still hopeful that if someone who has built gdb/SDK toolchain for ARM from source on Chrome OS helps me, I might be able to emulate that on my Raspberry Pi 2.   What do you think might be the problem when I run toolchain_build/toolchain_build.py to get the following error? 

Who knows? As I've said: I left NaCl team couple of years ago and have no idea how in blue sky this new build system is supposed to work. That's why I've said: look on the buildbot's output. I just ran following command in the nacl_root folder (not in toolchain_build subfolder) and it started the build:
  $ buildbot/buildbot_toolchain_build.py --test_toolchain nacl_arm_glibc_raw toolchain_build

Well, it works for me on Ubuntu Trusty with various packages (flex, binson, texutils, mingw-w64-i686-dev, mingw-w64-x86-64-dev, g++-mingw-w64-i686, g++-mingw-w64-x86-64, gcc-mingw-w64-i686, gcc-mingw-w64-x86-64) installed. I guess your best bet is to build that beast in Ubuntu Trusty chroot and then go from there. Don't forget that depot_tools folder must be in PATH or else things like "git cache" will fail!
 
/bin/sh: 0: Can't open ../../src/binutils/configure

Error building binutils_arm_arm_linux_gnueabihf: Command '['/bin/sh', '../../src/binutils/configure', '--with-pkgversion=Native Client SDK [a9b9286cb331416c96834875c78d15de55ce953e]', '--with-bugurl=http://gonacl.com/reportissue', '--prefix=', '--disable-silent-rules', 'CXX=g++ -static-libstdc++', '--without-gcc-arch', '--without-zlib', '--target=arm-nacl', '--with-sysroot=/arm-nacl', 'STRIP_FOR_TARGET=/home/linaro/nacl_src/native_client/toolchain_build/out/binutils_arm_arm_linux_gnueabihf_work/strip_for_target', '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl', '--enable-deterministic-archives', '--enable-gold', '--enable-plugins']' returned non-zero exit status 127




On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

--

Vasant k

unread,
Sep 21, 2015, 6:06:48 AM9/21/15
to Native-Client-Discuss
 It works on Trusty?.  It throws below error on my ubuntu 13.04 x86-64 machine.  Failed 4 times, checked out fresh source code each time.

checking for library containing strerror... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-libiberty] Error 1
make[1]: Leaving directory `/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/out/binutils_arm_i686_w64_mingw32_work'
make: *** [all] Error 2
Error building binutils_arm_i686_w64_mingw32: Command '['/usr/bin/make', '-j4', 'HAVE_LIBICONV=no']' returned non-zero exit status 2
Traceback (most recent call last):
  File "buildbot/buildbot_toolchain_build.py", line 145, in <module>
    sys.exit(main(sys.argv[1:]))
  File "buildbot/buildbot_toolchain_build.py", line 96, in main
    ['--packages-file', TEMP_PACKAGES_FILE])
  File "/usr/lib/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/toolchain_build.py', '--bot', '--packages-file', '/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/out/packages.txt']' returned non-zero exit status 1


Same command never completes on my Raspberry Pi2, I think it is to do with tiny 1GB RAM of it.


On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 21, 2015, 6:13:50 AM9/21/15
to Native Client Discuss

On Mon, Sep 21, 2015 at 12:06 PM, Vasant k <vsn...@gmail.com> wrote:
 It works on Trusty?. 

Of course it does. Trusty is our main development platform.
 
It throws below error on my ubuntu 13.04 x86-64 machine.  Failed 4 times, checked out fresh source code each time.

checking for library containing strerror... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

GCC_NO_EXECUTABLES, huh. Are you sure you have the appropriate mingw-w64 packages installed?

make[1]: *** [configure-libiberty] Error 1
make[1]: Leaving directory `/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/out/binutils_arm_i686_w64_mingw32_work'
make: *** [all] Error 2
Error building binutils_arm_i686_w64_mingw32: Command '['/usr/bin/make', '-j4', 'HAVE_LIBICONV=no']' returned non-zero exit status 2
Traceback (most recent call last):
  File "buildbot/buildbot_toolchain_build.py", line 145, in <module>
    sys.exit(main(sys.argv[1:]))
  File "buildbot/buildbot_toolchain_build.py", line 96, in main
    ['--packages-file', TEMP_PACKAGES_FILE])
  File "/usr/lib/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python', '/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/toolchain_build.py', '--bot', '--packages-file', '/media/vasant/76001f9e-d10d-4243-84b2-7b2996a78b87/home/vasant/native_client/native_client/toolchain_build/out/packages.txt']' returned non-zero exit status 1


Same command never completes on my Raspberry Pi2, I think it is to do with tiny 1GB RAM of it.

On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:
I am trying to build Native Client SDK from source code following instructions on: www.chromium.org/nativeclient/how-tos/building-and-testing-gcc-and-gnu-binutils. After I run make clean build-with-newlib -j16, I get errors. When I saw the contents of Makefile, I realized that CROSS_ARCH was set to x86_64. Changing it to arm32 threw different kind of errors. What are the settings to generate binaries for ARM platform?

--

Vasant k

unread,
Sep 21, 2015, 6:51:15 AM9/21/15
to Native-Client-Discuss
Yeah, My bad. It's building now on my ubuntu 13.04, hopefully to completion.

Meanwhile I tried to run:  run.py     to run my .nexe file on ARM. got below error:
scons: Reading SConscript files ...
Exception: Cannot find a toolchain for arm in /home/linaro/native_client/native_client/toolchain/linux_arm/pnacl_newlib_raw:


I noticed some significant differences in toolchain directory between ARM and x86-64. On ARM, only one pnacl_translation is available, where as on x86 there are many directories.

On Saturday, 19 September 2015 10:36:01 UTC, Vasant k wrote:

Victor Khimenko

unread,
Sep 21, 2015, 7:05:04 AM9/21/15
to Native Client Discuss
On Mon, Sep 21, 2015 at 12:51 PM, Vasant k <vsn...@gmail.com> wrote:
Yeah, My bad. It's building now on my ubuntu 13.04, hopefully to completion.

Meanwhile I tried to run:  run.py     to run my .nexe file on ARM. got below error:
scons: Reading SConscript files ...
Exception: Cannot find a toolchain for arm in /home/linaro/native_client/native_client/toolchain/linux_arm/pnacl_newlib_raw:


I noticed some significant differences in toolchain directory between ARM and x86-64. On ARM, only one pnacl_translation is available, where as on x86 there are many directories.

That's because noone builds anything on ARM. It's all cros-compiled on x86. You could find more on buildbots, again: http://build.chromium.org/p/client.nacl/console

I know that they used to test this stuff using two bots (one (x86-64 based one) builds stuff, another one (ARM-based) is used to run tests), but now it looks like it's mostly QEMU testing.

I'm not sure how to replicate this two bots setup locally, sorry. As I've said: I never played with NaCl for ARM stuff myself. I've always used pre-built versions. I wrote the initial version of x86-64 toolchain thus I know this stuff intimately, but ARM... I'm more-or-less in the same boat as you.

Vasant k

unread,
Sep 21, 2015, 7:31:17 AM9/21/15
to Native-Client-Discuss
 After building for long time:    buildbot/buildbot_toolchain_build.py  on ubuntu 13.04  complains:

arm-linux-gnueabihf-gcc -v -c
sh: 1: arm-linux-gnueabihf-gcc: not found
scons: *** Error 127

installing  gcc-4.7-arm-linux-gnueabihf  had no effect...





On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 21, 2015, 7:39:14 AM9/21/15
to Native Client Discuss
On Mon, Sep 21, 2015 at 1:31 PM, Vasant k <vsn...@gmail.com> wrote:
 After building for long time:    buildbot/buildbot_toolchain_build.py  on ubuntu 13.04  complains:

arm-linux-gnueabihf-gcc -v -c
sh: 1: arm-linux-gnueabihf-gcc: not found
scons: *** Error 127

installing  gcc-4.7-arm-linux-gnueabihf  had no effect...

For very good reason: gcc-4.7-arm-linux-gnueabihf makes arm-linux-gnueabihf-gcc-4.7 command available. For arm-linux-gnueabihf-gcc you need gcc-arm-linux-gnueabihf package :-) This will bring arm-linux-gnueabihf-gcc command with gcc 4.8 :-)

Vasant k

unread,
Sep 21, 2015, 10:00:43 AM9/21/15
to Native-Client-Discuss
 Thanks a lot for your patience.  Now the build is failing because of a failed test.

TestCatchingFault:
Measuring real time:
  41.064 usec (4.10641e-05 sec) per iteration: 0.00410641 sec for 100 iterations
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

ERROR: Command returned: exit status -11 (0xfffffff5) and signal info None
but we expected: exit status 0 (0x0) and signal info None
[  FAILED  ] nacl_glibc.run_performance_test_irt (5279 ms)


scons: *** [scons-out/nacl_irt_test-arm-glibc/test_results/performance_test.out] Error 1
scons: done building targets (errors occurred during build).




On Saturday, 19 September 2015 12:36:01 UTC+2, Vasant k wrote:

Victor Khimenko

unread,
Sep 21, 2015, 10:12:03 AM9/21/15
to Native Client Discuss

I'm afraid this is where I'll leave you. I have no idea what Qemu needs to succeed. My guess is that you've already build the toolchain (since it tries to test it). Try without --test_toolchain option, maybe?

--
Reply all
Reply to author
Forward
0 new messages