v8/android_arm: error: unexpected token in '.section' directive: .note.GNU-stack,"",%progbits

1,557 views
Skip to first unread message

smith.wi...@gmail.com

unread,
Sep 26, 2013, 11:29:33 PM9/26/13
to v8-u...@googlegroups.com
I'm trying to build v8 for Android on a Mac, following these instructions.  Basically

1) install android-ndk-r9
2) git clone git://github.com/v8/v8.git
3) cd v8
4) make dependencies
5) make android_arm.release -j16

However it fails as follows:

  CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/conversions.o
../third_party/icu/linux/icudt46l_dat.S:2:20: error: unexpected token in '.section' directive
 .section .note.GNU-stack,"",%progbits
                   ^
../third_party/icu/linux/icudt46l_dat.S:3:18: error: unexpected token in '.section' directive
 .section .rodata
                 ^
../third_party/icu/linux/icudt46l_dat.S:6:2: error: unknown directive
 .hidden icudt46_dat
 ^
../third_party/icu/linux/icudt46l_dat.S:8:2: error: unknown directive
 .type icudt46_dat,%object
 ^


it seems to be clang reporting the error -- doesn't support the .GNU-stack directive.  In theory, the target toolchain is the android-ndk-r9 and the host toolchain is clang/Xcode 5.  I have tried running it with CC and CXX set to llvm-gcc (GCC front end with LLVM backend), however with Xcode 5, GCC is no longer installed.  I've also tried setting GYP_DEFINES="clang=0" but to no avail.

I did also try building on Linux with GCC except it's a 64-bit machine and it fails with a missing bits/c++config.h which is a whole other story!

Any ideas?


-W.

smith.wi...@gmail.com

unread,
Sep 27, 2013, 7:32:38 AM9/27/13
to v8-u...@googlegroups.com
On Thursday, September 26, 2013 11:29:33 PM UTC-4, smith.wi...@gmail.com wrote:
I'm trying to build v8 for Android on a Mac ... However it fails as follows:

  CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/conversions.o
../third_party/icu/linux/icudt46l_dat.S:2:20: error: unexpected token in '.section' directive
 .section .note.GNU-stack,"",%progbits
                   ^
../third_party/icu/linux/icudt46l_dat.S:3:18: error: unexpected token in '.section' directive
 .section .rodata
                 ^
../third_party/icu/linux/icudt46l_dat.S:6:2: error: unknown directive
 .hidden icudt46_dat
 ^
../third_party/icu/linux/icudt46l_dat.S:8:2: error: unknown directive
 .type icudt46_dat,%object
 ^


it seems to be clang reporting the error -- doesn't support the .GNU-stack directive.  In theory, the target toolchain is the android-ndk-r9 and the host toolchain is clang/Xcode 5.  I have tried running it with CC and CXX set to llvm-gcc (GCC front end with LLVM backend), however with Xcode 5, GCC is no longer installed.  I've also tried setting GYP_DEFINES="clang=0" but to no avail.

Turns out the Chromium people reported this to the LLVM folks, who apparently fixed it but suggested a workaround: -no-integrated-as

I added -no-integrated-as to android.gypi, as follows:

diff --git a/build/android.gypi b/build/android.gypi index ca09725..ce9498f 100644 --- a/build/android.gypi +++ b/build/android.gypi @@ -238,7 +238,7 @@ }], # _toolset=="target" # Settings for building host targets using the system toolchain. ['_toolset=="host"', { - 'cflags': [ '-m32', '-pthread' ], + 'cflags': [ '-m32', '-pthread', '-no-integrated-as' ], 'ldflags': [ '-m32', '-pthread' ], 'ldflags!': [ '-Wl,-z,noexecstack',


However, it still fails, although a little differently:

CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/extensions/gc-extension.o ../third_party/icu/linux/icudt46l_dat.S:2:unknown section type: %progbits ../third_party/icu/linux/icudt46l_dat.S:2:Rest of line ignored. 1st junk character valued 32 ( ). ../third_party/icu/linux/icudt46l_dat.S:5:Unknown pseudo-op: .hidden ../third_party/icu/linux/icudt46l_dat.S:5:Rest of line ignored. 1st junk character valued 105 (i). ../third_party/icu/linux/icudt46l_dat.S:7:Unknown pseudo-op: .type ../third_party/icu/linux/icudt46l_dat.S:7:Rest of line ignored. 1st junk character valued 105 (i). clang: error: assembler command failed with exit code 1 (use -v to see invocation)


Hoping someone has some insight on this!

-W.



 

Jochen Eisinger

unread,
Sep 27, 2013, 7:43:47 AM9/27/13
to v8-u...@googlegroups.com
On Fri, Sep 27, 2013 at 1:32 PM, <smith.wi...@gmail.com> wrote:
On Thursday, September 26, 2013 11:29:33 PM UTC-4, smith.wi...@gmail.com wrote:
I'm trying to build v8 for Android on a Mac ... However it fails as follows:

  CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/conversions.o
../third_party/icu/linux/icudt46l_dat.S:2:20: error: unexpected token in '.section' directive
 .section .note.GNU-stack,"",%progbits
                   ^
../third_party/icu/linux/icudt46l_dat.S:3:18: error: unexpected token in '.section' directive
 .section .rodata
                 ^
../third_party/icu/linux/icudt46l_dat.S:6:2: error: unknown directive
 .hidden icudt46_dat
 ^
../third_party/icu/linux/icudt46l_dat.S:8:2: error: unknown directive
 .type icudt46_dat,%object
 ^


it seems to be clang reporting the error -- doesn't support the .GNU-stack directive.  In theory, the target toolchain is the android-ndk-r9 and the host toolchain is clang/Xcode 5.  I have tried running it with CC and CXX set to llvm-gcc (GCC front end with LLVM backend), however with Xcode 5, GCC is no longer installed.  I've also tried setting GYP_DEFINES="clang=0" but to no avail.

Turns out the Chromium people reported this to the LLVM folks, who apparently fixed it but suggested a workaround: -no-integrated-as

I added -no-integrated-as to android.gypi, as follows:

diff --git a/build/android.gypi b/build/android.gypi index ca09725..ce9498f 100644 --- a/build/android.gypi +++ b/build/android.gypi @@ -238,7 +238,7 @@ }], # _toolset=="target" # Settings for building host targets using the system toolchain. ['_toolset=="host"', { - 'cflags': [ '-m32', '-pthread' ], + 'cflags': [ '-m32', '-pthread', '-no-integrated-as' ],

These are cflags for the "host" toolset...
 
'ldflags': [ '-m32', '-pthread' ], 'ldflags!': [ '-Wl,-z,noexecstack',


However, it still fails, although a little differently:

CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/extensions/gc-extension.o

... while here you're compiling with the "target" toolset.

best
-jochen
 
../third_party/icu/linux/icudt46l_dat.S:2:unknown section type: %progbits ../third_party/icu/linux/icudt46l_dat.S:2:Rest of line ignored. 1st junk character valued 32 ( ). ../third_party/icu/linux/icudt46l_dat.S:5:Unknown pseudo-op: .hidden ../third_party/icu/linux/icudt46l_dat.S:5:Rest of line ignored. 1st junk character valued 105 (i). ../third_party/icu/linux/icudt46l_dat.S:7:Unknown pseudo-op: .type ../third_party/icu/linux/icudt46l_dat.S:7:Rest of line ignored. 1st junk character valued 105 (i). clang: error: assembler command failed with exit code 1 (use -v to see invocation)


Hoping someone has some insight on this!

-W.



 

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

smith.wi...@gmail.com

unread,
Sep 27, 2013, 8:22:09 AM9/27/13
to v8-u...@googlegroups.com


On Friday, September 27, 2013 7:43:47 AM UTC-4, Jochen Eisinger wrote:
I added -no-integrated-as to android.gypi, as follows:
diff --git a/build/android.gypi b/build/android.gypi index ca09725..ce9498f 100644 --- a/build/android.gypi +++ b/build/android.gypi @@ -238,7 +238,7 @@ }], # _toolset=="target" # Settings for building host targets using the system toolchain. ['_toolset=="host"', { - 'cflags': [ '-m32', '-pthread' ], + 'cflags': [ '-m32', '-pthread', '-no-integrated-as' ],

These are cflags for the "host" toolset...
 
 
'ldflags': [ '-m32', '-pthread' ], 'ldflags!': [ '-Wl,-z,noexecstack',


However, it still fails, although a little differently:

CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/extensions/gc-extension.o

... while here you're compiling with the "target" toolset.

That's the curious part.  It's supposed to be using the NDK toolchain to build the target, so I don't know why I'm seeing "clang" in the output when it fails:

clang: error: assembler command failed with exit code 1 (use -v to see invocation)

However, if I put the -no-integrated-as into the target options, I get:

arm-linux-androideabi-g++: error: unrecognized option '-no-integrated-as'

So it looks like it is using the NDK toolchain for the target.

Thanks!

-W.


smith.wi...@gmail.com

unread,
Sep 30, 2013, 1:36:32 PM9/30/13
to v8-u...@googlegroups.com
On Thursday, September 26, 2013 11:29:33 PM UTC-4, smith.wi...@gmail.com wrote:
I'm trying to build v8 for Android on a Mac ...However it fails as follows:

  CXX(target) /Users/winston/Work/v8/out/android_arm.release/obj.target/v8_base.arm/src/conversions.o
../third_party/icu/linux/icudt46l_dat.S:2:20: error: unexpected token in '.section' directive
 .section .note.GNU-stack,"",%progbits
                   ^
../third_party/icu/linux/icudt46l_dat.S:3:18: error: unexpected token in '.section' directive
 .section .rodata
                 ^
../third_party/icu/linux/icudt46l_dat.S:6:2: error: unknown directive
 .hidden icudt46_dat
 ^
../third_party/icu/linux/icudt46l_dat.S:8:2: error: unknown directive
 .type icudt46_dat,%object
 ^

I figured out the issue.  If you note, it's trying to compile linux/icudt461_dat and yet the host is Mac OS X and the target is Android.  Turns out in third_party/icu/icu.gyp there's a section (line 59) that adds three versions of icudt461_dat.S to the sources.  Later, there's another section (starting at line 109) that attempts to remove the unneeded versions:

          'target_conditions': [
            [ 'OS == "win" or OS == "mac" or OS == "ios" or '
              '(OS == "android" and (_toolset == "target" or host_os != "linux"))', {
              'sources!': ['linux/icudt46l_dat.S'],
            }],
            [ 'OS != "android" or _toolset == "host"', {
              'sources!': ['android/icudt46l_dat.S'],
            }],
            [ 'OS != "mac" and OS != "ios" and '
              '(OS != "android" or _toolset != "host" or host_os != "mac")', {
              'sources!': ['mac/icudt46l_dat.S'],
            }],


The icu.gyp file is used to generate out/third_party/icu/*.mk, in particular:
Both of which contain a line that looks like this:

OBJS := \
$(obj).host/$(TARGET)/third_party/icu/linux/icudt46l_dat.o

So it seems like the section in icu.gyp isn't filtering out the "wrong" versions of icudt46l_dat.S when generating the makefiles.  For a Mac build of Android, it should look like this:

OBJS := \
$(obj).host/$(TARGET)/third_party/icu/mac/icudt46l_dat.o

OBJS := \
$(obj).host/$(TARGET)/third_party/icu/android/icudt46l_dat.o

Unfortunately my GYP-fu isn't strong, I briefly tried to fix it in the icu.gyp file, but I resorted to manually fixing the icudata.*.android_arm.mk makefile and I was able to complete my V8 build.

Hopefully someone who knows a bit more about GYP can either fix the issue, or point me to somewhere I can log a bug (I think GYP is part of Chromium?).

-W

smith.wi...@gmail.com

unread,
Sep 30, 2013, 8:53:42 PM9/30/13
to v8-u...@googlegroups.com
On Monday, September 30, 2013 1:36:32 PM UTC-4, smith.wi...@gmail.com wrote:
So it seems like the section in icu.gyp isn't filtering out the "wrong" versions of icudt46l_dat.S when generating the makefiles.  For a Mac build of Android, it should look like this:

OBJS := \
$(obj).host/$(TARGET)/third_party/icu/mac/icudt46l_dat.o

OBJS := \
$(obj).host/$(TARGET)/third_party/icu/android/icudt46l_dat.o

Although this built, I ran into undefined reference errors when trying to link it into an Android application (via JNI).  I *think* the issue is with symbol visibility in the libicu*.a files -- that is I think the symbols are hidden by default.

In any case, I've spent enough time trying to get this built and I found that adding i18nsupport=off to the make command builds a V8 that doesn't need ICU!  So to build V8 for android/arm on a Mac using the NDK, this will do it (V=1 means verbose build):

make android_arm.release -j16 V=1 i18nsupport=off

Built libraries get put into ./out/android_arm.release.

-W


Reply all
Reply to author
Forward
0 new messages