Hi all I wonder what the policy/methodology is concerning compiler selection. I perused the MacPorts guide but couldn't find anything. Am I right in the assumption that MacPorts automatically comes with its own gcc compiler suite and requires it to be present (I think I read something like that somewhere in the FAQ)? If so, on which one can I rely to be there? gcc32, gcc40/1/2 or apple-gcc40? just because the executable have all different names... 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. So, currently I do a hacky set gfortran [lindex [lsort -decreasing [glob \ -type f "${prefix}/bin/gfortran*"]] 0] configure.fc ${gfortran} and hope to get the compiler with the highest version number. For my installation this works, but I'm quite unhappy with it. Does anyone know a better solution to that problem? Thanks for the help Michael
On Sep 28, 2007, at 09:55, Michael Wild wrote:
I wonder what the policy/methodology is concerning compiler selection. I perused the MacPorts guide but couldn't find anything. Am I right in the assumption that MacPorts automatically comes with its own gcc compiler suite and requires it to be present (I think I read something like that somewhere in the FAQ)? If so, on which one can I rely to be there? gcc32, gcc40/1/2 or apple-gcc40? just because the executable have all different names...
No. MacPorts does not require any MacPorts-built gcc to be there. Most ports don't need that. MacPorts itself, and most ports, use the Apple's system gcc, which is 3.3 on Mac OS X 10.3.9 and 4.0 on 10.4.10.
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.
So, currently I do a hacky
set gfortran [lindex [lsort -decreasing [glob \ -type f "${prefix}/bin/gfortran*"]] 0] configure.fc ${gfortran}
and hope to get the compiler with the highest version number. For my installation this works, but I'm quite unhappy with it.
Does anyone know a better solution to that problem?
Yeah, that's hacky. Just depend on gcc42. Some ports have variants for selecting a compiler. See pdftk. But it's only because gcc takes so long to build, especially on PowerPCs. Everyone who has ports that depend on non-Apple gcc, though, should strive to update them to gcc42 so that nobody needs the old versions installed anymore.
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 and with depends_build gcc42 that's all you should need.
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! Thanks for all the help. Michael
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/
Le 30 sept. 07 à 13:57, Weissmann Markus a écrit :
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 mean `depends_lib port:gcc42`.
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/
-- Anthony Ramine, the infamous MacPorts Trac slave. nox@macports.org
participants (4)
-
Michael Wild
-
N_Ox
-
Ryan Schmidt
-
Weissmann Markus