在Linux上运行FreeBSD静态二进制文件?

时间:2021-10-09 17:40:56

Would a very small/simple command line program, programmed in standards compliant C99, and statically compiled on FreeBSD work if executed on Linux ?

一个非常小/简单的命令行程序,在符合标准的C99中编程,并且在FreeBSD上静态编译,如果在Linux上执行吗?

(I would test this myself but I do not currently have a separate HDD to test on Linux.)

(我会自己测试一下,但我目前没有单独的硬盘来测试Linux。)

1 个解决方案

#1


11  

No, not in general, because the syscall interface is different. However, FreeBSD has a good Linux compatibility layer where you can run Linux binaries (that are compiled against the Linux syscall interface) on FreeBSD. There is such a layer available for both i386 and amd64 binaries.

不,一般情况下,因为syscall接口不同。但是,FreeBSD有一个很好的Linux兼容层,你可以在FreeBSD上运行Linux二进制文件(针对Linux系统调用接口编译)。 i386和amd64二进制文件都有这样的层。

See Chapter 10: Linux Binary Compatibility of the FreeBSD handbook for more information.

有关更多信息,请参阅第10章:FreeBSD手册的Linux二进制兼容性。

#1


11  

No, not in general, because the syscall interface is different. However, FreeBSD has a good Linux compatibility layer where you can run Linux binaries (that are compiled against the Linux syscall interface) on FreeBSD. There is such a layer available for both i386 and amd64 binaries.

不,一般情况下,因为syscall接口不同。但是,FreeBSD有一个很好的Linux兼容层,你可以在FreeBSD上运行Linux二进制文件(针对Linux系统调用接口编译)。 i386和amd64二进制文件都有这样的层。

See Chapter 10: Linux Binary Compatibility of the FreeBSD handbook for more information.

有关更多信息,请参阅第10章:FreeBSD手册的Linux二进制兼容性。