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

gccgo: vendoring doesn't work in gcc 6.1 #15628

Closed
urandom opened this issue May 10, 2016 · 8 comments
Closed

gccgo: vendoring doesn't work in gcc 6.1 #15628

urandom opened this issue May 10, 2016 · 8 comments
Milestone

Comments

@urandom
Copy link

urandom commented May 10, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.6.1 gccgo (GCC) 6.1.1 20160501 linux/amd64

  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/urandom/.go"
    GORACE=""
    GOROOT="/usr"
    GOTOOLDIR="/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1"
    GO15VENDOREXPERIMENT="1"
    CC="/usr/bin/gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
    CXX="/usr/bin/g++"
    CGO_ENABLED="1"

  3. What did you do?
    go get -u github.com/hashicorp/consul

  4. What did you expect to see?
    No errors

  5. What did you see instead?

    github.com/hashicorp/consul/vendor/github.com/armon/go-metrics/datadog

    github.com/hashicorp/consul/vendor/github.com/armon/go-metrics/datadog/dogstatsd.go:7:38: error: import file ‘github.com/DataDog/datadog-go/statsd’ not found
    "github.com/DataDog/datadog-go/statsd"

And many more after that

@mwhudson
Copy link
Contributor

FWIW, I think this might be quite easy to fix: when compiling package p from GOPATH component q, pass -I q/pkg_GOOS_GOARCH_gccgo/vendor/ to gccgo, if it exists. (Or maybe it needs to be more complicated than this, I don't really know how vendoring is implemented)

@a13xb
Copy link

a13xb commented Jun 8, 2016

@mwhudson It should be. We have the same issue and work around it by using a manual shell script that adds vendor directory to the include path set.

@laboger
Copy link
Contributor

laboger commented Aug 8, 2016

This continues to fail with the upgrade in gcc trunk to Go 1.7.

@a13xb
Copy link

a13xb commented Aug 8, 2016

For anyone interested, we have added a dodgy workaround by setting $GCCGO to the path of this wrapper script, and setting $REALGCCO to the actual compiler path.

#!/usr/bin/env python
import os, sys
gccgo = os.environ['REALGCCGO']
args = sys.argv[1:]
work = [a for a in args if a.startswith('/tmp/go-build')][0]
args += ['-I', work + '/my-project-import-path/vendor']
os.execlp(gccgo, gccgo, *args)

I haven't had the patience to make a more general solution, but this one works OK for a single project.

@tamird
Copy link
Contributor

tamird commented Feb 1, 2017

Continues to fail with the upgrade in gcc trunk to go1.8rc3 (gcc-mirror/gcc@905e044).

nalind added a commit to nalind/storage that referenced this issue Mar 6, 2017
Use a workaround from golang/go#15628 for
issues with newer-style vendoring in gcc-go.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
nalind added a commit to nalind/storage that referenced this issue Mar 6, 2017
Use a workaround from golang/go#15628 for
issues with newer-style vendoring in gcc-go.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
nalind added a commit to nalind/storage that referenced this issue Mar 6, 2017
Use a workaround from golang/go#15628 for
issues with newer-style vendoring in gcc-go.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
nalind added a commit to nalind/storage that referenced this issue Mar 6, 2017
Use a workaround from golang/go#15628 for
issues with newer-style vendoring in gcc-go.

Travis's trusty images have gcc-go 4.9, which implements Go 1.2, so it's
missing sync.Pool (introduced in 1.3), so we can't enable the test
there.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@laboger
Copy link
Contributor

laboger commented Apr 11, 2017

I have submitted this CL for gccgo (gofrontend) to fix this problem. https://go-review.googlesource.com/c/39590/. Once it is approved I will submit the corresponding change to golang so it will work the same when using the option -compiler gccgo. It fixes the example posted above.

@gopherbot
Copy link

CL https://golang.org/cl/39590 mentions this issue.

pmatos pushed a commit to LinkiTools/gcc that referenced this issue Apr 12, 2017
    cmd/go: generate vendor paths for -I arg on compile
    
    This change generates the vendor path to be used with -I
    on a gccgo compile to find imports from the vendor directories.
    
    Fixes golang/go#15628
    
    Reviewed-on: https://go-review.googlesource.com/39590


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246864 138bc75d-0d04-0410-961f-82ee72b054a4
@gopherbot
Copy link

CL https://golang.org/cl/40432 mentions this issue.

gopherbot pushed a commit that referenced this issue Apr 12, 2017
Curently the vendor paths are not always searched for imports if
the compiler is gccgo.  This change generates the vendor paths
and adds them with -I as arguments to the gccgo compile.

Fixes #15628

Change-Id: I318accbbbd8e6af45475eda399377455a3565880
Reviewed-on: https://go-review.googlesource.com/40432
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
Curently the vendor paths are not always searched for imports if
the compiler is gccgo.  This change generates the vendor paths
and adds them with -I as arguments to the gccgo compile.

Fixes golang#15628

Change-Id: I318accbbbd8e6af45475eda399377455a3565880
Reviewed-on: https://go-review.googlesource.com/40432
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Apr 12, 2018
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

8 participants