FAQ
I am new to Go. I have downloaded the mac installer and run it. I have also
cloned the Swig Repo. I am trying to get the simple example to work (in
Examples/go/simple in the swig repo) but I get an error about missing
runtime.h, so I add /usr/local/go/src/pkg/runtime/ to my path. Now I am
getting an error about missing config.h, which is include inside of
runtime.h

Any tips on how to actually get this all to work together?

--

Search Discussions

  • Ian Lance Taylor at Oct 9, 2012 at 3:11 pm

    On Tue, Oct 9, 2012 at 12:01 AM, wrote:
    I am new to Go. I have downloaded the mac installer and run it. I have also
    cloned the Swig Repo. I am trying to get the simple example to work (in
    Examples/go/simple in the swig repo) but I get an error about missing
    runtime.h, so I add /usr/local/go/src/pkg/runtime/ to my path. Now I am
    getting an error about missing config.h, which is include inside of
    runtime.h

    Any tips on how to actually get this all to work together?
    runtime.h does not include config.h (unless you are using gccgo, which
    does not work on the Mac). So I think we need some more details on
    this.

    Ian

    --
  • Avaitla16 at Oct 9, 2012 at 11:32 pm
    Sure, I am using OSX 10.8 64 bit and
    installed http://code.google.com/p/go/downloads/detail?name=go1.0.3.darwin-amd64.pkg&can=2&q=OpSys-OSX+Type-Installer.

    Then I cloned the swig repository by running svn co
    https://swig.svn.sourceforge.net/svnroot/swig swig

    Then I ran the following commands in order to build swig:

    cd swig/trunk
    ./autogen.sh
    ./configure
    make

    Then I did the following to run the go example:

    cd Examples/go/simple
    make

    Now I receive the following error:

    make -f ../../Makefile SRCS='example.c' SWIG='../../../preinst-swig' \
    TARGET='example' INTERFACE='example.i' go
    ../../../preinst-swig -go -intgosize 32 `if false ; then echo -gccgo; fi`
    example.i
    gcc -g -c example.c example_wrap.c
    cc -bundle -undefined suppress -flat_namespace example.o example_wrap.o
    -o example.bundle
    go `if false ; then echo -c -g; elif true ; then echo tool 6g ; fi` -I .
    example.go
    if ! false ; then \
    `if true ; then echo go tool; fi` 6c -I ${GOROOT}/pkg/${GOOS}_${GOARCH}
    example_gc.c && \
    `if true ; then echo go tool pack; else echo gopack; fi` grc example.a
    example.6 example_gc.6; \
    fi
    example_gc.c:15 6c: No such file or directory: runtime.h
    go tool 6c: exit status 1
    make[1]: *** [go] Error 1
    make: *** [all] Error 2

    If you need any other information please let me know. It sounds a lot like
    this error:

    https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/YF7c6ABacdY

    However, I am not sure what GOROOT should be, my go directory
    is /usr/local/go/, is that the GOROOT value?

    Also, currently the following commands do nothing:

    which 8c
    which 8g
    which 6c
    which 6g



    On Tuesday, October 9, 2012 9:05:44 AM UTC-5, Ian Lance Taylor wrote:

    On Tue, Oct 9, 2012 at 12:01 AM, <avai...@gmail.com <javascript:>>
    wrote:
    I am new to Go. I have downloaded the mac installer and run it. I have also
    cloned the Swig Repo. I am trying to get the simple example to work (in
    Examples/go/simple in the swig repo) but I get an error about missing
    runtime.h, so I add /usr/local/go/src/pkg/runtime/ to my path. Now I am
    getting an error about missing config.h, which is include inside of
    runtime.h

    Any tips on how to actually get this all to work together?
    runtime.h does not include config.h (unless you are using gccgo, which
    does not work on the Mac). So I think we need some more details on
    this.

    Ian
    --
  • Minux at Oct 9, 2012 at 8:10 pm

    On Wed, Oct 10, 2012 at 3:41 AM, wrote:

    Sure, I am using OSX 10.8 64 bit and installed
    http://code.google.com/p/go/downloads/detail?name=go1.0.3.darwin-amd64.pkg&can=2&q=OpSys-OSX+Type-Installer
    .

    Then I cloned the swig repository by running svn co
    https://swig.svn.sourceforge.net/svnroot/swig swig

    Then I ran the following commands in order to build swig:

    cd swig/trunk
    ./autogen.sh
    ./configure
    make

    Then I did the following to run the go example:

    cd Examples/go/simple
    make

    Now I receive the following error:

    make -f ../../Makefile SRCS='example.c' SWIG='../../../preinst-swig' \
    TARGET='example' INTERFACE='example.i' go
    ../../../preinst-swig -go -intgosize 32 `if false ; then echo -gccgo; fi`
    example.i
    gcc -g -c example.c example_wrap.c
    cc -bundle -undefined suppress -flat_namespace example.o example_wrap.o
    -o example.bundle
    go `if false ; then echo -c -g; elif true ; then echo tool 6g ; fi` -I .
    example.go
    if ! false ; then \
    `if true ; then echo go tool; fi` 6c -I
    ${GOROOT}/pkg/${GOOS}_${GOARCH} example_gc.c && \
    `if true ; then echo go tool pack; else echo gopack; fi` grc example.a
    example.6 example_gc.6; \
    fi
    example_gc.c:15 6c: No such file or directory: runtime.h
    go tool 6c: exit status 1
    make[1]: *** [go] Error 1
    make: *** [all] Error 2
    seems swig Makefile doesn't do "eval $(go env)"
    please execute that before make so that $GOROOT, $GOARCH and $GOOS is
    defined.

    --
  • Avaitla16 at Oct 9, 2012 at 7:58 pm
    Okay, I've done:

    cd swig/trunk/Examples/go/simple
    make clean
    eval $(go env)
    make

    However I receive the same error as before.
    On Tuesday, October 9, 2012 2:45:31 PM UTC-5, minux wrote:


    On Wed, Oct 10, 2012 at 3:41 AM, <avai...@gmail.com <javascript:>> wrote:

    Sure, I am using OSX 10.8 64 bit and installed
    http://code.google.com/p/go/downloads/detail?name=go1.0.3.darwin-amd64.pkg&can=2&q=OpSys-OSX+Type-Installer
    .

    Then I cloned the swig repository by running svn co
    https://swig.svn.sourceforge.net/svnroot/swig swig

    Then I ran the following commands in order to build swig:

    cd swig/trunk
    ./autogen.sh
    ./configure
    make

    Then I did the following to run the go example:

    cd Examples/go/simple
    make

    Now I receive the following error:

    make -f ../../Makefile SRCS='example.c' SWIG='../../../preinst-swig' \
    TARGET='example' INTERFACE='example.i' go
    ../../../preinst-swig -go -intgosize 32 `if false ; then echo -gccgo; fi`
    example.i
    gcc -g -c example.c example_wrap.c
    cc -bundle -undefined suppress -flat_namespace example.o example_wrap.o
    -o example.bundle
    go `if false ; then echo -c -g; elif true ; then echo tool 6g ; fi` -I .
    example.go
    if ! false ; then \
    `if true ; then echo go tool; fi` 6c -I
    ${GOROOT}/pkg/${GOOS}_${GOARCH} example_gc.c && \
    `if true ; then echo go tool pack; else echo gopack; fi` grc example.a
    example.6 example_gc.6; \
    fi
    example_gc.c:15 6c: No such file or directory: runtime.h
    go tool 6c: exit status 1
    make[1]: *** [go] Error 1
    make: *** [all] Error 2
    seems swig Makefile doesn't do "eval $(go env)"
    please execute that before make so that $GOROOT, $GOARCH and $GOOS is
    defined.
    --
  • Minux at Oct 9, 2012 at 8:59 pm

    On Wed, Oct 10, 2012 at 3:51 AM, wrote:

    Okay, I've done:

    cd swig/trunk/Examples/go/simple
    make clean
    eval $(go env)
    make

    However I receive the same error as before.
    can you locate runtime.h under ${GOROOT}/pkg/${GOOS}_${GOARCH}?

    --
  • Avaitla16 at Oct 9, 2012 at 8:54 pm
    Ok when I issue:

    cd "${GOROOT}/pkg/${GOOS}_${GOARCH}"

    which on my system is: cd /usr/local/go/pkg/darwin_amd64/

    I find the following files:

    archive database hash io.a net.a runtime syscall.a
    bufio.a debug hash.a log os runtime.a testing
    bytes.a encoding html log.a os.a runtime.h testing.a
    cgocall.h errors.a html.a math path sort.a text
    compress expvar.a image math.a path.a strconv.a time.a
    container flag.a image.a mime reflect.a strings.a unicode
    crypto fmt.a index mime.a regexp sync unicode.a
    crypto.a go io net regexp.a sync.a

    Of which Runtime.h is a part.
    On Tuesday, October 9, 2012 2:55:51 PM UTC-5, minux wrote:

    On Wed, Oct 10, 2012 at 3:51 AM, <avai...@gmail.com <javascript:>> wrote:

    Okay, I've done:

    cd swig/trunk/Examples/go/simple
    make clean
    eval $(go env)
    make

    However I receive the same error as before.
    can you locate runtime.h under ${GOROOT}/pkg/${GOOS}_${GOARCH}?
    --
  • Ian Lance Taylor at Oct 9, 2012 at 9:55 pm

    On Tue, Oct 9, 2012 at 12:51 PM, wrote:
    Okay, I've done:

    cd swig/trunk/Examples/go/simple
    make clean
    eval $(go env)
    make

    However I receive the same error as before.
    Once you do that, make sure that the command "go" is on your PATH.
    Then run SWIG/configure again, and it should pick up the right tools
    to run.

    Ian

    --
  • Avaitla16 at Oct 9, 2012 at 9:03 pm
    Okay, thanks Ian.

    "go" is on my path and I can run the command.
    I have done make clean inside of the following directories:

    swig/Examples/go/simple
    swig/Examples/
    swig/trunk/

    Then I have performed:

    eval $(go env)
    ./autogen.sh
    ./configure
    make

    Then I cd back into swig/Examples/go/simple, and run make but I get the
    same error: no runtime.h found.

    One thing I've noticed is that running the command 6c doesn't work:

    -bash: 6c: command not found

    I'm not sure if thats at all related to the issue.
    On Tuesday, October 9, 2012 3:49:40 PM UTC-5, Ian Lance Taylor wrote:

    On Tue, Oct 9, 2012 at 12:51 PM, <avai...@gmail.com <javascript:>>
    wrote:
    Okay, I've done:

    cd swig/trunk/Examples/go/simple
    make clean
    eval $(go env)
    make

    However I receive the same error as before.
    Once you do that, make sure that the command "go" is on your PATH.
    Then run SWIG/configure again, and it should pick up the right tools
    to run.

    Ian
    --
  • Ian Lance Taylor at Oct 9, 2012 at 9:40 pm

    On Tue, Oct 9, 2012 at 2:03 PM, wrote:
    Okay, thanks Ian.

    "go" is on my path and I can run the command.
    I have done make clean inside of the following directories:

    swig/Examples/go/simple
    swig/Examples/
    swig/trunk/

    Then I have performed:

    eval $(go env)
    ./autogen.sh
    ./configure
    make

    Then I cd back into swig/Examples/go/simple, and run make but I get the same
    error: no runtime.h found.
    I don't have an explanation. Sorry. Does the file
    ${GOROOT}/pkg/${GOOS}_${GOARCH}/runtime.h exist?
    One thing I've noticed is that running the command 6c doesn't work:

    -bash: 6c: command not found

    I'm not sure if thats at all related to the issue.
    That in itself is normal. SWIG should be running "go tool 6c".

    Ian

    --
  • Avaitla16 at Oct 10, 2012 at 1:53 am
    Okay, it looks like my makefile wasn't entering in the right constants. I
    have rewritten my makefile to have /usr/local/go/pkg/darwin_amd64 where
    previously the variables were filled in automatically. I then run make
    check which does:

    go tool 6g runme.go
    go tool 6l -r /usr/local/go/pkg/darwin_amd64/:. -o runme runme.6
    env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./runme

    However this breaks with the following error:

    dyld: Library not loaded: example.so
    Referenced from:
    /Users/anilvaitla/Documents/cgen/swig/trunk/Examples/go/simple/./runme
    Reason: image not found
    Trace/BPT trap: 5

    Do you have any clues what the issue could be here?
    On Tuesday, October 9, 2012 4:09:10 PM UTC-5, Ian Lance Taylor wrote:
    On Tue, Oct 9, 2012 at 2:03 PM, <avai...@gmail.com <javascript:>> wrote:
    Okay, thanks Ian.

    "go" is on my path and I can run the command.
    I have done make clean inside of the following directories:

    swig/Examples/go/simple
    swig/Examples/
    swig/trunk/

    Then I have performed:

    eval $(go env)
    ./autogen.sh
    ./configure
    make

    Then I cd back into swig/Examples/go/simple, and run make but I get the same
    error: no runtime.h found.
    I don't have an explanation. Sorry. Does the file
    ${GOROOT}/pkg/${GOOS}_${GOARCH}/runtime.h exist?
    One thing I've noticed is that running the command 6c doesn't work:

    -bash: 6c: command not found

    I'm not sure if thats at all related to the issue.
    That in itself is normal. SWIG should be running "go tool 6c".

    Ian
    --
  • Ian Lance Taylor at Oct 9, 2012 at 11:04 pm

    On Tue, Oct 9, 2012 at 2:45 PM, wrote:
    Okay, it looks like my makefile wasn't entering in the right constants. I
    have rewritten my makefile to have /usr/local/go/pkg/darwin_amd64 where
    previously the variables were filled in automatically. I then run make check
    which does:

    go tool 6g runme.go
    go tool 6l -r /usr/local/go/pkg/darwin_amd64/:. -o runme runme.6
    env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./runme

    However this breaks with the following error:

    dyld: Library not loaded: example.so
    Referenced from:
    /Users/anilvaitla/Documents/cgen/swig/trunk/Examples/go/simple/./runme
    Reason: image not found
    Trace/BPT trap: 5

    Do you have any clues what the issue could be here?
    I think that on Darwin it needs to be DYLD_LIBRARY_PATH, not
    LD_LIBRARY_PATH. However, I know very little about Darwin.

    Ian

    --
  • Avaitla16 at Oct 9, 2012 at 10:09 pm
    Ok, I'll give this a try on linux. Thanks for all your patience.
    On Tuesday, October 9, 2012 4:57:32 PM UTC-5, Ian Lance Taylor wrote:
    On Tue, Oct 9, 2012 at 2:45 PM, <avai...@gmail.com <javascript:>> wrote:
    Okay, it looks like my makefile wasn't entering in the right constants. I
    have rewritten my makefile to have /usr/local/go/pkg/darwin_amd64 where
    previously the variables were filled in automatically. I then run make check
    which does:

    go tool 6g runme.go
    go tool 6l -r /usr/local/go/pkg/darwin_amd64/:. -o runme runme.6
    env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./runme

    However this breaks with the following error:

    dyld: Library not loaded: example.so
    Referenced from:
    /Users/anilvaitla/Documents/cgen/swig/trunk/Examples/go/simple/./runme
    Reason: image not found
    Trace/BPT trap: 5

    Do you have any clues what the issue could be here?
    I think that on Darwin it needs to be DYLD_LIBRARY_PATH, not
    LD_LIBRARY_PATH. However, I know very little about Darwin.

    Ian
    --
  • Avaitla16 at Oct 9, 2012 at 11:31 pm
    Okay, yeah things were a whole lot easier on linux. Thanks again!
    On Tuesday, October 9, 2012 5:02:16 PM UTC-5, avai...@gmail.com wrote:

    Ok, I'll give this a try on linux. Thanks for all your patience.
    On Tuesday, October 9, 2012 4:57:32 PM UTC-5, Ian Lance Taylor wrote:
    On Tue, Oct 9, 2012 at 2:45 PM, wrote:
    Okay, it looks like my makefile wasn't entering in the right constants. I
    have rewritten my makefile to have /usr/local/go/pkg/darwin_amd64 where
    previously the variables were filled in automatically. I then run make check
    which does:

    go tool 6g runme.go
    go tool 6l -r /usr/local/go/pkg/darwin_amd64/:. -o runme runme.6
    env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./runme

    However this breaks with the following error:

    dyld: Library not loaded: example.so
    Referenced from:
    /Users/anilvaitla/Documents/cgen/swig/trunk/Examples/go/simple/./runme
    Reason: image not found
    Trace/BPT trap: 5

    Do you have any clues what the issue could be here?
    I think that on Darwin it needs to be DYLD_LIBRARY_PATH, not
    LD_LIBRARY_PATH. However, I know very little about Darwin.

    Ian
    --
  • Avaitla16 at Oct 9, 2012 at 11:36 pm
    There is of course no example.so in this directory, but I imagine I should
    be referencing runme.6 somehow?

    The files in this directory are:

    Makefile example.bundle example.i example_gc.c index.html runme.go
    example.6 example.c example.o example_wrap.c runme
    example.a example.go example_gc.6 example_wrap.o runme.6
    On Tuesday, October 9, 2012 4:45:20 PM UTC-5, avai...@gmail.com wrote:

    Okay, it looks like my makefile wasn't entering in the right constants. I
    have rewritten my makefile to have /usr/local/go/pkg/darwin_amd64 where
    previously the variables were filled in automatically. I then run make
    check which does:

    go tool 6g runme.go
    go tool 6l -r /usr/local/go/pkg/darwin_amd64/:. -o runme runme.6
    env LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH ./runme

    However this breaks with the following error:

    dyld: Library not loaded: example.so
    Referenced from:
    /Users/anilvaitla/Documents/cgen/swig/trunk/Examples/go/simple/./runme
    Reason: image not found
    Trace/BPT trap: 5

    Do you have any clues what the issue could be here?
    On Tuesday, October 9, 2012 4:09:10 PM UTC-5, Ian Lance Taylor wrote:
    On Tue, Oct 9, 2012 at 2:03 PM, wrote:
    Okay, thanks Ian.

    "go" is on my path and I can run the command.
    I have done make clean inside of the following directories:

    swig/Examples/go/simple
    swig/Examples/
    swig/trunk/

    Then I have performed:

    eval $(go env)
    ./autogen.sh
    ./configure
    make

    Then I cd back into swig/Examples/go/simple, and run make but I get the same
    error: no runtime.h found.
    I don't have an explanation. Sorry. Does the file
    ${GOROOT}/pkg/${GOOS}_${GOARCH}/runtime.h exist?
    One thing I've noticed is that running the command 6c doesn't work:

    -bash: 6c: command not found

    I'm not sure if thats at all related to the issue.
    That in itself is normal. SWIG should be running "go tool 6c".

    Ian
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 9, '12 at 2:31p
activeOct 10, '12 at 1:53a
posts15
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase