dssqq82402 2018-10-02 21:09
浏览 124

如何交叉编译Solaris 32位

We are currently building our Go executables for several platforms including Solaris 64-bit. We have requests for a 32-bit Solaris executable version as well and I am unable to get this to work (the person who setup the Solaris 64-bit cross compiler is gone and unreachable).

I tried just setting -m32 flag on go build using our existing solaris cross compilation, but that didn't work, so I am attempting to build a Solaris 32-bit specific cross compiler.

I googled and found some vague examples, so I am following this process:

  1. Copy headers and libraries from a 32-bit Solaris machine to my Linux build machine.
  2. D/L and build binutils and gcc pointing SYSROOT to the downloaded 32-bit Solaris headers and libraries where:

$TARGET=sparc-sun-solaris2.10

$SYSROOT=/path/to/solaris32/includes

$PREFIX=/path/to/gcc-output

binutils-2.31/configure -target=$TARGET --prefix=$PREFIX -with-sysroot=$SYSROOT -v

gcc-8.2.0/configure --target=$TARGET --with-gnu-as --with-gnu-ld  --prefix=$PREFIX -with-sysroot=$SYSROOT --disable-libgcj --enable-languages=c,c++,go -v
  1. Create a symlink to gogcc and put GCC on the path
  2. Compile a trivial test go program like this:

    go build --compiler gccgo --gccgoflags "-m32 -O3 -static-libgo -Wl,-dy -lnsl -lsocket -lrt -lsendfile" -o ${GOTOOLS}/${BINARIES}/${PROJECT_NAME}/test/solaris_sparc32 test/main.go

This fails as follows:

go build: when using gccgo toolchain, please pass compiler flags using -gccgoflags, not -gcflags

command-line-arguments

gccgo: error: may not use both -m32 and -m64

Clearly I don't know what I'm doing. Can anyone point me in the right direction?

  • 写回答

1条回答 默认 最新

  • drtpbx3606 2018-10-02 21:45
    关注

    Solaris 32-bit does not appear to be supported, according to the list of supported OS/arch targets:

    The valid combinations of $GOOS and $GOARCH are:

    $GOOS     $GOARCH
    ...
    solaris   amd64
    ...
    

    That is, Solaris 64-bit is explicitly listed as a supported platform but Solaris 32-bit is not listed.

    As such, there is good reason to believe that go programs will not run reliably on Solaris 32-bit systems and you probably should not agree to support that platform (if you do happen to get that cross compilation working) mainly because the go team itself does not support it!

    评论

报告相同问题?

悬赏问题

  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题