aclocal/autoconf 报告 Mac OS X 上缺少 m4sugar.m4?

发布于 2024-11-08 00:04:29 字数 1340 浏览 4 评论 0原文

我已将 Xcode 3.2 安装到 /Xcode3.2 中,并且没有在 /Developer 中安装任何内容。当我希望进行开发时,我启动一个 shell,如下所示

alias sysroot='PATH=${PATH}:${XCODE}/usr/bin CFLAGS=--sysroot\ ${SDK_ROOT} CXXFLAGS=--sysroot\ ${SDK_ROOT} LDFLAGS=--sysroot\ ${SDK_ROOT} CPPFLAGS=--sysroot\ ${SDK_ROOT}'

,其中 XCODE/Xcode3.2SDK_ROOT${ XCODE}/SDKs/MacOSX10.6.sdk。这可以解决尝试构建项目时遇到的大部分奇怪问题。但是,我最近遇到了一个情况,我想重新运行 aclocal 并收到以下错误:

autom4te: m4sugar/m4sugar.m4: no such file or directory
aclocal: /Xcode3.2/usr/bin/autom4te failed with exit status: 1

Specifying -I flags to aclocal to指向替代的 /Xcode3.2/usr/share/aclocal-1.10/Xcode3.2/usr/share/aclocal 似乎没有帮助。如果我使用 --verbose,然后重新运行 m4 命令,它会手动列出并添加一个 -I 标志以指向 /Xcode3.2/usr/share/autoconf,那么就可以了,但我似乎无法从 aclocal 通过管道传输它。此外,m4man 页面建议的 M4PATH 环境变量让我添加路径似乎没有什么区别。 (设置环境变量将是我的首选设置,这样我就可以将其添加到上面的别名中。)

到目前为止,除了从 /usr/share/autoconf/Xcode3.2/usr/share/autoconf。还有其他更好的方法吗?

注意:我在开发人员工具和操作系统的安装之间保持如此明显的界限的原因是为了提供可靠的跨操作系统编译(例如,以便一个 Xcode 版本的工具不会干扰另一个 Xcode 版本的构建行为。)

I have Xcode 3.2 installed into /Xcode3.2, and did not install anything into /Developer. When I wish to do development, I start up a shell as follows

alias sysroot='PATH=${PATH}:${XCODE}/usr/bin CFLAGS=--sysroot\ ${SDK_ROOT} CXXFLAGS=--sysroot\ ${SDK_ROOT} LDFLAGS=--sysroot\ ${SDK_ROOT} CPPFLAGS=--sysroot\ ${SDK_ROOT}'

where XCODE is /Xcode3.2 and SDK_ROOT is ${XCODE}/SDKs/MacOSX10.6.sdk. This handles most of the oddities of trying to build projects. However, I recently ran into a case where I wanted to re-run aclocal and got the following error:

autom4te: m4sugar/m4sugar.m4: no such file or directory
aclocal: /Xcode3.2/usr/bin/autom4te failed with exit status: 1

Specifying -I flags to aclocal to point at the alternative /Xcode3.2/usr/share/aclocal-1.10 and /Xcode3.2/usr/share/aclocal doesn't seem to help. If I use --verbose, and then re-run the m4 command it lists manually with an added -I flag to point to /Xcode3.2/usr/share/autoconf, then that works, but I cannot seem to pipe it through from aclocal. In addition the M4PATH environment variable that the man pages for m4 suggest will let me add paths does not seem to make a difference. (And setting an environment variable would be my preferred setting, just so I could add it to the alias above.)

So far, I've not come up with a solution other than the "dirtying" procedure of creating a symlink from /usr/share/autoconf to /Xcode3.2/usr/share/autoconf. Is there another better way?

