Open ashu171996 opened 3 years ago
My go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/ashutoshp/.cache/go-build" GOENV="/home/ashutoshp/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/ashutoshp/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/ashutoshp/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.16" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2380541700=/tmp/go-build -gno-record-gcc-switches"
@ashu171996 you have to specify location of the header file (also I guess the library).
You do that by setting CGO_LDFLAGS
and CGO_CPPFLAGS
variables
See similar issue
@ashu171996 'sudo apt-get install libjpeg-dev' should solve your issue :-)
For mac e.g. brew install jpeg
helps to retrieve the neccessary includes and libs.
Running e.g. CGO_LDFLAGS="-L/opt/homebrew/Cellar/jpeg/9d/lib -lm" CGO_CPPFLAGS="-I/opt/homebrew/Cellar/jpeg/9d/include" go get github.com/pixiv/go-libjpeg
would be able to load the package.
Adjust the version (9d) if it has changed.
Edit:
It's also possible to just use CGO_LDFLAGS="-L/opt/homebrew/lib -lm" CGO_CPPFLAGS="-I/opt/homebrew/include" go get github.com/pixiv/go-libjpeg
Or executing in your shell: export CPATH=/opt/homebrew/include export LIBRARY_PATH=/opt/homebrew/lib
or adding it to your shell rc file.
The above block appears while executing go get, any idea what to do next. Any help would be appreciated. Best regards Ashutosh