Chosing the C and C++ compilers

Anders F Björklund afb at macports.org
Thu Nov 6 07:05:57 PST 2008


Akim Demaille wrote:

> Ah, OK, didn't think about that, thanks!  Then in that case I  
> suppose that there are means to tell /usr/bin/gcc-4.0 what arch I'm  
> aiming for (686, ppc, or universal).  I suppose via something like - 
> march.  In which case, it's even better than using the fully  
> qualified compiler: /usr/bin/gcc-4.0 with the appropriate flags  
> allows to build for the three cases.
>
> But apparently in the default mode it compiles for the build  
> machine, which is not what I need.  So I guess the question is  
> rather: do I have a means to tell /usr/bin/gcc-4.0 via  
> macports.conf the set of archs I want to compile for?

-march and -mtune set which machine you want to aim the optimizations  
for
-arch and -m32/-m64 set which architectural platform you want to  
compile for

And when you are done instructing GCC, you also need to tell the other
parts of the build system what the platform is - for instance  
configure...


There are some hacks in configure and universal for setting these,
but they don't have really a simple configuration for cross-compiling.

The default MacPorts setup is to compile everything locally only,
so building for other machines is something of an after-thought...

--anders



More information about the macports-users mailing list