mattn / go-sqlite3

sqlite3 driver for go using database/sql
http://mattn.github.io/go-sqlite3
MIT License
7.83k stars 1.09k forks source link

cross compile error from mac to armv7 #1264

Closed donknap closed 1 month ago

donknap commented 1 month ago

compile command

CGO_ENABLED=1 GOARM=7 GOARCH=arm GOOS=linux CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ \
        go build -ldflags '-s -w' -o ./dpanel-arm ./*.go

download the arm toolchain from https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

err message

# runtime/cgo
arm-none-eabi-gcc: error: unrecognized command-line option '-pthread'; did you mean '-fpthread'?

Thank you so much!

rittneje commented 1 month ago

Your C compiler targets "bare metal" and thus is incompatible with cgo. You need one that targets Linux. (As I am not sure if such a toolchain exists for macos hosts, you may have better success compiling via a docker container.)

donknap commented 1 month ago

Your C compiler targets "bare metal" and thus is incompatible with cgo. You need one that targets Linux. (As I am not sure if such a toolchain exists for macos hosts, you may have better success compiling via a docker container.)

thanks,using arm-none-linux-gnueabihf compile successfully。

Why is there no hard float target in Mac?