You are not logged in.

#1 2024-05-16 10:28:33

EugeneS
Member
Registered: 2023-12-19
Posts: 10

Compiling Go 1.22 code with gccgo (Go 1.18) and getting import errors

I have a CLI utility written in Go 1.22 and it works great! However, I'm interested in trying out gccgo (included in a gcc-snapshot with Go 1.18) for potential performance and file size improvements.

So, I have installed gcc-go-snapshot. But when I try to compile my code with gccgo, I get a bunch of import errors for standard library packages:

could not import encoding/json (no required module provides package "encoding/json") could not import time (no required module provides package "time") ...

I've tried setting GOPATH/GOBIN and disabling Go modules (go env -w GO111MODULE=off), but I'm still having issues.

I have following project structure:

user
  go
  dev
    utility
So, I have tried to set GOPATH=//home/user/go, GOBIN=$GOPATH/bin. I have also tried to move dev/utility to go/src/utility, but none of that helped.
Am I missing some dependency?

Offline

#2 2024-05-21 02:01:05

EISENFELD
Member
From: Germany
Registered: 2024-03-13
Posts: 44
Website

Re: Compiling Go 1.22 code with gccgo (Go 1.18) and getting import errors

Did you already tried all this :
https://go.dev/doc/install/gccgo#Using_gccgo ?


Ich weiß, dass ich nichts weiß !

Offline

Board footer

Powered by FluxBB