compiler selection

Weissmann Markus mww at macports.org
Sun Sep 30 04:57:02 PDT 2007


On 30.09.2007, at 12:13, Michael Wild wrote:

> Ryan Schmidt wrote:
>> On Sep 28, 2007, at 14:45, Ryan Schmidt wrote:
>>> On Sep 28, 2007, at 09:55, Michael Wild wrote:
>>>
>>>> My problem actually is that a port which I'm preparing requires  
>>>> gfortran which doesn't come with Apple's system gcc but is in  
>>>> port:gcc42. I could simply do "configure.fc ${prefix}/bin/ 
>>>> gfortran-mp-4.2, but what if someone has another gcc installed?  
>>>> I could depends_build on gcc42 but if a gcc suite is required by  
>>>> MacPorts anyways I wouldn't like to impose something which might  
>>>> install another compiler suite unnecessarily.
>>>
>>> If you require gfortran, you should depends_build on gcc42.  
>>> Nevermind anyone who has gcc43 installed; that's beta and  
>>> shouldn't be relied on until gcc44 is released, at which point  
>>> the port can be updated. Nevermind anyone who has gcc41 or gc40  
>>> or earlier installed; any ports that still depend on those should  
>>> be updated to gcc42.
>> Oh, I meant to say: and then you go:
>> configure.compiler gcc-4.0
>
> You mean
>
> configure.compiler macports-gcc-4.2
>
> else it doesn't work...
>
>> and with depends_build gcc42 that's all you should need.
>
> Yep, works like a charm now!
>

Well, you need to pay attention: If you have C++ or Objective-C code,  
it will link to the C++/Objective-C lib of the used compiler.
So if you build a C++ program, this needs to be "depends_lib gcc42"!  
For pure C programs, a "depends_build" is sufficient though.

You can check out if your program does this by doing a `otool -L name- 
of-the-binary-or-dynamic-library'. C++ programs compiled with  
macports gcc 4.2 will return e.g. '/opt/local/lib/gcc42/libstdc++. 
6.dylib'.


-Markus

---
Markus W. Weissmann
http://www.mweissmann.de/


---
Markus W. Weissmann
http://www.mweissmann.de/





More information about the macports-dev mailing list