Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go build -asan may mis-parse gcc compiler version in a non-English environment #69221

Closed
jokemanfire opened this issue Sep 3, 2024 · 3 comments
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jokemanfire
Copy link

jokemanfire commented Sep 3, 2024

Go version

go version go1.21.0 linux/amd64 (master branch also influence)

Output of go env in your module/workspace:

GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/{username}/.cache/go-build'
GOENV='/home/{username}/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/{username}/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/{username}/go'
GOPRIVATE=''
GOPROXY='http://goproxy.cn'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/{username}/codetest/gotest/test/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3179341232=/tmp/go-build -gno-record-gcc-switches'

What did you do?

when I use go build -asan.

What did you see happen?

it report "-asan is not supported with gcc compiler 0.0"
gcc -v looks like this:
gcc -v

使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-newstart-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
目标:x86_64-newstart-linux
配置为:../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-newstart-linux
线程模型:posix
gcc 版本 8.4.1 20200928 

What did you expect to see?

that's because compilerVersion , Use of regular expressions is gcc version (\d+)\.(\d+) but, it couldn't pattern with 'gcc 版本 8.4.1 20200928 '

I think should change the regexp, if needed I would like to pull this pr.

jokemanfire added a commit to jokemanfire/go that referenced this issue Sep 3, 2024
Fixes golang#69221
work/init:compilerVersion support multi-language
jokemanfire pushed a commit to jokemanfire/go that referenced this issue Sep 3, 2024
Fixes golang#69221
work/init:compilerVersion support multi-language
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/610215 mentions this issue: work/init:Change regular expressions

jokemanfire pushed a commit to jokemanfire/go that referenced this issue Sep 4, 2024
Compiler's version will not work well if gcc output have
different language. If gcc -v, it may not output like:
'gcc version xx.xx.x'

Fixes golang#69221
@dmitshur dmitshur changed the title Get compilerVersion may not correct,if cc use Chinese cmd/go: go build -asan may mis-parse gcc compiler version in a non-English environment Sep 4, 2024
@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FixPending Issues that have a fix which has not yet been reviewed or submitted. labels Sep 4, 2024
@dmitshur dmitshur added this to the Backlog milestone Sep 4, 2024
@dmitshur
Copy link
Contributor

dmitshur commented Sep 4, 2024

CC @matloob, @ianlancetaylor.

@dmitshur dmitshur added the GoCommand cmd/go label Sep 4, 2024
jokemanfire pushed a commit to jokemanfire/go that referenced this issue Sep 5, 2024
Compiler's version will not work well if gcc output have
different language. If gcc -v, it may not output like:
'gcc version xx.xx.x'

Fixes golang#69221
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Sep 7, 2024
@dmitshur dmitshur modified the milestones: Backlog, Go1.24 Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants