FAQ
Dear golang-nuts Google Group,

I am currently trying to manually cross-compile both Macintosh and Linux
binaries from a Windows machine.
To do that, I use a batch script using the documented flags of the 6l-tool:
go tool 6g file.go
pause
go tool 6l -Hdarwin file.6
go tool 6l -Hlinux file.6
go tool 6l -Hwindows file.6
pause
The Windows compilation works fine, the other 2 error out notifying me of
the same error 10 times, "unsupported relocation for dynamic symbol",
including further specific information different between the errors.
I'd be glad if someone could help me out here.

--

Search Discussions

  • Minux at Nov 18, 2012 at 5:06 pm

    On Sun, Nov 18, 2012 at 11:47 PM, Blue wrote:

    Dear golang-nuts Google Group,

    I am currently trying to manually cross-compile both Macintosh and Linux
    binaries from a Windows machine.
    To do that, I use a batch script using the documented flags of the 6l-tool:
    go tool 6g file.go
    pause
    go tool 6l -Hdarwin file.6
    go tool 6l -Hlinux file.6
    go tool 6l -Hwindows file.6
    pause
    The Windows compilation works fine, the other 2 error out notifying me of
    the same error 10 times, "unsupported relocation for dynamic symbol",
    including further specific information different between the errors.
    I'd be glad if someone could help me out here.
    you first need to compile the standard packages for Darwin and Linux.

    you can try to follow these steps (I assume you're building for the same
    architecture
    as your windows host):
    rem Building packages for Linux
    set CGO_ENABLED=0
    set GOOS=linux
    go tool dist install pkg/runtime
    go install -v std
    rem Building packages for Darwin
    set GOOS=darwin
    go tool dist install pkg/runtime
    go install -v std
    set GOOS=
    go install -v std

    if you want to build for Linux, then you could do this:
    set CGO_ENABLED=0
    set GOOS=linux
    go build somePkg

    if you want to build for Mac OS X, substitute linux with darwin in the GOOS
    line above.

    related info:
    http://code.google.com/p/go-wiki/wiki/WindowsCrossCompiling
    http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 18, '12 at 4:45p
activeNov 18, '12 at 5:06p
posts2
users2
websitegolang.org

2 users in discussion

Minux: 1 post Blue: 1 post

People

Translate

site design / logo © 2023 Grokbase