2

假设我用 C 语言编写了一个简单的程序。它在我的主架构上成功构建并运行。

现在我想了解该程序可以构建和工作的架构;还为各种平台提供预构建的可执行文件供下载。然而,我只有几个。

最明显的方法似乎是为不同架构设置最大数量的交叉编译工具链和最大数量的可执行映像。但这似乎很不方便(特别是如果您只希望它用于一个小程序)。

如何以简单的方式做到这一点?我应该使用一些已经为各种架构的开发系统提供设置的在线服务吗?

期待这样的事情:

user$ ssh i386.buildhere.example
guest@i386 $ echo 'int main(){}' > hello.c
guest@i386 $ gcc hello.c -o hello
guest@i386 $ ./hello
guest@i386 $ file hello
hello: ELF 32-bit LSB executable, Intel 8038....
user$ ssh armel.buildhere.example
guest@armel $ ....

...

如果还有各种过时的系统可用于测试“我的程序在那个遗留发行版上的表现如何?”,那么额外的好处应该是。

4

1 回答 1

3

There is one thing that is ALMOST certain in programming: Whatever you do to test something will probably work, but whatever you haven't tested will fail when you give it to a customer.

Use of virtual machines will help to some degree to avoid having to buy unusual hardware, as does things like QEMU.

Unless your program is either REALLY trivial, or you want to use your customers [1] as guinea-pigs, you are best off testing on every platform-type that you want to release for. If you don't, it WILL come back and bite you at some point.

If you don't, you run the risk of some of your customers gets an "unhappy experience". An unhappy customer tells ten people, a happy customer tells maybe one person.

If you wish to support architectures/stuff that you don't have access to, maybe just having a "help yourself" option of source-code is a better choice than downloadable binaries.

Of course, you can rent time/space on servers of various kinds - I looked into writing an iPhone app, and there are places that run Mac's as virtual machines on the net that you can rent for around US$ 15 per month, for example.

[1] Throughout this answer, by customer, I mean anyone that downloads your software, regardless of whether they actually give some money to anyone, they will have spent some effort to get your software on their machine. If it doesn't work, then they will be unhappy to some degree. How unhappy depends on a number of things, including how clear you made it that "this may not work" if you were to publish "untested" software.

于 2013-02-15T00:22:01.867 回答