Is there a transparent way to force 64-bit gcc compilation on Solaris

你说的曾经没有我的故事 提交于 2019-12-11 07:08:11

问题


Is there a way to force '-m64' not overriding CXXFLAGS/CFLAGS. I want automatic x64 build environment like in Linux/BSD amd64.

Why do I need this?

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

because there are no common C/C++ flags.

All I need is the way to transparently append '-m64' to every gcc/g++ call.


回答1:


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 "$@"



回答2:


CPPFLAGS is used for the c preprocessor. It should be picked up by both gcc and g++.

Reference: http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html



来源:https://stackoverflow.com/questions/3322276/is-there-a-transparent-way-to-force-64-bit-gcc-compilation-on-solaris

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!