Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix cross-compile issue for Android #6876

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions android-configure
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export AR=$TOOLCHAIN/bin/$SUFFIX-ar
export CC=$TOOLCHAIN/bin/$SUFFIX-gcc
export CXX=$TOOLCHAIN/bin/$SUFFIX-g++
export LINK=$TOOLCHAIN/bin/$SUFFIX-g++
export AR_host=ar
export CC_host=gcc
export CXX_host=g++
export LINK_host=g++

GYP_DEFINES="target_arch=$ARCH"
GYP_DEFINES+=" v8_target_arch=$ARCH"
Expand Down
143 changes: 97 additions & 46 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -242,60 +242,111 @@
['_type=="static_library"', {
'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
}],
],
'conditions': [
[ 'target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'target_arch=="x32"', {
'cflags': [ '-mx32' ],
'ldflags': [ '-mx32' ],
}],
[ 'target_arch=="x64"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="ppc" and OS!="aix"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'target_arch=="ppc64" and OS!="aix"', {
'cflags': [ '-m64', '-mminimal-toc' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="s390"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ],
}],
[ 'target_arch=="s390x"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'OS=="solaris"', {
'cflags': [ '-pthreads' ],
'ldflags': [ '-pthreads' ],
'cflags!': [ '-pthread' ],
'ldflags!': [ '-pthread' ],
['_toolset=="host"', {
'conditions': [
['host_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
['host_arch=="x32"', {
'cflags': [ '-mx32' ],
'ldflags': [ '-mx32' ],
}],
[ 'host_arch=="x64"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'host_arch=="ppc" and OS!="aix"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'host_arch=="ppc64" and OS!="aix"', {
'cflags': [ '-m64', '-mminimal-toc' ],
'ldflags': [ '-m64' ],
}],
[ 'host_arch=="s390"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ],
}],
[ 'host_arch=="s390x"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'OS=="solaris"', {
'cflags': [ '-pthreads' ],
'ldflags': [ '-pthreads' ],
'cflags!': [ '-pthread' ],
'ldflags!': [ '-pthread' ],
}],
[ 'OS=="aix"', {
'conditions': [
[ 'host_arch=="ppc"', {
'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
}],
[ 'host_arch=="ppc64"', {
'cflags': [ '-maix64' ],
'ldflags': [ '-maix64' ],
}],
],
'ldflags!': [ '-rdynamic' ],
}],
],
}],
[ 'OS=="aix"', {
['_toolset=="target"', {
'conditions': [
[ 'target_arch=="ppc"', {
'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
['target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
['target_arch=="x32"', {
'cflags': [ '-mx32' ],
'ldflags': [ '-mx32' ],
}],
[ 'target_arch=="x64"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="ppc64"', {
'cflags': [ '-maix64' ],
'ldflags': [ '-maix64' ],
[ 'target_arch=="ppc" and OS!="aix"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'target_arch=="ppc64" and OS!="aix"', {
'cflags': [ '-m64', '-mminimal-toc' ],
'ldflags': [ '-m64' ],
}],
[ 'target_arch=="s390"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ],
}],
[ 'target_arch=="s390x"', {
'cflags': [ '-m64' ],
'ldflags': [ '-m64' ],
}],
[ 'OS=="solaris"', {
'cflags': [ '-pthreads' ],
'ldflags': [ '-pthreads' ],
'cflags!': [ '-pthread' ],
'ldflags!': [ '-pthread' ],
}],
[ 'OS=="aix"', {
'conditions': [
[ 'target_arch=="ppc"', {
'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
}],
[ 'target_arch=="ppc64"', {
'cflags': [ '-maix64' ],
'ldflags': [ '-maix64' ],
}],
],
'ldflags!': [ '-rdynamic' ],
}],
],
'ldflags!': [ '-rdynamic' ],
}],
['OS=="android" and _toolset=="target"', {
'libraries': [ '-llog' ],
}],
],
}],
[ 'OS=="android"', {
'defines': ['_GLIBCXX_USE_C99_MATH'],
'libraries': [ '-llog' ],
}],
['OS=="mac"', {
'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
'xcode_settings': {
Expand Down
4 changes: 4 additions & 0 deletions tools/create_android_makefiles
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ fi

cd $(dirname $0)/..

# Export CC_host to gcc, so that the configure script will detect the correct
# host arch
export CC_host=gcc

./configure \
--without-snapshot \
--openssl-no-asm \
Expand Down