Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Sample code does not build for Android #2675

Open
Jacik opened this issue Jan 12, 2022 · 2 comments
Open

Sample code does not build for Android #2675

Jacik opened this issue Jan 12, 2022 · 2 comments

Comments

@Jacik
Copy link

Jacik commented Jan 12, 2022

Hi. I followed Getting Started guide on https://buck.build/setup/getting_started.html and try to build cross-platform-scale-2015-demo from https://github.com/fbsamples/bucksamples.git repository for Android.
I have this error:
toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc++

I tried NDK version 21 and 23 but still have the same error.
I use buck installed on macOS via brew
buck version 2021.01.12.01

BTW: I had to set fixed path to NDK 23 in .buckconfig because otherwise buck did not find NDK version 23 when using ANDROID_NDK_REPOSITORY. Only old 21 and 19 was found.
Target NDK version 23.0.7599858 is not available. The following versions are available: 21.3.6528147, 19.0.5232133

I also tried to setup my own simple Android project with Buck. I add simple java class and jni library with one C file.
When I build this project I have the same error.

@Jacik
Copy link
Author

Jacik commented Jan 12, 2022

I have found that build out file buck-out/bin/common/hello#android-armv7,shared/linker.argsfile contains "-lc++_shared"
It looks that buck is cutting this to only "-lc++"

-o
buck-out/gen/common/hello#android-armv7,shared/libcommon_hello.so
-target
armv7-none-linux-androideabi
-Wl,--build-id
-Wl,-z,noexecstack
-Wl,--gc-sections
-Wl,-z,defs
-Wl,-z,nocopyreloc
-Wl,--as-needed
-shared
-Wl,-soname
-Wl,libcommon_hello.so
buck-out/gen/common/hello#android-armv7,compile-pic-hello.c.o1f717d69/hello.c.o
-lc++_shared

@Jacik
Copy link
Author

Jacik commented Jan 18, 2022

Hi. More findings.
Error doesn't appear when using NDK 19.
Error can be reproduce when using NDK 21.
It looks that NDK 23 is not supported by buck because of different toolchain structure. I receive an error when using NDK 23
android-ndk-r23/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 doesn't exist.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant