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/cgo: clang doesn't support no-eliminate-unused-debug-types #7278

Closed
gopherbot opened this issue Feb 6, 2014 · 16 comments
Closed

cmd/cgo: clang doesn't support no-eliminate-unused-debug-types #7278

gopherbot opened this issue Feb 6, 2014 · 16 comments

Comments

@gopherbot
Copy link
Contributor

by jacob.amrany:

I already read issue #6515

This is the version installed by homebrew via 'brew install go'

To reproduce my exact situation...
On OSX, run 'go get github.com/fawick/go-mapnik'
Then try to build demo.go

What is the expected output?
go build should successfully terminate

What do you see instead?
[j:go-mapnik]$ go build demo.go
# github.com/fawick/go-mapnik/mapnik
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'

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

Which operating system are you using?
OSX

Which version are you using?  (run 'go version')
go version go1.2 darwin/amd64

Please provide any additional information below.
I already checked out the issue at https://golang.org/issue/6515
This should be fixed in go1.2, however, I am still getting that error.
@davecheney
Copy link
Contributor

Comment 1:

Hi Jacob,
Please check that you do not have multiple versions of Go installed on your machine.
Please also check that you have not set GOROOT.
This has resolved this issue in the past, please reply if this does not resolve the
issue.
Cheers
Dave

Status changed to WaitingForReply.

@minux
Copy link
Member

minux commented Feb 6, 2014

Comment 2:

I want to reemphasize that Go 1.2 never passes -fno-eliminate-unused-debug-types
to any compiler.
please check the following:
1. are you sure you are really using Go 1.2?
Have you tried to install the official binary distributions?
2. have you tried to unset GOROOT?
(I suspect this the cause, you have a GOROOT pointing to an older Go installation.)
What's the output of:
go env
go version
go build -x demo.go

@minux
Copy link
Member

minux commented Feb 6, 2014

Comment 3:

I really want to get rid of GOROOT.
It is causing more problems than it solves.

@gopherbot
Copy link
Contributor Author

Comment 4 by jacob.amrany:

I had multiple versions of go. I removed one of them (And found that I was setting the
other in ~/.bash_profile). I removed GOROOT and GOBIN but kept GOPATH. 
The complaint is 'fatal error: 'unicode/unistr.h' file not found'
I managed to get around this by adding the correct path to my $PATH variable before, but
it is not appeasing cgo. 
Since I can't really test the fix you gave me, I'll just take your word for it. Later,
when I get a chance, I'll test this out on an OSX install with no prior go versions. 
Thank you.

@davecheney
Copy link
Contributor

Comment 5:

You might have to remove then reinstall the version you installed via homebrew.

@gopherbot
Copy link
Contributor Author

Comment 6 by jacob.amrany:

I tried that already. It didn't work. The missing file is in the unicode
library icu.  This is on OSX by default, but does not have the headers. I
had to install that via homebrew, which worked fine. The problem now is
that go build cannot seem to find the include path, which I am appending to
my $PATH.

@gopherbot
Copy link
Contributor Author

Comment 7 by jacob.amrany:

go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/j/gopath"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64"
TERM="dumb"
CC="clang"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common"
CXX="clang++"
CGO_ENABLED="1"
go version
go version go1.2 darwin/amd64
go build -x demo.go
[j:go-mapnik]$ go build -x demo.go
WORK=/var/folders/dz/z947gc557xj912qnc705m1bm0000gn/T/go-build007112971
mkdir -p $WORK/github.com/fawick/go-mapnik/mapnik/_obj/
mkdir -p $WORK/github.com/fawick/go-mapnik/
cd /Users/j/gopath/src/github.com/fawick/go-mapnik/mapnik
/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64/cgo -objdir
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -- -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ mapnik.go
/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64/6c -F -V -w -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -I
/usr/local/Cellar/go/1.2/libexec/pkg/darwin_amd64 -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_defun.6 -D GOOS_darwin -D
GOARCH_amd64 $WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_defun.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common -print-libgcc-file-name
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common -I $WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_main.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_main.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common -I $WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_export.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_export.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common -I $WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik.cgo2.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik.cgo2.c
clang++ -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fno-common -I $WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik_c_api.cpp.o -c ./mapnik_c_api.cpp
# github.com/fawick/go-mapnik/mapnik
In file included from mapnik/mapnik_c_api.cpp:5:
In file included from /usr/local/include/mapnik/agg_renderer.hpp:28:
In file included from /usr/local/include/mapnik/feature_style_processor.hpp:27:
In file included from /usr/local/include/mapnik/datasource.hpp:28:
In file included from /usr/local/include/mapnik/params.hpp:28:
/usr/local/include/mapnik/value_types.hpp:27:10: fatal error: 'unicode/unistr.h' file
not found

@gopherbot
Copy link
Contributor Author

Comment 8 by jacob.amrany:

go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/j/gopath"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64"
TERM="dumb"
CC="clang"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common"
CXX="clang++"
CGO_ENABLED="1"
go version
go version go1.2 darwin/amd64
go build -x demo.go
[j:go-mapnik]$ go build -x demo.go
WORK=/var/folders/dz/z947gc557xj912qnc705m1bm0000gn/T/go-build007112971
mkdir -p $WORK/github.com/fawick/go-mapnik/mapnik/_obj/
mkdir -p $WORK/github.com/fawick/go-mapnik/
cd /Users/j/gopath/src/github.com/fawick/go-mapnik/mapnik
/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64/cgo -objdir
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -- -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ mapnik.go
/usr/local/Cellar/go/1.2/libexec/pkg/tool/darwin_amd64/6c -F -V -w -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -I
/usr/local/Cellar/go/1.2/libexec/pkg/darwin_amd64 -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_defun.6 -D
GOOS_darwin -D GOARCH_amd64
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_defun.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common -print-libgcc-file-name
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_main.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_main.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_export.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/_cgo_export.c
clang -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik.cgo2.o -c
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik.cgo2.c
clang++ -I . -g -O2 -fPIC -m64 -pthread -fno-caret-diagnostics
-Qunused-arguments -fno-common -I
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/ -o
$WORK/github.com/fawick/go-mapnik/mapnik/_obj/mapnik_c_api.cpp.o -c
./mapnik_c_api.cpp
# github.com/fawick/go-mapnik/mapnik
In file included from mapnik/mapnik_c_api.cpp:5:
In file included from /usr/local/include/mapnik/agg_renderer.hpp:28:
In file included from /usr/local/include/mapnik/feature_style_processor.hpp:27:
In file included from /usr/local/include/mapnik/datasource.hpp:28:
In file included from /usr/local/include/mapnik/params.hpp:28:
/usr/local/include/mapnik/value_types.hpp:27:10: fatal error:
'unicode/unistr.h' file not found

@minux
Copy link
Member

minux commented Feb 6, 2014

Comment 9:

> The problem now is that go build cannot seem to find the include path, which I am
appending to my $PATH.
You should define CGO_CFLAGS="-I/path/to/icu" for that.

Status changed to Retracted.

@gopherbot
Copy link
Contributor Author

Comment 10 by jacob.amrany:

I removed my homebrew version and I removed my GOROOT
[j:go-mapnik]$ go env
GOARCH="amd64"
GOBIN="/Users/j/go/bin"
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/j/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread -fno-common"
CGO_ENABLED="1"
I ran this command: hg clone -u release https://code.google.com/p/go
Then I tried to build demo.go
[j:go-mapnik]$ go build demo.go
# github.com/fawick/go-mapnik/mapnik
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'
I think I'm going to give up on this one. Thanks for your help guys.

@minux
Copy link
Member

minux commented Feb 7, 2014

Comment 11:

which is your Go command comes from?
what's the output of:
where go
/usr/local/go/bin/go version

@davecheney
Copy link
Contributor

Comment 12:

Please don't give up, you are very close.
1. remove every environment variable you set save GOPATH. You only need to set GOPATH.
2. If you have used homebrew, you are done
3. If you have installed go using the tarball, ensure /usr/local/go/bin is in your path
4. Ensure no over versions of Go are in your path.
That is all that should be required.
The root cause is a mixture of go installs on your machine. Once you resolve that the
problem should cease.

@minux
Copy link
Member

minux commented Feb 7, 2014

Comment 13:

@dave, what's your opinion to make cmd/go write the content of $GOROOT/VERSION
in the output of "go build -x"?

@davecheney
Copy link
Contributor

Comment 14:

I don't think it is necessary, -x will show the full path of the tool it is calling.

@minux
Copy link
Member

minux commented Feb 7, 2014

Comment 15:

if both our proposals to eliminate GOROOT are rejected, I think we add something like
this
in output of "go build -x":
# $GOROOT overrides GOROOT (/Users/u/go) to /usr/local/go/.
This will at least make diagnosing the problem easier.

@davecheney
Copy link
Contributor

Comment 16:

I wouldn't do a warning. 
If the go tool can detect the misconfiguration it should refuse to run.

@golang golang locked and limited conversation to collaborators Jun 25, 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

3 participants