Closed clach04 closed 4 years ago
I don't have a solution for this but the platform I'm on does support 32-bit binaries so I was able to install https://golang.org/dl/go1.14.6.linux-armv6l.tar.gz which is 32-bit which reports as:
go1.14.6 linux/arm
and will build go-sqlite3 successfully.
@clach04 Please provide the output from running go version
and go env
on the machine in question using the original Go installation that gave you that "unexpected: 4-byte pointer type - *char" error message. Also, please confirm that you have a 64-bit C compiler on the machine (that is, a C compiler that produces 64-bit executables).
Thanks @rittneje.
[:~/go/go1.14.6] # go version
go version go1.14.6 linux/arm64
[:~/go/go1.14.6] # go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go/go1.14.6/golang"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/root/go/go1.14.6/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/root/go/go1.14.6/go/pkg/tool/linux_arm64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build659819657=/tmp/go-build -gno-record-gcc-switches"
please confirm that you have a 64-bit C compiler on the machine (that is, a C compiler that produces 64-bit executables)
I think this maybe it, it looks like gcc on this machine is 32-bit, and the two other compilers that support arm64 (gcc-6-arm-linux-gnueabihf and gcc-6-arm-linux-gnueabi) don't appear to be install-able on this machine.
[:~/c] 1 # gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
I can build 64-bit Go apps, it looks like the go-sqlite binding requires the C headers/code and its not obvious there is a problem until hitting backup.go:29
- presumably due to the previous C compiler step that generated 32-bit output.
I suspect this can be closed. Is there any way to get the Go compiler emit the C compiler call(s) its making under the covers?
Is there any way to get the Go compiler emit the C compiler call(s) its making under the covers?
Yes, it should do that if you pass the -x
flag to go build
.
Also, I cannot speak for your version of gcc specifically, but usually the -m64
flag tells it to produce 64-bit executables. So try running CC="gcc -m64" go build
and see if that fixes anything.
-m64
was my first (failed) attempt before then trying to install more compiler options :)
Thanks for the flag info, ended up with:
go build -x -a 2> build_log.log
I'm firmly convinced this is a lack of 64-bit C-compiler issue on my system.
Thanks again, closing.
commit 4c2df3cc4614a8001c1afdebcbda0fcf6e045719
The go version I have is:
go version go1.14.6 linux/arm64
Build fails:
machine info:
I'm not familiar with go, so I've no idea how to debug this :-( (I'm trying to build something else that depends on this and this appears to be the only stumbling block)