porter-archive icon indicating copy to clipboard operation
porter-archive copied to clipboard

local docker throw error on apple silicon

Open ericjee opened this issue 3 years ago • 3 comments

Description

air script is not compatible with apple silicon architecture

Location

  • [ ] Browser
  • [ ] CLI
  • [ ] API

Steps to reproduce

  1. docker-compose -f docker-compose.dev.yaml up

Additional Details

porter_1    | building...
porter_1    | # github.com/porter-dev/porter/cmd/app
porter_1    | /usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1
porter_1    | collect2: fatal error: cannot find 'ld'
porter_1    | compilation terminated.
porter_1    |
porter_1    | failed to build, error: exit status 2

ericjee avatar Sep 08 '22 00:09 ericjee

I can create a pull request if needed, just add CGO_ENABLED=0 GOOS=linux GOARCH=amd64 to .air.toml.

ericjee avatar Sep 08 '22 00:09 ericjee

I can create a pull request if needed, just add CGO_ENABLED=0 GOOS=linux GOARCH=amd64 to .air.toml.

Hey @ericjee, thanks for the bug report! I believe CGO_ENABLED must be set to 1 for compilation, otherwise the sqlite package will not build.

What version of go are you using, and what's the output of go env? Here's what's running for me:

Go version: go1.18.1 darwin/arm64

Go env:

GOARCH="arm64"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/91/s5qm43hd03xcm8z_vp4f64xw0000gn/T/go-build2504874555=/tmp/go-build -gno-record-gcc-switches -fno-common"

abelanger5 avatar Sep 15 '22 12:09 abelanger5

Hi @abelanger5

go env shows below:

GO111MODULE=""
GOARCH="arm64"
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t4/854sg0dx5ql9g7nw32jrghgh0000gn/T/go-build1632971238=/tmp/go-build -gno-record-gcc-switches -fno-common"

ericjee avatar Sep 15 '22 12:09 ericjee

Worked for me thanks

B57A67 avatar Mar 29 '23 07:03 B57A67

Closing this as CGO is no longer a dependency for Porter

stefanmcshane avatar Jun 01 '23 19:06 stefanmcshane