public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] include/mk/env_post.mk: enable __ANDROID__ definition for Android build
Date: Wed, 24 Apr 2019 23:11:03 +0200	[thread overview]
Message-ID: <20190424211103.GB26076@x230> (raw)
In-Reply-To: <15aeaa52-eecc-e21a-eb86-d66cfe81928e@google.com>

Hi,

> On 4/24/19 9:55 AM, Zhengwang Ruan wrote:
> > The definition of __ANDROID__ has been widely used to compile android-specific
> > things (i.e. busybox [1] [2], dnsmasq [3]), so we expected NDK to automatically
> > pass it to help build LTP for android, but unfortunately it didn't (it is tested
> > with android-ndk-r19c). Currently, we have to manually specify -D__ANDROID__ in
> > configure step before launch 'make ANDROID=1' command, and this is suffering for
> > those who don't have good knowledge of LTP, so it is necessary to enable it if
> > built for android.

> Hi Zhengwang I mentioned in the other thread but just to get it here also,
> __ANDROID__ seems to be defined for me by the NDK. Could you try the steps
> Sandeep shared?

Using old way (getting standalone toolchain from NDK r19, using API 27
and define $AR, $CC, $LD, ... variables) confirms what Steve said [1]: -D__ANDROID__
is not defined on the command line (see below), but #error macro inside #ifdef
__ANDROID__ guard is proved that arm-linux-androideabi-gcc defines it.

Just for sure I tested the same using Sandeep's way (NDK r20-beta2, using
variables with API 26) [2], it behaves the same.
IMHO the patch is not needed.

BTW minimal Android API for LTP is 26 (API 24 complains for missing hasmntopt()).

> thanks,
> steve


Kind regards,
Petr

[1]
/opt/android-standalone-toolchain.api-27/bin/arm-linux-androideabi-gcc --sysroot=/opt/android-standalone-toolchain.api-27/sysroot -I/opt/android-standalone-toolchain.api-27/sysroot/usr/include -I/include -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -I. -DLTPLIB -Werror-implicit-function-declaration --sysroot=/opt/android-standalone-toolchain.api-27/sysroot -I/opt/android-standalone-toolchain.api-27/sysroot/usr/include -I/include -I../include -I../include -I../include/old/  -c -o tst_kernel.o tst_kernel.c

[2]
/opt/android-ndk-r20-beta2/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -I. -DLTPLIB -Werror-implicit-function-declaration -D_FORTIFY_SOURCE=2 -I../include -I../include -I../include/old/  -c -o tst_resource.o tst_resource.c

  reply	other threads:[~2019-04-24 21:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 16:55 [LTP] [PATCH v2] include/mk/env_post.mk: enable __ANDROID__ definition for Android build Zhengwang Ruan
2019-04-24 19:27 ` Steve Muckle
2019-04-24 21:11   ` Petr Vorel [this message]
2019-04-25  3:13   ` =?unknown-8bit?b?6Ziu5q2j5pe6?=

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190424211103.GB26076@x230 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox