# for android build cmake

**URL:** https://discourse.cmake.org/t/for-android-build-cmake/5682
**Category:** Usage
**Created:** [May 17, 2022, 3:00pm UTC](https://discourse.cmake.org/t/for-android-build-cmake/5682 "2022-05-17T15:00:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mumin16](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mumin16/32/2423_2.png) [@mumin16](https://discourse.cmake.org/u/mumin16)
#### Post date: [May 17, 2022, 3:00pm UTC](https://discourse.cmake.org/t/for-android-build-cmake/5682/1 "2022-05-17T15:00:42Z")

</div>

for android build, CMAKE\_C\_COMPILER must manually set FILEPATH for c compiler. otherwise we get error “incompatible with elf\_x86\_64”. i think that cmake can’t choose correct c compiler for android build.

i set those:  
ANDROID\_PLATFORM=android-26  
ANDROID\_ABI=x86\_64

is there another?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 18, 2022, 1:02pm UTC](https://discourse.cmake.org/t/for-android-build-cmake/5682/2 "2022-05-18T13:02:16Z")

</div>

Android SDKs ship with a toolchain file that you should use IIRC. Do they not make the compiler be found automatically?

---

<div class="post-metadata">

### Author: ![mumin16](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mumin16/32/2423_2.png) [@mumin16](https://discourse.cmake.org/u/mumin16)
#### Post date: [May 19, 2022, 11:10am UTC](https://discourse.cmake.org/t/for-android-build-cmake/5682/3 "2022-05-19T11:10:38Z")

</div>

it cant found automatically.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 19, 2022, 11:30am UTC](https://discourse.cmake.org/t/for-android-build-cmake/5682/4 "2022-05-19T11:30:56Z")

</div>

Sorry, but more details will need to be given for me (or, I suspect, anyone else) to actually be able to assist you. I don’t know what your setup is or what you’ve attempted. Specifics go much longer than paraphrasing error messages and being vague about what you actually did.
