compiler-explorer / compiler-explorer/infra

Support Go modules for gccgo compilers

Open
#1,946 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
434
Forks
429
Avg merge
4d 21h
Merged PRs (30d)
38

Description

The `go_library_builder.py` currently skips gccgo compilers because modules don't work with our GCC installations.

## Root Cause

The `go` tool bundled with gccgo has hardcoded build staging paths that don't exist in the deployed environment:

```
$ GOROOT=/opt/compiler-explorer/gcc-14.2.0 LD_LIBRARY_PATH=/opt/compiler-explorer/gcc-14.2.0/lib64 \
/opt/compiler-explorer/gcc-14.2.0/bin/go build .
cmd/go: gccgo: exec: "/opt/compiler-explorer/gcc-build/staging/bin/gccgo": stat /opt/compiler-explorer/gcc-build/staging/bin/gccgo: no such file or directory
```

The `go` binary works for basic operations but looks for `gccgo` at the original build path rather than the installation path.

## Potential Solutions

1. Rebuild GCC with correct installation paths (configure `--prefix` to match deployment location)
2. Build a wrapper script that sets up the environment correctly
3. Patch the `go` binary post-build to fix the hardcoded paths

## References

- gccgo does support modules when properly configured: https://forum.golangbridge.org/t/building-modules-with-gccgo/17522
- Current skip list in `go_library_builder.py`: `SKIP_COMPILERS = ["gotip", "go-tip", "gccgo"]`

Contributor guide

Open the contributing guide

Research direction

Start in go_library_builder.py and inspect the SKIP_COMPILERS list, then trace how gccgo installations are built and deployed. Reproduce the module build failure with the documented GOROOT and LD_LIBRARY_PATH, and compare the hardcoded staging path with the deployed compiler path. Done means gccgo is no longer skipped and Go modules build successfully with the installed compiler.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, python
Domain
build-system, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.