如何强制 /usr/bin/gcc -> /usr/bin/gcc -m32?

发布于 2024-10-06 11:02:28 字数 302 浏览 0 评论 0原文

我的大型捆绑软件发行版的 Makefile 很糟糕。在某些时候,编译器总是“忘记”我想在 32 位程序中进行编译。这导致部分程序具有 64 位库,而其他程序具有 32 位库。

如何在每次运行 gcc 时强制使用 -m32 选项?

br,
尤哈

P.S.我的环境是混合32/64位(macbook5.1,雪豹)。或者:如何使我的系统成为纯 32 位或 64 位系统?

编辑:重点关注覆盖全局变量的坏Makefile。这就是为什么我选择了有效的方法。

I have bad Makefile(s) of a large bundled software distribution. In some point compiler always "forgets" that I want to compile in 32 bit program. This causes that part of the programs have 64 bit libraries and others have 32 bit libraries.

How can I force -m32 option every time that I run gcc?

br,
Juha

P.S. My environment is mixed 32/64 bit (macbook5.1, snow leopard). Alternatively: How can I make my system purely 32 or 64 bits?

edit: Emphasis on the bad Makefiles that override the global variables. Thats why I chosed the hack that works.

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

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

发布评论

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

评论(2

无法回应 2024-10-13 11:02:28

CFLAGS 环境变量设置为具有 -m32 标志。

导出 CFLAGS="-m32"

Set your CFLAGS environment variable to have the -m32 flag.

export CFLAGS="-m32"

泪痕残 2024-10-13 11:02:28

如果你想要一个蹩脚的 hack,你可以用这个 shell 脚本替换 /usr/bin/gcc:

#!/bin/bash
/usr/bin/gcc-4.whatever -m32 "$@"

If you want a crappy hack, you could replace /usr/bin/gcc with this shell script:

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