FAQ
I'm trying to run the cgo sample
(http://golang.org/doc/articles/c_go_cgo.html) on an ARM build (Raspberry
Pi). I've built the same code on an x86 machine without issues.

When running 'go install' I run into this import error

# randy
randy/randy.go:5: can't find import: "github.com/steve918/rand"

The import paths are correct so I try to build just the imported bit and it
seems to work (fails silently), but if I run cgo manually with -debug-gcc I
see something like the following. It appears to fail while compiling a
test because of an unnamed variable declaration.

void __cgo__f__(void) {
#line 0 "cgo-test"
unsigned int; enum { _cgo_enum_0 = unsigned int }; /* cgo-test:0 */
srandom; enum { _cgo_enum_1 = srandom }; /* cgo-test:1 */
random; enum { _cgo_enum_2 = random }; /* cgo-test:2 */
}
EOF
cgo-test: In function '__cgo__f__':
cgo-test:0:1: error: useless type name in empty declaration [-Werror]
cgo-test:0:36: error: expected expression before 'unsigned'
cgo-test:1:1: error: statement with no effect [-Werror=unused-value]
cgo-test:1:31: error: enumerator value for '_cgo_enum_1' is not an integer
constant
cgo-test:2:1: error: statement with no effect [-Werror=unused-value]
cgo-test:2:30: error: enumerator value for '_cgo_enum_2' is not an integer
constant
cc1: all warnings being treated as errors
$ gcc -Wall -Werror -o_obj/_cgo_.o -gdwarf-2
-fno-eliminate-unused-debug-types -c -xc - <<EOF


Anyone seen something like this before?

--

Search Discussions

  • Minux at Oct 30, 2012 at 6:44 pm

    On Wed, Oct 31, 2012 at 1:33 AM, Steven Osborn wrote:

    I'm trying to run the cgo sample (
    http://golang.org/doc/articles/c_go_cgo.html) on an ARM build (Raspberry
    Pi). I've built the same code on an x86 machine without issues.

    When running 'go install' I run into this import error

    # randy
    randy/randy.go:5: can't find import: "github.com/steve918/rand"
    seems this has something to do with your GOPATH setting.
    this error seems not related to cgo, have you tried to remove all cgo stuff
    in your package, and try building again?
    (have you tried multiple package building on Pi before?)
    The import paths are correct so I try to build just the imported bit and
    it seems to work (fails silently), but if I run cgo manually with -
    cgo build won't fail silently.
    debug-gcc I see something like the following. It appears to fail while
    compiling a test because of an unnamed variable declaration.

    void __cgo__f__(void) {
    #line 0 "cgo-test"
    unsigned int; enum { _cgo_enum_0 = unsigned int }; /* cgo-test:0 */
    srandom; enum { _cgo_enum_1 = srandom }; /* cgo-test:1 */
    random; enum { _cgo_enum_2 = random }; /* cgo-test:2 */
    }
    EOF
    cgo-test: In function '__cgo__f__':
    cgo-test:0:1: error: useless type name in empty declaration [-Werror]
    cgo-test:0:36: error: expected expression before 'unsigned'
    cgo-test:1:1: error: statement with no effect [-Werror=unused-value]
    cgo-test:1:31: error: enumerator value for '_cgo_enum_1' is not an integer
    constant
    cgo-test:2:1: error: statement with no effect [-Werror=unused-value]
    cgo-test:2:30: error: enumerator value for '_cgo_enum_2' is not an integer
    constant
    cc1: all warnings being treated as errors
    $ gcc -Wall -Werror -o_obj/_cgo_.o -gdwarf-2
    -fno-eliminate-unused-debug-types -c -xc - <<EOF

    this is normal. cgo is (ab)using gcc to detect object types.
    --
  • Steven Osborn at Oct 30, 2012 at 11:42 pm
    Thanks for the insights. I was using a (rebuilt) Debian package from
    the Raspberry pi repositories, now I'm just building from tip which
    seems to have solved my issue.

    --
    Steven Osborn
    http://steven.bitsetters.com

    On Tue, Oct 30, 2012 at 11:35 AM, minux wrote:
    On Wed, Oct 31, 2012 at 1:33 AM, Steven Osborn wrote:

    I'm trying to run the cgo sample
    (http://golang.org/doc/articles/c_go_cgo.html) on an ARM build (Raspberry
    Pi). I've built the same code on an x86 machine without issues.

    When running 'go install' I run into this import error

    # randy
    randy/randy.go:5: can't find import: "github.com/steve918/rand"
    seems this has something to do with your GOPATH setting.
    this error seems not related to cgo, have you tried to remove all cgo stuff
    in your package, and try building again?
    (have you tried multiple package building on Pi before?)

    The import paths are correct so I try to build just the imported bit and
    it seems to work (fails silently), but if I run cgo manually with -
    cgo build won't fail silently.
    debug-gcc I see something like the following. It appears to fail while
    compiling a test because of an unnamed variable declaration.

    void __cgo__f__(void) {
    #line 0 "cgo-test"
    unsigned int; enum { _cgo_enum_0 = unsigned int }; /* cgo-test:0 */
    srandom; enum { _cgo_enum_1 = srandom }; /* cgo-test:1 */
    random; enum { _cgo_enum_2 = random }; /* cgo-test:2 */
    }
    EOF
    cgo-test: In function '__cgo__f__':
    cgo-test:0:1: error: useless type name in empty declaration [-Werror]
    cgo-test:0:36: error: expected expression before 'unsigned'
    cgo-test:1:1: error: statement with no effect [-Werror=unused-value]
    cgo-test:1:31: error: enumerator value for '_cgo_enum_1' is not an integer
    constant
    cgo-test:2:1: error: statement with no effect [-Werror=unused-value]
    cgo-test:2:30: error: enumerator value for '_cgo_enum_2' is not an integer
    constant
    cc1: all warnings being treated as errors
    $ gcc -Wall -Werror -o_obj/_cgo_.o -gdwarf-2
    -fno-eliminate-unused-debug-types -c -xc - <<EOF
    this is normal. cgo is (ab)using gcc to detect object types.
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 30, '12 at 6:44p
activeOct 30, '12 at 11:42p
posts3
users2
websitegolang.org

2 users in discussion

Steven Osborn: 2 posts Minux: 1 post

People

Translate

site design / logo © 2023 Grokbase