dongqiang8683 2017-09-14 17:23
浏览 110

从Mac到Windows的交叉编译,从Linux到Windows的交叉编译,有区别吗?

My coworker and I are both using Go 1.9 x64. I'm running Linux Mint 18.2 and he's running macOS Sierra 10.12.6. We ran the exact same script to cross compile a program for Windows x64 and out of curiosity we diffed the files to see how similar they would be. We expected to find a few build parameters or IDs to be different but it turns out there are a LOT of differences all throughout the files.

meld <(hexdump -C one.exe) <(hexdump -C two.exe)

We made sure the two programs were built off the exact same code. The program really doesn't do anything too OS specific. It reads a JSON file and executes a series of web requests determined by that file. Nothing like executing shell commands or reading/writing the windows registry. No CGO, the only use of the os package is os.Exit(code) calls, nothing stands out as a culprit.

Even though the programs were built from two different host OSes, they were both built for the same target OS with the same version of the Go compiler and the same code files. Why are the output binaries so different?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 自动转发微信群信息到另外一个微信群
    • ¥15 outlook无法配置成功
    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换