Sukeesh
Sukeesh

Reputation: 313

Golang debugger not starting up on Goland

I started to see the following error on my Goland IDE whenever I try to debug an application.

# runtime/cgo
cgo-builtin-prolog:1:10: fatal error: cannot open file '/usr/local/include/stddef.h': Permission denied
#include <stddef.h> /* for ptrdiff_t and size_t below */
         ^
1 error generated.

Here is my go env

GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/sukeesh/Library/Caches/go-build"
GOENV="/Users/sukeesh/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/sukeesh/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sukeesh/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/sukeesh/go/go1.18"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/sukeesh/go/go1.18/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sukeesh/go/src/github.com/epiFi/gamma/go.mod"
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/jg/d8ghq_vx6mb1k3zjcv10bctc0000gp/T/go-build2149253438=/tmp/go-build -gno-record-gcc-switches -fno-common"

I am unable to run debug tool on Goland IDE. Can someone please help me solve this issue? Thanks in advance.

Upvotes: 1

Views: 1001

Answers (2)

rachitmanit
rachitmanit

Reputation: 334

Original permissions for include directory:

sudo ls -l /usr/local/

drwxr-x---@ 4 root wheel 128B Aug 1 18:18 include

Modifying directory permission to below worked for me on Mac

sudo chmod -R 755 /usr/local/include

Upvotes: 0

sunbro
sunbro

Reputation: 1

modify the directory permission, it will be ok

Upvotes: 0

Related Questions