android-go icon indicating copy to clipboard operation
android-go copied to clipboard

Error stdlib.h trying to build example directory

Open John1122334 opened this issue 7 years ago • 2 comments

I'm getting an error when I try to build the example directory using ../build-android.sh

_cgo_export.c:2:20: fatal error: stdlib.h: No such file or directory Anyone have any ideas?

The full log is

../build-android.sh 
+ : 26
+ : /home/jsper/Downloads
+ : /home/jsper/Downloads/ndk-bundle
+ export ANDROID_API ANDROID_HOME ANDROID_NDK_HOME
+ /home/jsper/Downloads/tools/bin/sdkmanager --update
[=======================================] 100% Computing updates...             
+ /home/jsper/Downloads/tools/bin/sdkmanager ndk-bundle
[=======================================] 100% Computing updates...             
+ rm -rf android/toolchain
+ /home/jsper/Downloads/ndk-bundle/build/tools/make_standalone_toolchain.py --install-dir=android/toolchain --arch=arm --api=26 --stl=libc++
+ rm -rf android/toolchain/sysroot/usr
+ cp -r /home/jsper/Downloads/ndk-bundle/platforms/android-26/arch-arm/usr android/toolchain/sysroot/usr
+ mkdir -p android/app/src/main/jniLibs/armeabi-v7a
+ GOOS=android
+ GOARCH=arm
+ GOARM=7
+ go get -d
+ CC=/home/jsper/go/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-gcc
+ CXX=/home/jsper/go/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-g++
+ CGO_ENABLED=1
+ CGO_CFLAGS=-march=armv7-a
+ GOOS=android
+ GOARCH=arm
+ GOARM=7
+ go build -i -buildmode=c-shared -o android/app/src/main/jniLibs/armeabi-v7a/libgomain.so
# runtime/cgo
_cgo_export.c:2:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.

Thanks

https://stackoverflow.com/questions/48813751/building-android-go-stdlib-h-no-such-file-or-directory

John1122334 avatar Feb 15 '18 18:02 John1122334

Has same error and any ways from stackoverflow can't solve my problem.

VladChekunov avatar Jun 15 '19 11:06 VladChekunov

I believe it was an android ndk version issue. The android ndk version you have installed needs to match the current example. At the time it was 26 I think.

On Sat, Jun 15, 2019 at 8:50 AM Vlad Chekunov [email protected] wrote:

Has same error and any ways from stackoverflow can't solve my problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xlab/android-go/issues/15?email_source=notifications&email_token=ACDPC32ZOMT6B672VRCLLNLP2TJP5A5CNFSM4EQ5FUZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXYWOKA#issuecomment-502359848, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDPC34OVLGDAC4XVSWYFALP2TJP5ANCNFSM4EQ5FUZA .

John1122334 avatar Jun 16 '19 16:06 John1122334