gccgo: error: unrecognized command line option ‘-framework’

811 views
Skip to first unread message

Gong Su

unread,
Oct 15, 2013, 11:51:04 AM10/15/13
to golan...@googlegroups.com
Hi, I'm trying to compile the directory server component of dea_ng using gccgo (I'm on a platform, IBM s390x, that doesn't have a native gc compiler yet). It fails when trying to create the executable from runner.go:

root@pandb:~/dea_ng/go/src/runner# GOARCH=amd64 GOROOT=/usr/local/lib/go4.8 GOPATH=/root/dea_ng/go go install -compiler gccgo -x
WORK=/tmp/go-build681814294
mkdir -p $WORK/runner/_obj/
mkdir -p $WORK/runner/_obj/exe/
cd /root/dea_ng/go/src/runner
gccgo -I $WORK -I /root/dea_ng/go/pkg/gccgo_linux_amd64 -c -g -m64 -fgo-relative-import-path=_/root/dea_ng/go/src/runner -o $WORK/runner/_obj/main.o ./runner.go
ar cru $WORK/librunner.a $WORK/runner/_obj/main.o
cd .
gccgo -o $WORK/runner/_obj/exe/a.out $WORK/runner/_obj/main.o -Wl,-( -m64 /root/dea_ng/go/pkg/gccgo/github.com/cloudfoundry/gosteno/libsyslog.a /root/dea_ng/go/pkg/gccgo/launchpad.net/libgoyaml.a /root/dea_ng/go/pkg/gccgo/libcommon.a /root/dea_ng/go/pkg/gccgo/github.com/howeyc/libfsnotify.a /root/dea_ng/go/pkg/gccgo/libdirectoryserver.a /root/dea_ng/go/pkg/gccgo/github.com/cloudfoundry/libgosteno.a -framework CoreFoundation -framework Security -Wl,-)
# runner
gccgo: error: CoreFoundation: No such file or directory
gccgo: error: Security: No such file or directory
gccgo: error: unrecognized command line option ‘-framework’
gccgo: error: unrecognized command line option ‘-framework’

The gccgo version I'm using is 4.8.1:

root@pandb:~/dea_ng/go/src/runner# gccgo -v
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/usr/lib/gcc/s390x-linux-gnu/4.8/lto-wrapper
Target: s390x-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.1-10' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libsanitizer --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-s390x/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-s390x --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-s390x --with-arch-directory=s390x --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-long-double-128 --enable-checking=release --build=s390x-linux-gnu --host=s390x-linux-gnu --target=s390x-linux-gnu
Thread model: posix
gcc version 4.8.1 (Debian 4.8.1-10)

Is there any way around this? Thank you.

Ian Lance Taylor

unread,
Oct 15, 2013, 1:38:32 PM10/15/13
to Gong Su, golang-nuts
On Tue, Oct 15, 2013 at 8:51 AM, Gong Su <gongsu...@gmail.com> wrote:
>
> Hi, I'm trying to compile the directory server component of dea_ng using
> gccgo (I'm on a platform, IBM s390x, that doesn't have a native gc compiler
> yet). It fails when trying to create the executable from runner.go:

> gccgo -o $WORK/runner/_obj/exe/a.out $WORK/runner/_obj/main.o -Wl,-( -m64
> /root/dea_ng/go/pkg/gccgo/github.com/cloudfoundry/gosteno/libsyslog.a
> /root/dea_ng/go/pkg/gccgo/launchpad.net/libgoyaml.a
> /root/dea_ng/go/pkg/gccgo/libcommon.a
> /root/dea_ng/go/pkg/gccgo/github.com/howeyc/libfsnotify.a
> /root/dea_ng/go/pkg/gccgo/libdirectoryserver.a
> /root/dea_ng/go/pkg/gccgo/github.com/cloudfoundry/libgosteno.a -framework
> CoreFoundation -framework Security -Wl,-)
> # runner
> gccgo: error: CoreFoundation: No such file or directory
> gccgo: error: Security: No such file or directory
> gccgo: error: unrecognized command line option ‘-framework’
> gccgo: error: unrecognized command line option ‘-framework’

Where are those -framework options coming from? I don't see anything
in the go tool that would be adding them. They aren't coming from
gccgo itself either.

Do you have any environment variables that contain -framework, e.g.,
LDFLAGS? Or are you linking against any Go packages that use cgo with
#cgo LDFLAGS?

Ian

Gong Su

unread,
Oct 15, 2013, 3:17:43 PM10/15/13
to golan...@googlegroups.com, Gong Su
Hi Ian, thanks for the reply.

That's what confuses me too. I have NO go related env variables nor LDFLAGS set. The only go related env variables are set on the command line:


GOARCH=amd64 GOROOT=/usr/local/lib/go4.8 GOPATH=/root/dea_ng/go go install -compiler gccgo -x

And all the .a libraries involved were generated manually using the same command above. The -framework option must have somehow come from the "go" front-end tool since that's the only command I execute. Is there any other diag output that can be turned on for "go" or "gccgo" that might help?

Thanks.

Ian Lance Taylor

unread,
Oct 15, 2013, 3:49:40 PM10/15/13
to Gong Su, golang-nuts
On Tue, Oct 15, 2013 at 12:17 PM, Gong Su <gongsu...@gmail.com> wrote:
>
> That's what confuses me too. I have NO go related env variables nor LDFLAGS
> set. The only go related env variables are set on the command line:
>
>
> GOARCH=amd64 GOROOT=/usr/local/lib/go4.8 GOPATH=/root/dea_ng/go go install
> -compiler gccgo -x
>
> And all the .a libraries involved were generated manually using the same
> command above. The -framework option must have somehow come from the "go"
> front-end tool since that's the only command I execute. Is there any other
> diag output that can be turned on for "go" or "gccgo" that might help?

OK, if you're sure it's not in your source code, then I think it must
be coming from src/pkg/crypto/x509/root_darwin.go, where I see

#cgo LDFLAGS: -framework CoreFoundation -framework Security

If that package were somehow being built, that would explain what you
are seeing. However, it does not make sense that the go tool would
compile root_darwin.go on an s390x system. Do you have GOOS set in
the environment? How did you build the go tool that you are using?

Ian
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/8568ad08-f5a0-4d0b-bc11-e94246cf32da%40googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

Rob Pike

unread,
Oct 15, 2013, 4:00:33 PM10/15/13
to Ian Lance Taylor, Gong Su, golang-nuts
There's some "-framework"-related code in cmd/go/build.go around line 2020 that's filtering them out, implying they show up with gc.

-rob


Aram Hăvărneanu

unread,
Oct 15, 2013, 4:03:29 PM10/15/13
to Rob Pike, Ian Lance Taylor, Gong Su, golang-nuts
Why is GOARCH=amd64? To get past the hardcoded GOOS check in the go tool?

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Oct 15, 2013, 4:06:29 PM10/15/13
to Ian Lance Taylor, Gong Su, golang-nuts
On Tue, Oct 15, 2013 at 9:49 PM, Ian Lance Taylor <ia...@golang.org> wrote:
> How did you build the go tool that you are using?

His gccgo seems to be a cross-compiler, so the Go tool might just be a
regular, native go tool.

--
Aram Hăvărneanu

Gong Su

unread,
Oct 15, 2013, 4:27:44 PM10/15/13
to golan...@googlegroups.com, Gong Su
Hi Ian, I was just about to post another reply telling you that I also just found out the #cgo line in the x509/root_darwin.go file. It must have got pulled in by some go file of the directory server importing the crypto/x509 library.

But I actually couldn't build the x509 library on my system because it fails when trying to compile root_windows.go (which depends on syscall that I cannot compile either):

root@pandb:/usr/local/lib/go4.8/src/pkg/crypto/x509# GOARCH=amd64 GOPATH=/usr/local/lib/go4.8 go install --compiler gccgo -v -x .
WORK=/tmp/go-build344674591
pkg/crypto/x509
mkdir -p $WORK/pkg/crypto/x509/_obj/
mkdir -p $WORK/pkg/crypto/
cd /usr/local/lib/go4.8/src/pkg/crypto/x509
gccgo -I $WORK -c -g -m64 -fgo-pkgpath=pkg/crypto/x509 -fgo-relative-import-path=_/usr/local/lib/go4.8/src/pkg/crypto/x509 -o $WORK/pkg/crypto/x509/_obj/x509.o ./cert_pool.go ./pem_decrypt.go ./pkcs1.go ./pkcs8.go ./root.go ./root_unix.go ./root_windows.go ./sec1.go ./verify.go ./x509.go
# pkg/crypto/x509
./root_windows.go:20:67: error: reference to undefined identifier ‘syscall.CertContext’
 func createStoreContext(leaf *Certificate, opts *VerifyOptions) (*syscall.CertContext, error) {

(and many more syscall related error in root_windows.go)

But why it's trying to compile root_windows.go on a linux system? In all the compilation, the GOOS is set to be "linux".

Like Aram said in a late post said, I compiled the "go" tool manually with gccgo in the go/src/cmd/go directory:

gccgo-4.8 -g -o go `ls *.go | grep -v _test.go | grep -v bootstrap | grep -v doc | grep -v notunix`

Gong Su

unread,
Oct 15, 2013, 4:28:20 PM10/15/13
to golan...@googlegroups.com, Rob Pike, Ian Lance Taylor, Gong Su
Hi Aram, yes exactly, to get

Gong Su

unread,
Oct 15, 2013, 4:29:54 PM10/15/13
to golan...@googlegroups.com, Ian Lance Taylor, Gong Su
Hi Aram, yes you are correct again. I built the "go" tool myself using gccgo with the following command in the go/src/cmd/go directory:


gccgo-4.8 -g -o go `ls *.go | grep -v _test.go | grep -v bootstrap | grep -v doc | grep -v notunix`

Gong Su

unread,
Oct 15, 2013, 4:31:26 PM10/15/13
to golan...@googlegroups.com, Rob Pike, Ian Lance Taylor, Gong Su
Sorry don't know why my sentence was garbled. Meant to say "yes exactly, to get around the check."

Ian Lance Taylor

unread,
Oct 15, 2013, 4:57:34 PM10/15/13
to Gong Su, golang-nuts
On Tue, Oct 15, 2013 at 1:27 PM, Gong Su <gongsu...@gmail.com> wrote:
>
> But I actually couldn't build the x509 library on my system because it fails
> when trying to compile root_windows.go (which depends on syscall that I
> cannot compile either):

OK, you're going to have to debug why the go tool is trying to compile
root_windows.go on a GNU/Linux system. I have no idea why that would
happen.

Ian

Gong Su

unread,
Oct 15, 2013, 5:08:39 PM10/15/13
to golan...@googlegroups.com, Gong Su
OK thanks Ian. I'll dig around and see if I can find out anything.
Reply all
Reply to author
Forward
0 new messages