你如何“回声”?源目录中的最后一个configure/make build --options?
当使用特定选项、标志等进行 GNU 风格的“./configure, make, and install”时...正如您所知,有时这可能是一种黑色艺术..适用于一个软件的东西可能不适用于任何其他软件...
现在,想象一下您已经成功构建了一些包含一些选项的包XYZ.app 就像...
% ./configure --with-1=2 USFLAG="-3 four" OBSCURE_LIB=l/lib/doihave
并继续使用它。伟大的。稍后,您意识到您需要以前省略的编译时选项,或者您可能已经解决了依赖关系问题等...无论出于何种原因,您想要重新编译这个完美的二进制文件。
现在...如何逐字“调用”传递给 ./configure 的所有选项,以便使用这些相同的选项,同时可能添加或减去一些选项,这一次?
我确信这些东西都埋在所有这些 config.xxxx 或 AClocal 或 Makefile.xx 文件中的某个地方,但在我的一生中,我一直无法在 Google 上找到一个直接的答案。
% file /usr/bin/$1 --> Mach-O 64-bit executable x86_64
% ld /usr/bin/$1 --> -macosx_version_min not specificed, assuming 10.6
% make -d --> * 20 pages of Makefile nonsense.... *
% ./config.log --> * shows some history, but nothing interesting. *
% ./config.status --> * does a strange sequence oddly similar to a "clean" *
% ./configure -h --> * 500 options, none of which is "show-me=your-shit" *
glibtoolize、otool、autoconf、automake、pkg-config...似乎都不愿意提供帮助。 一次千钧一发似乎是 pkg-config 创建的 XYZ.pc 文件的内容。
prefix=/usr/local \ exec_prefix=${prefix} \ libdir=${exec_prefix}/lib
includedir=${prefix}/include \ Libs: -L${libdir} -lxyz-base
Cflags: -I${includedir} -I${includedir}/xyz
但是,这些看起来像是环境变量,而不是来自实际配置调用的参数... 我厌倦了猜测...找出原始构建参数的真正方法是什么,以便您可以随意再次使用它们...?
When doing a a GNU-style " ./configure, make, and install " - with specific options, flags, etc... As you all know, sometimes this can be a black art.. and what works for one piece of software may not for any other...
Now, imagine that you had successfully built some package XYZ.app with some options like...
% ./configure --with-1=2 USFLAG="-3 four" OBSCURE_LIB=l/lib/doihave
and gone ahead and used it. Great. At a later point, you realize you need a previously omitted compile-time option, or maybe you've resolved a dependency issue, etc... For whatever reason, you want to recompile this perfectly good binary.
Now... how can you "recall" ALL of the options you passed to ./configure, verbatim, so as to use those SAME options, while possibly adding or subtracting some, this time around?
I'm sure this stuff is buried somewhere in all those config.xxxx or AClocal or Makefile.xx files, but for the life of me, I haven'e been able to Google one straight answer.
% file /usr/bin/$1 --> Mach-O 64-bit executable x86_64
% ld /usr/bin/$1 --> -macosx_version_min not specificed, assuming 10.6
% make -d --> * 20 pages of Makefile nonsense.... *
% ./config.log --> * shows some history, but nothing interesting. *
% ./config.status --> * does a strange sequence oddly similar to a "clean" *
% ./configure -h --> * 500 options, none of which is "show-me=your-shit" *
glibtoolize, otool, autoconf, automake, pkg-config... all seem unwilling to help.
One close-call seems to be the contents of the XYZ.pc file created by pkg-config..
prefix=/usr/local \ exec_prefix=${prefix} \ libdir=${exec_prefix}/lib
includedir=${prefix}/include \ Libs: -L${libdir} -lxyz-base
Cflags: -I${includedir} -I${includedir}/xyz
However, these just seem like environmental variables, not arguments from the actual config invocation...
I'm sick of guessing... what is the real way to figure out the original build arguments, so that you can use them again, at will...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
令人难以置信的是,不知怎的,其他人都错过了执行此操作的规范方法,这种方法在本线程开始前两年就已经存在了。 :-)
我想知道与OP相同的事情,并且当我读到这篇文章时,我对缺乏适当的(不丑陋的)方法来做到这一点感到失望。
几天后,当我闲着浏览 Autoconf 的发行说明时,我到达了 Autoconf 2.65 的发行说明。你相信吗?
因此,只需运行
./config.status --config
就可以完全满足OP的要求。以下是文档中相应的参考: 17 config.status 调用,以及引用:
Incredibly, somehow everyone else missed the canonical way to do this, which has been around since 2 years before this thread began. :-)
I wondered the same thing as the OP and was disappointed by the lack of proper (non-ugly) ways to do this when I read this thread.
A few days later, while idly browsing release notes for Autoconf, I reached the release notes for Autoconf 2.65. And would you believe it?
So, just running
./config.status --config
does precisely what the OP asked for.Here is the corresponding reference in the documentation: 17 config.status invocation, and a quote:
config.status
里面有选项;./config.status --recheck
使用原始选项重新运行configure
。您可以中断该命令并重新发出该命令(它会在运行之前显示该命令),或者您可以编辑config.status
并将新参数添加到$ac_configure_extra_args
中。我确实希望他们能让这件事变得更容易。曾几何时,
head config.status
将为您提供原始的configure
命令。./config.status --rerun extra args here
就很好了。config.status
has the options in it;./config.status --recheck
re-runsconfigure
with the original options. You could interrupt that and reissue the command (which it will show you before running it), or you could editconfig.status
and add your new parameters to$ac_configure_extra_args
.I do kinda wish they'd made it easier to do this. Once upon a time
head config.status
would get you the originalconfigure
command../config.status --rerun extra args here
would have been nice.我不敢相信没有人提到 config.log - 它为您提供了您正在寻找的内容:
此文件包含编译器在运行时生成的任何消息
运行configure,以在configure出错时帮助调试。
它是由configure创建的,它是
由 GNU Autoconf 2.69 生成。调用命令行为
$ ./configure --prefix /usr/local/syslog-ng/ --enable-linux-caps --enable-spoof-source
I can't believe nobody mentioned config.log - it give you exactly what you are looking for:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix /usr/local/syslog-ng/ --enable-linux-caps --enable-spoof-source
如果您仍然拥有构建树,请运行
./config.status --recheck
,然后快速按CTRL-C
,因为它会打印出重新运行之前将运行的内容配置
。If you still have the build tree, run
./config.status --recheck
, then quickly pressCTRL-C
as it prints out what it will run before re-runningconfigure
.