General configuration for environment variables #2011
Answered
by
enh-google
uilianries
asked this question in
Q&A
Replies: 1 comment
-
On Mon, Apr 8, 2024 at 3:42 AM Uilian Ries ***@***.***> wrote:
When preparing a script to set then environment variables to be able use
Android NDK correctly for a general scenario, without risk of mixing with
my native system tool, I would have:
CC=/path/to/android/ndk/bin/clang
CXX=/path/to/android/ndk/bin/clang++
LD=/path/to/android/ndk/bin/ld
AR=/path/to/android/ndk/bin/llvm-ar
NM=/path/to/android/ndk/bin/llvm-nm
STRIP=/path/to/android/ndk/bin/llvm-strip
RANLIB=/path/to/android/ndk/bin/llvm-ranlib
OBJCOPY=/path/to/android/ndk/bin/llvm-objcopy
OBJDUMP=/path/to/android/ndk/bin/llvm-objdump
READELF=/path/to/android/ndk/bin/llvm-readelf
ADDR2LINE=/path/to/android/ndk/bin/llvm-addr2line
However, when reading the recommendation from the Build System Maintainers
Guide
-
https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#clang
-
https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#linkers
-
https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils
They said:
Note: It is usually not necessary to invoke the linkers directly since
Clang will do so automatically. Clang will also automatically link CRT
objects and default libraries and set up other target-specific options, so
it is generally better to use Clang for linking.
And
Note that llvm-as is not an equivalent of GNU as, but rather a tool for
assembling LLVM IR. If you are currently using as directly, you will need
to migrate to using clang as a driver for building assembly.
So it seems like I don't need to specify all these variables, only CC and
CXX, is that correct?
the word "usually" in the docs is important. most builds are simple, and
simple builds will just call "the compiler" to both compile and link stuff.
if, on the other hand, you're dealing with a build that uses niche tools
like ranlib, you're much more likely to want to set all of these.
but in practice, "only you can answer this question" --- look at what your
build uses, and make sure you've set those variables.
(there's nothing magic about these environment variables --- they're
literally just "commonly used environment variables in gnu
autotools/configure style builds.)
… —
Reply to this email directly, view it on GitHub
<#2011>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMVLEWFJ5EXVDQUJR65ID5DY4JYDBAVCNFSM6AAAAABF4OHFB6VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZWGQ3TONRTHE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
uilianries
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When preparing a script to set then environment variables to be able use Android NDK correctly for a general scenario, without risk of mixing with my native system tool, I would have:
However, when reading the recommendation from the Build System Maintainers Guide
They said:
And
So it seems like I don't need to specify all these variables, only
CC
andCXX
, is that correct?However, https://developer.android.com/ndk/guides/other_build_systems#autoconf points everything listed:
So I'm not sure which approach is better/safer.
Beta Was this translation helpful? Give feedback.
All reactions