FAQ
Hi. I want to try to compile go source codes by using gcc 4.7.

My OS is OS X 10.8.2(Macbook retina). I installed gcc 4.7 from macport
program.

I also installed two version of go compiler on my Mac. One is 1.0.3
downloaded from website. Another is 1.0.2 downloaded from macport tool.

The reason why I want to use gcc to compile go source code is that I want
to try to make mips binary from go source code.




When I try to compile go source code using gcc, I got this.

initprocui-MacBook-Pro:test initproc$ gcc-mp-4.7 -c hello.go
gcc-mp-4.7: error: hello.go: Go compiler not installed on this system


I can't understand even I have go compiler. Here is go compiler info.

initprocui-MacBook-Pro:test initproc$ go version
go version go1.0.3
initprocui-MacBook-Pro:test initproc$ /opt/local/bin/go version
go version go1.0.2





Here is gcc compiler environment variables info.

initprocui-MacBook-Pro:test initproc$ gcc-mp-4.7 -v
Using built-in specs.
COLLECT_GCC=gcc-mp-4.7
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.7.2/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: ../gcc-4.7.2/configure --prefix=/opt/local
--build=x86_64-apple-darwin12
--enable-languages=c,c++,objc,obj-c++,lto,fortran,java
--libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47
--infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local
--with-local-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-4.7
--with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local
--with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local
--with-cloog=/opt/local --enable-cloog-backend=isl
--disable-cloog-version-check --enable-stage1-checking --disable-multilib
--enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as
--with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar
--with-bugurl=https://trac.macports.org/newticket
--disable-ppl-version-check --with-pkgversion='MacPorts gcc47 4.7.2_2'
Thread model: posix
gcc version 4.7.2 (MacPorts gcc47 4.7.2_2)



Here is version info.

initprocui-MacBook-Pro:test initproc$ gcc-mp-4.7 -version
gcc-mp-4.7: error: unrecognized command line option '-version'
gcc-mp-4.7: fatal error: no input files
compilation terminated.



Thanks to read this.

--

Search Discussions

  • Ian Lance Taylor at Nov 20, 2012 at 6:43 am

    On Mon, Nov 19, 2012 at 10:02 PM, 김지욱 wrote:
    The reason why I want to use gcc to compile go source code is that I want to
    try to make mips binary from go source code.
    In order to do this you must build GCC as a cross-compiler, or find a
    MacOS -> MIPS cross-compiler that you can download. Many people do
    build GCC themselves, but it is not a trivial task. The places to
    start are http://gcc.gnu.org/install/ and http://crosstool-ng.org/ .

    Ian

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 20, '12 at 6:39a
activeNov 20, '12 at 6:43a
posts2
users2
websitegolang.org

2 users in discussion

김지욱: 1 post Ian Lance Taylor: 1 post

People

Translate

site design / logo © 2021 Grokbase