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 test + gccgo + package main #3262

Closed
alberts opened this issue Mar 9, 2012 · 3 comments
Closed

cmd/go: go test + gccgo + package main #3262

alberts opened this issue Mar 9, 2012 · 3 comments
Milestone

Comments

@alberts
Copy link
Contributor

alberts commented Mar 9, 2012

What steps will reproduce the problem?

Bear with me. I did the strange thing of compiling the 6g distribution's packages under
a new tree with gccgo and tried to run the tests. Script is at the bottom.

What do you see instead?

This mostly works, except for the packages I deleted, and a few tests that don't compile.

One failure caught my eye though:

# testmain
../tmp/go-build133648070/std/exp/ebnflint/_test/_testmain.go:9:2: error: imported
package uses same package name and prefix as package being compiled (see -fgo-prefix
option)
# testmain
../tmp/go-build133648070/std/exp/gotype/_test/_testmain.go:9:2: error: imported package
uses same package name and prefix as package being compiled (see -fgo-prefix option)

Is this right? Why does everything else work?

Which compiler are you using (5g, 6g, 8g, gccgo)?

gccgo

Which operating system are you using?

linux

Which revision are you using?  (hg identify)

go version weekly.2012-03-04 +ee68d043e7f5

gccgo:

commit 7714837c8d8c66a53d87e4de6818fe47e1bb51d3
Author: gingold <gingold@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Mar 9 11:49:50 2012 +0000
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185136
138bc75d-0d04-0410-961f-82ee72b054a4

Please provide any additional information below.

#!/bin/bash
set -xe
TMPDIR=$GOROOT/tmp
GOPATH=$GOROOT/std
#trap "rm -rf $TMPDIR $GOPATH; exit" INT TERM EXIT
rm -rf $TMPDIR $GOPATH
mkdir $TMPDIR
mkdir -p $GOPATH/src
cp -a $GOROOT/src/pkg $GOPATH/src/std
cd $GOPATH

# recursive types
rm -rf src/std/builtin

# asm code
rm -rf src/std/bytes
rm -rf src/std/sync/atomic
rm -rf src/std/hash/crc32
rm -rf src/std/math/big
rm -rf src/std/math
rm -rf src/std/os/signal
rm -rf src/std/syscall

# missing syscall bits
rm -rf src/std/exp/inotify

# MaxRune change
rm -rf src/std/fmt
rm -rf src/std/strconv

# runtime.Compiler missing
rm -rf src/std/go/build

# cgo issue? exec: "": executable file not found in $PATH
rm -rf src/std/net

#src/std/os/stat_linux.go:22:29: error: reference to undefined field or method ‘Mtim’
#src/std/os/stat_linux.go:60:50: error: reference to undefined field or method ‘Atim’
rm -rf src/std/os

# C code causes confusion
rm -rf src/std/runtime

#src/std/reflect/type.go:947:66: error: incompatible types in binary expression
#src/std/reflect/type.go:1009:69: error: incompatible types in binary expression
rm -rf src/std/reflect

go test -compiler=gccgo -gccgoflags '--coverage' -v -work -short ./...

rm -rf $GOPATH
trap - EXIT
@rsc
Copy link
Contributor

rsc commented Mar 9, 2012

Comment 1:

I believe that this is happening because the test main is
package main but so is the package being tested.
Thanks for the report.

Labels changed: added priority-go1, removed priority-triage.

Owner changed to builder@golang.org.

Status changed to Accepted.

@alberts
Copy link
Contributor Author

alberts commented Mar 10, 2012

Comment 2:

There's two more test compilations that fail that look like it might be an issue with
gccgo or go:
# testmain
go/std/src/std/sync/cond.go:67: error: undefined reference to
'fake_std_sync.sync.runtime_Semacquire'
go/std/src/std/sync/cond.go:86: error: undefined reference to
'fake_std_sync.sync.runtime_Semrelease'
go/std/src/std/sync/cond.go:100: error: undefined reference to
'fake_std_sync.sync.runtime_Semrelease'
go/std/src/std/sync/cond.go:106: error: undefined reference to
'fake_std_sync.sync.runtime_Semrelease'
go/std/src/std/sync/mutex.go:60: error: undefined reference to
'fake_std_sync.sync.runtime_Semacquire'
go/std/src/std/sync/mutex.go:89: error: undefined reference to
'fake_std_sync.sync.runtime_Semrelease'
go/std/src/std/sync/rwmutex.go:29: error: undefined reference to
'fake_std_sync.sync.runtime_Semacquire'
go/std/src/std/sync/rwmutex.go:60: error: undefined reference to
'fake_std_sync.sync.runtime_Semacquire'
collect2: error: ld returned 1 exit status
# testmain
go/std/src/std/time/sleep.go:11: error: undefined reference to 'fake_std_time.time.now'
go/std/src/std/time/sleep.go:40: error: undefined reference to
'fake_std_time.time.stopTimer'
go/std/src/std/time/sleep.go:55: error: undefined reference to
'fake_std_time.time.startTimer'
go/std/src/std/time/sleep.go:89: error: undefined reference to
'fake_std_time.time.startTimer'
go/std/src/std/time/tick.go:37: error: undefined reference to
'fake_std_time.time.startTimer'
go/std/src/std/time/tick.go:43: error: undefined reference to
'fake_std_time.time.stopTimer'
go/std/src/std/time/time.go:716: error: undefined reference to 'fake_std_time.time.now'
go/std/src/std/time/zoneinfo_read.go:182: error: undefined reference to
'fake_std_time.time.now'
go/std/src/std/time/example_test.go:35: error: undefined reference to
'fake_std_time.time.Sleep'
go/std/src/std/time/sleep_test.go:24: error: undefined reference to
'fake_std_time.time.Sleep'
go/std/src/std/time/sleep_test.go:20: error: undefined reference to
'fake_std_time.time.Sleep'
go/std/src/std/time/sleep_test.go:42: error: undefined reference to
'fake_std_time.time.Sleep'
collect2: error: ld returned 1 exit status

@remyoudompheng
Copy link
Contributor

Comment 3:

This issue was closed by revision 3211b2c.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants