Could not import C error in GO environment

Error occurred

A mysterious error when trying to update the schema with gqlgen in Go's graphql library

/go/src # go run github.com/99designs/gqlgen
validation failed: packages.Load: /usr/local/go/src/net/cgo_linux.go:12:8: could not import C (no metadata for C)
exit status 1

Solution

Apparently gcc is not on the docker image. Maybe this? Https://github.com/golangci/golangci-lint/issues/602

After updating the apk with apk update, I put in a build package called alpine-sdk and it worked. Regarding apk, this article was easy to understand.

/go/src # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz

fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
v3.12.1-44-g754f23ac8f [http://dl-cdn.alpinelinux.org/alpine/v3.12/main]
v3.12.1-41-g42f619918d [http://dl-cdn.alpinelinux.org/alpine/v3.12/community]
OK: 12746 distinct packages available
/go/src # apk add alpine-sdk
(1/37) Upgrading musl (1.1.24-r9 -> 1.1.24-r10)
  0%                                                                                                                                                                                                                   
(2/37) Installing fakeroot (1.24-r0)
(3/37) Installing openssl (1.1.1g-r0)
(4/37) Installing libattr (2.4.48-r0)
(5/37) Installing attr (2.4.48-r0)
(6/37) Installing libacl (2.2.53-r0)
(7/37) Installing tar (1.32-r1)
(8/37) Installing pkgconf (1.7.2-r0)
(9/37) Installing patch (2.7.6-r6)
(10/37) Installing libgcc (9.3.0-r2)
(11/37) Installing libstdc++ (9.3.0-r2)
(12/37) Installing lzip (1.21-r0)
(13/37) Installing nghttp2-libs (1.41.0-r0)
(14/37) Installing libcurl (7.69.1-r1)
(15/37) Installing curl (7.69.1-r1)
(16/37) Installing abuild (3.6.0-r1)
Executing abuild-3.6.0-r1.pre-install
(17/37) Installing binutils (2.34-r1)
(18/37) Installing libmagic (5.38-r0)
(19/37) Installing file (5.38-r0)
(20/37) Installing gmp (6.2.0-r0)
(21/37) Installing isl (0.18-r0)
(22/37) Installing libgomp (9.3.0-r2)
(23/37) Installing libatomic (9.3.0-r2)
(24/37) Installing libgphobos (9.3.0-r2)
(25/37) Installing mpfr4 (4.0.2-r4)
(26/37) Installing mpc1 (1.1.0-r1)
(27/37) Installing gcc (9.3.0-r2)
(28/37) Installing musl-dev (1.1.24-r10)
(29/37) Installing libc-dev (0.7.2-r3)
(30/37) Installing g++ (9.3.0-r2)
(31/37) Installing make (4.3-r0)
(32/37) Installing fortify-headers (1.1-r0)
(33/37) Installing build-base (0.5-r2)
(34/37) Installing expat (2.2.9-r1)
(35/37) Installing pcre2 (10.35-r0)
(36/37) Installing git (2.26.2-r0)
(37/37) Installing alpine-sdk (1.0-r0)
Executing busybox-1.31.1-r19.trigger
OK: 224 MiB in 51 packages

Soliloquy

Did the docker image golang: 1.15.5-alpine3.12 you are using go wrong? .. Please tell me the details> _ <

Recommended Posts

Could not import C error in GO environment
Automate CircleCI environment variable registration in Go
Error "Entry point not found" when starting Jupyter Notebook in virtual environment
Tkinter could not be imported in Python
Import Error in Python3: No module named'xxxxx'
Hello World with gRPC / go in Docker environment
Error running Jupyter Notebook in Anaconda virtual environment
Error in random.shuffle
scikit-learn import error
Error in Pyinstaller
Error in TensorBoard
About import error of numpy and scipy in anaconda
I get an Import Error in Python Beautiful Soup
Note: CGI (during trial and error) in Vagrant environment
When import matplotlib.pyplot cannot be done in pyenv-virtualenv environment
When "ERROR: HTTP is not supported." Is displayed in mpsyt
How to install poetry (error handling) in zsh environment
Go language to see and remember Part 7 C language in GO language
Dealing with Tensorflow error "Import Error: DLL load failed: Specified module not found" in deep learning