Go-sqlite3: Compile to arm cpu error

Created on 29 Sep 2015  路  6Comments  路  Source: mattn/go-sqlite3

C source files not allowed when not using cgo or SWIG: sqlite3-binding.c

i try export CGO_ENABLED=1 but

runtime/cgo

clang: error: argument unused during compilation: '-mno-thumb'

What ideas can be compile successfully???

Most helpful comment

In case someone else stumbles on this as I did here is the complete info:

  • to cross compile you need the cross compiler. I am targeting hard float so mine is arm-linux-gnueabihf-gcc/arm-linux-gnueabihf-g++ . Get it installed - for linux there are official packages, for mac search around there are plenty of resources on how to get/install the gcc toolchain targeting arm
  • add the crosscompiler toolchain to the path
  • to build your go program you need to use the above compiler. Just run:
env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
    CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 \
    go build -v main.go

All 6 comments

:+1: on OSX (go version go1.5.2 darwin/amd64) building for Linux

$ CGO_ENABLED=1 GOOS=linux go build -v main.go
runtime
errors
sync/atomic
math
unicode/utf8
sort
unicode
sync
encoding
runtime/cgo
io
syscall
# runtime/cgo
ld: unknown option: --build-id=none
clang: error: linker command failed with exit code 1 (use -v to see invocation)
internal/singleflight
container/list

Hi.i got this problem too.
Did you fix this problem finally?How?

you compiler have --build-id flag?

CC=arm-none-linux-gnueabi-gcc
Finally, Use this flag to setup you own compiler, not use Clang.

go-sqlite3 doesn't require --build-id flag but seems go require it.

In case someone else stumbles on this as I did here is the complete info:

  • to cross compile you need the cross compiler. I am targeting hard float so mine is arm-linux-gnueabihf-gcc/arm-linux-gnueabihf-g++ . Get it installed - for linux there are official packages, for mac search around there are plenty of resources on how to get/install the gcc toolchain targeting arm
  • add the crosscompiler toolchain to the path
  • to build your go program you need to use the above compiler. Just run:
env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
    CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 \
    go build -v main.go
Was this page helpful?
0 / 5 - 0 ratings

Related issues

barnettZQG picture barnettZQG  路  7Comments

jacentsao picture jacentsao  路  6Comments

gaorongfu picture gaorongfu  路  10Comments

korovkin picture korovkin  路  12Comments

anacrolix picture anacrolix  路  6Comments