【问题标题】:GNU make - could switching to diff version affect build output?GNU make - 切换到不同版本会影响构建输出吗?
【发布时间】:2016-12-19 23:41:19
【问题描述】:

我目前正在使用 GNU Make 3.81 --jobs=1,但正在尝试迁移到 GNU Make 4.2.1 --jobs=X,即多线程。

makefile、环境等一切其他都是一样的。

问题

.objs 或任何工件是否可能不同?

更新

假设 makefile 在逻辑上是正确的,这意味着所有依赖项都正确且彻底地指定,即它们是“并行正确的”

【问题讨论】:

  • 是的。使用不同版本的make 可能是一个原因。并行make 是另一个潜在原因,如果您的依赖关系没有详尽描述。示例:foo.c 首先从foo.l 生成,然后编译,生成foo.o。但是你忘了告诉make foo.cfoo.l 作为先决条件。可能是,如果foo.l 发生变化,它(偶然)与--jobs=1 一起工作,但现在,与--jobs=2foo.c 在更新之前编译。
  • @RenaudPacalet 是的,很好!但是,如果仅更改 make 的版本会产生影响,我会尝试隔离。所以我更新了这个问题。

标签: windows multithreading makefile gnu-make


【解决方案1】:

如果您的 Makefile 是平行正确的,那么差异就不会来自那里。

但是,是的,使用不同版本的 make 可能会导致不同的产品。有数百个原因,尤其是从一个版本到另一个版本的如此长的跳跃。下面是一个示例,来自 3.82 版的发行说明:

* WARNING: Backward-incompatibility!
  The library search behavior has changed to be compatible with the standard
  linker behavior. Prior to this version for prerequisites specified using
  the -lfoo syntax make first searched for libfoo.so in the current
  directory, vpath directories, and system directories. If that didn't yield
  a match, make then searched for libfoo.a in these directories. Starting
  with this version make searches first for libfoo.so and then for libfoo.a
  in each of these directories in order.

因此,使用 3.82 版而不是 3.81 版可能会导致您的链接器使用不同的库文件,从而生成不同的二进制文件。

列出 3.81 和 4.2.1 之间所有相似的可能性将是一项艰巨的任务。

【讨论】:

  • 不错的收获。我的构建团队计划在几个月内运行相同的构建,除了make 版本,以证明没有差异。很高兴对差异有可能的解释。
猜你喜欢
  • 1970-01-01
  • 2013-04-14
  • 2012-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多