On Sun, Nov 3, 2019 at 7:03 AM Bill Anderson <jsingu...@gmail.com> wrote: > > I met a problem > I compiled a native ELF binary running on android arm7 on Ubuntu. > > export GOOS=android > export GOARCH=arm > export GOARM=7 > export CGO_ENABLED=1 > export CGO_CFLAGS="-g -O2 > --sysroot=/mnt/d/sdk/android/android-ndk-r14b-linux/android-24/arch-arm" > export > CGO_LDFLAGS="--sysroot=/mnt/d/sdk/android/android-ndk-r14b-linux/android-24/arch-arm" > export CC=arm-linux-androideabi-gcc > export CC_FOR_TARGET=arm-linux-androideabi-gcc > export CXX=arm-linux-androideabi-g++ > ---------------------- > go build > > # runtime/cgo > _cgo_export.c:3:20: fatal error: stdlib.h: No such file or directory > #include <stdlib.h> > > How can I solve this error?
In order to use cgo, you must have a working C compiler, including a C library. In this case it looks like your C library is incomplete: it does not include <stdlib.h>. To fix that you will need to find and install a working C library. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcV8h2DoATjfk83Vgd43pG96dWiG1cTxPS6paB_MTc%2BOQg%40mail.gmail.com.