First, thank you for your quick response ! Can you clarify what you mean by "under the NDK 10"? The files in > external/clang are used to build clang as part of an Android platform > build, not using the NDK. > At first, I was following this tutorial http://android-rebuilds.beuc.net/NDK_10/. But I ended following this one instead http://hardenedlinux.org/toolchains/2016/04/01/How_to_build_Clang_toolchains_for_Android.html Which is maybe not what I should do. "Under NDK 10" was to say that the build was using the NDK 10 source file... at least, I thought it was...
> external/clang/build.py follows the normal sequence for building > compilers, which is to use an existing compiler to compile the new > source (stage1, sometimes called bootstrapping), followed by using the > bootstrapped compiler to compile the new source (stage2). This > ensures that the final results are the same no matter which compiler > you had when you started. > > It might help if you explain exactly what you are trying to > accomplish. If you are just making changes to clang, you should > probably just be using the upstream sources and not the Android > platform sources. > Let me explain better what I'm trying to do. I'm currently developing passes inside Clang 3.9.1. Using CMake+ninja/make, I can compile Clang for OSX to use it with Xcode or for Linux. No problem. Now, what I'm trying to achieve is to use this customized version of Clang as a toolchain inside the NDK (starting with NDK 10). Actually, I was using a wrapper (bash script) that replace clang/clang++ binaries inside the llvm-3.5 toolchain of the NDK and redirect the call to my clang version. This solution require to have my clang version installed somewhere and to patch the NDK toolchains with the wrapper. I'm not sure if it's safe to do that, because there's a lot of other tools (llc, opt, llvm-as, etc) in the llvm-3.5 toolchain that I do not "wrap". For example, I guess there should be issues with LLVM IR bytecode between different version of these tools. In the meantime, I'm not sure that they are all used by the NDK. Also, Clang 3.9.1 is far from Clang 3.5, I also suspect lot of ABI or library issues when compiling code Clang 3.9.1 inside the NDK 10 system (with clang 3.5 libraries/includes). Even if during my test I did not encounter such errors with my wrapper, I guess that this temporary hack will generate errors when using specific C/C++ features that have changed from Clang 3.5 to 3.9.1. So, to avoid all those potential problems, I searched a way to compile my Clang 3.9.1 in a clean way using the same configuration (include/lib path, etc) of the Clang from the NDK toolchain. I was hoping finding a simple cmake command line and a script that copy files in right places (renaming some of them like ndk-strip). But I ended up compiling the whole AOSP which is not what I wanted to do. I would like a way to compile my Clang 3.9.1 version resulting in a llvm-3.9 directory that I can copy-paste into the NDK 10. Then, tweaking some *.mk files (config.mk and setup.mk), I should be able to use it as a normal toolchain for compiling native library. Any idea on how to achieve that? > > On Wed, Jan 18, 2017 at 12:52 PM, Gagou Lou <[email protected] > <javascript:>> wrote: > > Hi all, > > > > I'm currently successfully building the clang toolchain under the NDK 10 > > under OSX. > > But I'm a bit confused about how your building system is working... > > (kati,ninja,soong, etc) > > > > As Clang rely on CMake, I was hoping to find the Clang configuration > command > > used by the NDK build system, but it seems more complicated... > > After digging a bit in the *.mk files, it seems that you have a > separated > > build system which don't rely on the CMakefile contained in Clang > sources. > > > > I'm currently using ./external/clang/build.py to build Clang toolchain. > The > > build process seems to do so many things. I mean, compiling Clang for > Linux > > or OSX is as simple as calling cmake with the right parameters followed > by > > make/ninja. But in the NDK, Clang compilation looks like so complicated. > > > > So my questions are: > > - How to generate a new Clang toolchain with my own Clang source code ? > > - How the build system works in the NDK 10 ? What are all those > compilation > > (stage1, stage2, etc) simply for generating a Clang toolchain? > > - Any hint where to start searching? (any documentation, files, etc) > > > > Thank you for your help, > > > > Gael > > > > > > > > -- > > -- > > You received this message because you are subscribed to the "Android > > Building" mailing list. > > To post to this group, send email to [email protected] > <javascript:> > > To unsubscribe from this group, send email to > > [email protected] <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/android-building?hl=en > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "Android Building" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- You received this message because you are subscribed to the Google Groups "Android Building" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
