Haskell 32到64位交叉编译

时间:2023-01-03 12:27:12

I only have a x86_32 machine running Linux. On this machine I coded a small Haskell program.

我只有一台运行Linux的x86_32机器。在这台机器上,我编写了一个小的Haskell程序。

Now I need to provide a x86_64 Linux binary.

现在我需要提供一个x86_64 Linux二进制文件。

Which is the easiest / less painful way to achieve that?

哪种方法最简单/最不痛苦?

1 个解决方案

#1


4  

Borrow or rent (e.g. EC2) an x86_64 machine for long enough to compile your program. The latter would cost on the order of $0.01.

借用或租用(例如EC2)x86_64机器足够长的时间来编译你的程序。后者的成本约为0.01美元。

If this is not possible, then assuming you have a C cross-compiler to x86_64, you can try following the directions at https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling. However, as far as I know nobody has tried this before and I would be surprised if there are no bugs lurking for the case when the compiler's Int size is smaller than the target platform's word size.

如果这是不可能的,那么假设您有一个C交叉编译器到x86_64,您可以尝试按照https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling上的说明进行操作。但是,据我所知,之前没有人尝试过这个问题,如果编译器的Int大小小于目标平台的字大小,那么在没有漏洞的情况下我会感到惊讶。

#1


4  

Borrow or rent (e.g. EC2) an x86_64 machine for long enough to compile your program. The latter would cost on the order of $0.01.

借用或租用(例如EC2)x86_64机器足够长的时间来编译你的程序。后者的成本约为0.01美元。

If this is not possible, then assuming you have a C cross-compiler to x86_64, you can try following the directions at https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling. However, as far as I know nobody has tried this before and I would be surprised if there are no bugs lurking for the case when the compiler's Int size is smaller than the target platform's word size.

如果这是不可能的,那么假设您有一个C交叉编译器到x86_64,您可以尝试按照https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling上的说明进行操作。但是,据我所知,之前没有人尝试过这个问题,如果编译器的Int大小小于目标平台的字大小,那么在没有漏洞的情况下我会感到惊讶。