Re: [cmake-developers] Unsupported -arch x86_64 mysteriously ends up in Fortran_FLAGS
On 01/22/2013 02:11 PM, Mojca Miklavec wrote: I realised that an unsupported compiler flag -arch x86_64 mysteriously sneaks into Fortran_FLAGS when -DCMAKE_OSX_ARCHITECTURES=x86_64 The -arch flag is hard-coded here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v2.8.10.2#l1826 It was added to CMake way back when universal binary support was first added to OS X under the assumption that all compilers that would be used in combination with CMAKE_OSX_ARCHITECTURES would support the flag. Obviously the assumption is wrong. The hard-coded flag needs to be replaced with a lookup of a new per-language platform information variable, perhaps called CMAKE_LANG_OSX_ARCHITECTURE_FLAG -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Unsupported -arch x86_64 mysteriously ends up in Fortran_FLAGS
On Wed, Jan 23, 2013 at 5:29 PM, Brad King wrote: On 01/22/2013 02:11 PM, Mojca Miklavec wrote: I realised that an unsupported compiler flag -arch x86_64 mysteriously sneaks into Fortran_FLAGS when -DCMAKE_OSX_ARCHITECTURES=x86_64 The -arch flag is hard-coded here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmLocalGenerator.cxx;hb=v2.8.10.2#l1826 It was added to CMake way back when universal binary support was first added to OS X under the assumption that all compilers that would be used in combination with CMAKE_OSX_ARCHITECTURES would support the flag. Obviously the assumption is wrong. True. Not even the original gcc compilers (without Apple's modifications) support the -arch flag. MacPorts ship the original gcc compilers and actually use them for a couple of ports. I'm not 100% sure, but some of the reasons include faster and more efficient computations in physics simulations (apparently using the latest gcc 4.8 matters) or support for Fortran. So testing for Mac OS X and GCC doesn't yet guarantee the existence of that flag. The hard-coded flag needs to be replaced with a lookup of a new per-language platform information variable, perhaps called CMAKE_LANG_OSX_ARCHITECTURE_FLAG Thanks a lot for the answer. Since you know the internals much better than I do: do I have to file a bug report myself? Thanks again, Mojca -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
Re: [cmake-developers] Unsupported -arch x86_64 mysteriously ends up in Fortran_FLAGS
On 01/23/2013 03:09 PM, Mojca Miklavec wrote: The hard-coded flag needs to be replaced with a lookup of a new per-language platform information variable, perhaps called CMAKE_LANG_OSX_ARCHITECTURE_FLAG Thanks a lot for the answer. Since you know the internals much better than I do: do I have to file a bug report myself? You can file a report and link to this thread, but I don't know when I'll get time to work on it so it will likely be put in the issue tracker backlog state until a volunteer is available. -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
[cmake-developers] Unsupported -arch x86_64 mysteriously ends up in Fortran_FLAGS
Dear CMake developers, I'm a newbie to CMake (I've never written any project myself), but while trying to install a physics package Root from the master of https://github.com/bbannier/ROOT (https://root.cern.ch/svn/root/trunk) I realised that an unsupported compiler flag -arch x86_64 mysteriously sneaks into Fortran_FLAGS when -DCMAKE_OSX_ARCHITECTURES=x86_64 is passed to cmake. That flag CMAKE_OSX_ARCHITECTURES is added automatically to all projects in MacPorts (third-party package manager for Mac OS X) even when cross-compiling or compilation of fat binaries (like i386+x86_64) is not needed. The g95 compiler ignores -arch ... flag, but GCC's gfortran 4.x throws an error and breaks compilation. I could probably try to prevent DCMAKE_OSX_ARCHITECTURES from being passed to cmake (via some tricks in MacPorts or by modifying MacPorts sources), but I still believe that passing -arch x86_64 to Fortran_FLAGS is a bug in CMake. I tried to figure out when those flags are set, but I don't know enough about CMake. I've seen several places where compiler flags are simply copied from C to Fortran, for example here: # Create a set of shared library variable specific to Fortran # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version if(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) endif() but I don't have enough knowledge to be able to track the problem down to a single spot. There is a slight chance that the problematic flag is introduced by the project, but there are other projects in MacPorts suffering from the same symptoms. The command that I used to compile Root: cmake \ -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.5 \ -DCMAKE_C_COMPILER=/usr/bin/clang \ -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \ -DCMAKE_INSTALL_PREFIX=/path/to/install \ -DCMAKE_OSX_ARCHITECTURES=x86_64 ../root_trunk In case that anyone would want to try it on the particular project, the generated file misc/minicern/CMakeFiles/minicern.dir/flags.make ends up containing the following variables (among others): C_FLAGS = -m64 -pipe -W -Wall -fsigned-char -fno-common -O2 -g -arch x86_64 -fPIC -Ipath/to/some/include/dirs Fortran_FLAGS = -m64 -std=legacy -arch x86_64 -fPIC -Ipath/to/some/include/dirs (Another problem is that -std=legacy is not recognised by g95 and throws another error, but that one is a bug in the project.) I also didn't know how to disable Fortran compiler altogether, but that's a completely different issue. I'm using 64-bit Mac OS X 10.7.4, cmake version 2.8.10. I would be very grateful for any insight about how to get rid of that -arch x86_64 flag. Thanks and best regards, Mojca Related tickets: - https://trac.macports.org/ticket/37732 (about the -arch flag in Fortran) - https://trac.macports.org/ticket/37688 ([also] about development of a package for Root using CMake) - https://savannah.cern.ch/bugs/index.php?99944 (not strictly related though) -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers