不同系统上的相同构建

我有 3 台构建机器.一个在 Windows 2000 上运行,一个在 XP SP3 上运行,一个在 64 位 Windows Server 2008 上运行.我有一个本地 C++ 项目要构建(我正在使用 Visual Studio 2005 SP1 构建).我的目标是使用这些构建机器构建完全相同"的 dll.

I have 3 build machines. One running on windows 2000, one with XP SP3 and one with 64bit Windows Server 2008. And I have a native C++ project to build (I'm building with visual studio 2005 SP1). My goal is to build "exactly" the same dll's using these build machines.

我的意思是一点一点(当然除了构建时间戳).

By exactly I mean bit by bit (except build timestamp of course).

使用 win2k 和 winxp 我得到相同的 dll.但它们与用win2008服务器构建的dll不同.我已经设法获得几乎相同的 dll,但存在一些差异.反汇编文件后发现函数顺序不一样(3个函数顺序不同).

With win2k and winxp I'm getting identical dll's. But they differ from dll built with win2008 server. I've managed to get almost identical dll's, but there are some differences. After disassembling the files I found out that function order is not the same (3 functions are in different order).

有谁知道这可能是什么原因?

Does anyone know what could be the reason for that?

还有一个附带问题:在 vcbuild.exe 中,我找到了一个开关/ORDER.它将函数命令文件作为输入.有人知道那个文件应该是什么样子吗?

And a side question: In vcbuild.exe I've found a switch /ORDER. Which takes function order file as input. Anyone knows how that file should look like?

推荐答案

您可能认为编译是纯粹确定性的(相同的输入每次都会给出相同的输出),但事实并非如此.例如,考虑优化器 - 这将需要一些内存来工作,可能更多用于更高的优化方法.如果在一台机器上内存分配失败(因为机器内存较少),那么编译器可能会忽略该特定优化,从而导致发出不同的代码.

You might think that compiling is purely deterministic (identical inputs give identical output, every time) but this need not be the case. For example, consider the optimiser - this is going to need some memory to work in, probably more for higher optimisation methods. If on one machine a memory allocation fails (because the machine has less memory) then the compiler could omit that specific optimisation, resulting in different code being emitted.

有很多类似的情况,所以你可能会在一些不可行的事情上付出很多努力.无论如何,为什么您需要 DLL 按位相同?

There are a lot of similar situations, so you may be putting a lot of effort into something that is not doable. Why do you need the DLLs to be bitwise identical, anyway?

相关文章