Discussion:
NDK r18 build.
(too old to reply)
Rob Landley
2018-10-08 01:13:42 UTC
Permalink
I downloaded the release 18 NDK and installed it:

sudo build/tools/make_standalone_toolchain.py --arch x86_64 --api 28 \
--install-dir /opt/android/x86_64

Then in order to build:

export CROSS_COMPILE=/opt/android/x86_64/bin/llvm- LDFLAGS=--static
make distclean
make defconfig
make

I need to:

A) add the llvm-cc symlink to clang.

B) disable the android logger because liblog.so doesn't have a
corresponding liblog.a.

(I'm trying to move compile time probes into portability.h but that can't
distinguish between static and non-static linking. But needing to pass the same
flags to defconfig and the the actual compile is kinda awkward/brittle too...)

Rob
enh
2018-10-08 18:52:55 UTC
Permalink
Post by Rob Landley
sudo build/tools/make_standalone_toolchain.py --arch x86_64 --api 28 \
--install-dir /opt/android/x86_64
export CROSS_COMPILE=/opt/android/x86_64/bin/llvm- LDFLAGS=--static
make distclean
make defconfig
make
A) add the llvm-cc symlink to clang.
note that toybox is our example of a non-configure project on
https://developer.android.com/ndk/guides/standalone_toolchain#building_open_source_projects_using_standalone_toolchains
Post by Rob Landley
B) disable the android logger because liblog.so doesn't have a
corresponding liblog.a.
yeah, all the "NDK" libraries are stub .so-only (even the .so files
just have symbols for build-time linking, no code).
Post by Rob Landley
(I'm trying to move compile time probes into portability.h but that can't
distinguish between static and non-static linking. But needing to pass the same
flags to defconfig and the the actual compile is kinda awkward/brittle too...)
Rob
_______________________________________________
Toybox mailing list
http://lists.landley.net/listinfo.cgi/toybox-landley.net
Rob Landley
2018-10-17 21:04:26 UTC
Permalink
Post by enh
Post by Rob Landley
sudo build/tools/make_standalone_toolchain.py --arch x86_64 --api 28 \
--install-dir /opt/android/x86_64
export CROSS_COMPILE=/opt/android/x86_64/bin/llvm- LDFLAGS=--static
make distclean
make defconfig
make
A) add the llvm-cc symlink to clang.
note that toybox is our example of a non-configure project on
https://developer.android.com/ndk/guides/standalone_toolchain#building_open_source_projects_using_standalone_toolchains
I saw that, but toybox is designed to build the same way the kernel does, I.E.
one CROSS_COMPILE=prefix- rather than specifying each individual tool.

And it works now with the NDK if you add that symlink. :)
Post by enh
Post by Rob Landley
B) disable the android logger because liblog.so doesn't have a
corresponding liblog.a.
yeah, all the "NDK" libraries are stub .so-only (even the .so files
just have symbols for build-time linking, no code).
I added another portability.h stanza and I _think_ that covers everything except
the llvm-cc symlink. It still errors about strip not understanding -o but
automatically falls back to copying the unstripped version to the output, and is
thus at least testable.

(And hey, my netbook dying means the machine I'm running it on now has the
x86-64 instruction that was missing in the startup code, so I don't need to run
it under qemu-x86_64 anymore. :)

Rob

Loading...