[Trilinos-Users] Inquiry about errors from cmake when attempting to compile Trilinos 10.6 on MacOS (Snow Leopard) with Portland Group compilers (version 10.8)

Brad King brad.king at kitware.com
Wed Nov 10 13:23:10 MST 2010


On 11/10/2010 02:05 PM, Aytekin Gel wrote:
> I tried it but unfortunately it didn't resolve it. I still have the
> error originating from unknown flag of " -headerpad_max_install_names".

The HAVE_FLAG_SEARCH_PATHS_FIRST option has nothing to do with this.
It affects the "-Wl,-search_paths_first" option that is first on the
command line that gives the error:

>   /opt/pgi/osx86-64/2010/mpi/openmpi/bin/mpicc -Wl,-search_paths_first
>   -headerpad_max_install_names
>   CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec

This caused Dave to accidentally misread your original problem.

>   pgcc-Error-Unknown switch: -headerpad_max_install_names

The -headerpad_max_install_names flag is actually to the *linker* but
the gcc compiler knows how to pass it through.  If we use

  -Wl,-headerpad_max_install_names

instead then pgcc should also pass it through.  Try applying the patch
below to your CMake installation's Modules directory.

-Brad


diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index db0642e..a99ff4a 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -33,8 +33,8 @@ SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
 SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
 SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")

-SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names")
-SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names")
+SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names")
+SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names")

 IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
   SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
@@ -42,8 +42,8 @@ IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
 ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)

 SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
-SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
-SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
 SET(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
 SET(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")



More information about the Trilinos-Users mailing list