NOTE: The reason I keep such distinct lines between installs of the developer tools and the OS is to provide reliable cross-OS compilations (e.g., so that one Xcode version's tools don't perturb another Xcode version's build behavior.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

北凤男飞 2024-11-15 00:04:29

我通过创建一个新的符号链接解决了这个问题

sudo ln -s  /Developer/usr/share/autoconf /usr/share

I got around this by creating a new symlink

sudo ln -s  /Developer/usr/share/autoconf /usr/share
晨曦慕雪 2024-11-15 00:04:29

为了澄清 adl 的答案和 Nathan 的评论中确定的修复:

如果您在默认位置(在 /Developer 下)安装了 autoconf 作为 XCode 4.3 的一部分,那么您需要编辑 /Developer/usr/share/autoconf/autom4te.cfg 因为它设置了各种错误的路径,不包含 /Developer 目录:

(这编辑被说明为我在 Google 缓存 这篇文章

*** /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:15:15.000000000 -0700
--- /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:14:33.000000000 -0700
***************
*** 99,101 ****
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /usr/share/autoconf
args: --cache=autom4te.cache
--- 99,101 ----
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /Developer/usr/share/autoconf
args: --cache=autom4te.cache
***************
*** 126,128 ****
begin-language: "Autotest"
! args: --prepend-include /usr/share/autoconf
args: autotest/autotest.m4f
--- 126,128 ----
begin-language: "Autotest"
! args: --prepend-include /Developer/usr/share/autoconf
args: autotest/autotest.m4f
***************
*** 140,142 ****
begin-language: "M4sh"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sh.m4f
--- 140,142 ----
begin-language: "M4sh"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sh.m4f
***************
*** 152,154 ****
begin-language: "M4sugar"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sugar.m4f
--- 152,154 ----
begin-language: "M4sugar"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sugar.m4f

To clarify the fix as identified in adl's answer and Nathan's comment on it:

If you have autoconf installed in the default location (under /Developer) as part of XCode 4.3, you'll need to edit /Developer/usr/share/autoconf/autom4te.cfg as it has various wrong paths set it in that don't include the /Developer directory:

(The edits are illustrated as some kind of diff that I found in the Google cache of this post)

*** /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:15:15.000000000 -0700
--- /Developer/usr/share/autoconf/autom4te.cfg 2011-10-28 00:14:33.000000000 -0700
***************
*** 99,101 ****
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /usr/share/autoconf
args: --cache=autom4te.cache
--- 99,101 ----
begin-language: "Autoconf-without-aclocal-m4"
! args: --prepend-include /Developer/usr/share/autoconf
args: --cache=autom4te.cache
***************
*** 126,128 ****
begin-language: "Autotest"
! args: --prepend-include /usr/share/autoconf
args: autotest/autotest.m4f
--- 126,128 ----
begin-language: "Autotest"
! args: --prepend-include /Developer/usr/share/autoconf
args: autotest/autotest.m4f
***************
*** 140,142 ****
begin-language: "M4sh"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sh.m4f
--- 140,142 ----
begin-language: "M4sh"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sh.m4f
***************
*** 152,154 ****
begin-language: "M4sugar"
! args: --prepend-include /usr/share/autoconf
args: m4sugar/m4sugar.m4f
--- 152,154 ----
begin-language: "M4sugar"
! args: --prepend-include /Developer/usr/share/autoconf
args: m4sugar/m4sugar.m4f
⒈起吃苦の倖褔 2024-11-15 00:04:29

我不确定我是否理解您的设置中的原因导致 autom4te 找不到该文件。 autom4te 最初安装在 /usr/bin/ 中后,是否将其移至 Xcode3.2/ 目录?从你的问题中我不清楚(我不熟悉 Xcode,它与 autoconf 捆绑在一起吗?)。

无论如何...安装 Autoconf 软件包时,autom4te 查找 m4sugar.m4 的位置已硬编码在 autom4te 中。事实上,它更加微妙:搜索路径是在DATADIR/autom4te.cfg中配置的,但DATADIR的值被硬编码到autom4te中。您可以通过设置环境变量(如export AC_MACRODIR=/Xcode3.2/usr/share/autoconf)来更改DATADIR的值,但如果您移动了/usr/share/autoconf/autom4te。 cfg/Xcode3.2/usr/share/autoconf/autom4te.cfg,该文件的内容仍将指向 /usr/share/autoconf/ >。

您可以使用本地 ~/.autom4te.cfg 来添加更多 --prepend-include 行,但这也很粗糙。恕我直言,如果您希望在 Xcode3.2/ 中安装 Autoconf,最简单的解决方案是使用 ./configure --prefix /Xcode3.2 && 来安装它。制作&&进行安装。需要不到半分钟。

I am not sure I understand what in your setup causes autom4te not to find the file. Did you move autom4te to the directory Xcode3.2/ after it was initially installed in /usr/bin/? It's not clear to me from your question (I'm not familiar with Xcode, is that bundled with autoconf?).

Anyway... The location where autom4te looks for m4sugar.m4 is hardcoded in autom4te when the Autoconf package is installed. In fact it is even more subtle: the search path is configured in DATADIR/autom4te.cfg, but the value of DATADIR is hardcoded into autom4te. You can change the value of DATADIR by setting an environment variable like export AC_MACRODIR=/Xcode3.2/usr/share/autoconf, but if you moved /usr/share/autoconf/autom4te.cfg to /Xcode3.2/usr/share/autoconf/autom4te.cfg, the contents of that file will still point to /usr/share/autoconf/.

You could have a local ~/.autom4te.cfg to add more --prepend-include lines, but this is crude as well. IMHO the simplest solution if you want Autoconf installed in Xcode3.2/ is to install it with ./configure --prefix /Xcode3.2 && make && make install. It takes less half a minute.

邮友 2024-11-15 00:04:29

在Xcode4环境下:

sudo ln -s /Xcode4/usr/share/autoconf /usr/share/autoconf

In the Xcode4 environment:

sudo ln -s /Xcode4/usr/share/autoconf /usr/share/autoconf
千鲤 2024-11-15 00:04:29

如果您使用 MacPorts 进行大量安装,您可能安装了 autoconf,然后它将添加 autom4te 并开始弄乱您的路径。如果像我一样,您要从 MacPorts 迁移,那么您需要先卸载 autoconf ( sudo port uninstall autoconf ),然后再进行按照 Ergwun 建议的编辑

If you have used MacPorts for installing much, you probably have an installation of autoconf which will then add in autom4te and start messing with your paths. If, like me, you are moving from MacPorts then you'll need to uninstall autoconf ( sudo port uninstall autoconf ) before making edits like the ones suggested by Ergwun

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文