是否有一种透明的方法可以在 Solaris 上强制进行 64 位 gcc 编译 [英] Is there a transparent way to force 64-bit gcc compilation on Solaris
问题描述
有没有办法强制-m64"不覆盖 CXXFLAGS/CFLAGS.我想要像 Linux/BSD amd64 一样的自动 x64 构建环境.
Is there a way to force '-m64' not overriding CXXFLAGS/CFLAGS. I want automatic x64 build environment like in Linux/BSD amd64.
我为什么需要这个?
问题是我需要在 Solaris 上作为 x64 的项目的复杂性.它包含几个部分,每个部分都可能使用特定的 C/C++ 编译器标志.所以,我不能只是跑:
The problem is complexity of the project I need to be buit as x64 on Solaris. It contains several parts and each may use specific C/C++ compiler flags. So, I can't just run:
CXXFLAGS=-m64 O2 ...
CFLAGS=-m64 -O2 ...
./configure
因为没有通用的 C/C++ 标志.
because there are no common C/C++ flags.
我需要的是透明地将-m64"附加到每个 gcc/g++ 调用的方法.
All I need is the way to transparently append '-m64' to every gcc/g++ call.
推荐答案
您可以编写一个包装器(例如:~/bin/gcc)来添加所需的选项并将 ~/bin 放在您的 PATH 中.例如:
You can write a wrapper (eg: ~/bin/gcc) that would add the required option(s) and put ~/bin first in your PATH. eg:
#!/bin/ksh
/usr/sfw/bin/gcc -m64 "$@"
这篇关于是否有一种透明的方法可以在 Solaris 上强制进行 64 位 gcc 编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!