您可以在 64 位计算机上编译 32 位 Apache DSO(Oracle HTTP Server)吗?

发布于 2024-07-15 09:31:09 字数 262 浏览 5 评论 0原文

我已将 Oracle 数据库和 Oracle HTTP 服务器安装从 32 位计算机迁移到 64 位计算机 - 两台计算机都运行 Linux。 Oracle 数据库是 64 位,但 (Apache) HTTP 服务器是 32 位。

我使用一些非 Oracle DSO(其中之一是 mod_ntlm),但每当我运行标准的“make install”类型的东西时,我最终都会得到一个 64 位模块。

是否有在 64 位机器上编译 32 位 Apache 模块的标准方法?

I've migrated an Oracle database and Oracle HTTP server install from a 32-bit machine to a 64-bit machine - both machines running Linux. Oracle Database is 64-bit, but the (Apache) HTTP server is 32-bit.

I use some non-Oracle DSOs (mod_ntlm for one) but whenever I run the standard "make install" type thing I end up with a 64-bit module.

Is there a standard way to compile 32-bit Apache modules on a 64-bit machine?

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

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

发布评论

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

评论(3

攒眉千度 2024-07-22 09:31:09

作为 Andrew Medico 答案的替代方案,在 PPC 或 SPARC 或 Intel 机器上使用 '-m32' 进行 32 位编译,使用 '-m64' 进行 64 位编译 -因为您实际上并没有提及您正在使用哪种芯片架构,并且该符号适用于所有这些架构。

我经常使用:

CC="gcc -m32" ./configure

确保 32 位编译(或者更频繁地使用 CC="gcc -m64" 确保 64 位编译)。


问:“CC 是 make 使用的环境变量吗?”

答:是的,不过在本例中,configure 也可以识别它,它是由 autoconf 生成的 shell 脚本。 我使用的符号(即我在命令行中使用的符号)在运行 configure 命令时在环境中设置 CC。 另一个答案建议使用:

./configure CC="gcc -m32"

我认为可以达到同样的效果; 我没有尝试过,所以我不知道它是否有效。

如果您运行 ./configure --help | less,您将看到有关如何使用脚本的信息(通常只是标准信息)。 最后,它会列出(一些)相关的环境变量,CC 就是其中之一。

将 C 编译器设置为“gcc -m32”的优点是每次使用编译器时都会设置 32 位标志 - 出错的空间很小。 如果您设置了标志变量(CFLAGS 等),则某些命令可能不会使用它,然后事情可能会出错。

另外,回到问题,make 当然使用了一个名为 CC 的变量(宏)。 您可以在 make 命令行上进行设置:

make CC="gcc -m32"

这会覆盖 makefile 中的任何设置。 相比之下,使用环境变量时,makefile 中的设置会覆盖环境中的值,因此将 CC 设置为环境变量的作用不大。 尽管 make -e 使环境优先于 makefile,但使用它通常是一个危险的选项 - 它可能会产生意想不到的副作用。

As an alternative to Andrew Medico's answer, use '-m32' for 32-bit compilations and '-m64' for 64-bit compilations on PPC or SPARC or Intel machines - since you don't actually mention which chip architecture you are using and that notation works on all of these.

I often use:

CC="gcc -m32" ./configure

to ensure a 32-bit compilation (or, more frequently, CC="gcc -m64" to ensure 64-bit compilation).


Question: "Is CC an environment variable used by make?"

Answer: Yes, though in this case, it is also recognized by configure, which is a shell script generated by autoconf. The notation I used - which is what I use at the command line - sets CC in the environment while the configure command is run. The other answer suggests using:

./configure CC="gcc -m32"

I assume that works and achieves much the same effect; I've not tried it so I don't know that it works.

If you run ./configure --help | less, you will see information (often just standard information) about how to use the script. And at the end, it will list (some of the) relevant environment variables, of which CC is one.

The advantage of setting the C compiler to "gcc -m32" is that the 32-bit flag is set every time the compiler is used - there is very little room for it to go wrong. If you set a flags variable (CFLAGS, etc), there is a chance that some command won't use it, and then things can go awry.

Also, going back to the question, make certainly uses a variable (macro) called CC. And you can set that on the make command line:

make CC="gcc -m32"

That overrides any setting in the makefile. By contrast, using an environment variable, the setting in the makefile overrides the value in the environment, so setting CC as an environment variable is less helpful. Although make -e gives the environment precedence over the makefile, it is usually a dangerous option to use - it can have unexpected side-effects.

绝對不後悔。 2024-07-22 09:31:09
./configure CFLAGS="-march=i686" 

应该做

./configure CFLAGS="-march=i686" 

should do it

樱花细雨 2024-07-22 09:31:09

除了 gcc 中的 -m32 标志之外,如果您同时拥有 32 位和 64 位库,您可能还需要为 ld 添加 -melf_i386 标志,以便将 32 位目标文件正确链接到 32 位库。 64 位 Linux 机器上的标准 ld 将默认为 64 位库,并且在链接发生时您会收到兼容性错误。

Along with the -m32 flag in gcc, you may need to include the -melf_i386 flag for ld to properly link the 32bit object files to the 32bit libraries if you have both the 32bit and 64bit libraries. The standard ld on 64bit linux boxes will default to the 64bit libraries and you get a compatibility error when the linking occurs.

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