[MacPorts] #48331: x265 fails to install due to CMAKE_CXX_COMPILER_ID being unset
MacPorts
noreply at macports.org
Mon Sep 28 19:52:30 PDT 2015
#48331: x265 fails to install due to CMAKE_CXX_COMPILER_ID being unset
-------------------------+-------------------------
Reporter: jeremyhu@… | Owner: michaelld@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.3.3
Resolution: | Keywords:
Port: cmake |
-------------------------+-------------------------
Comment (by ryandesign@…):
I have reported this problem to the [http://public.kitware.com/pipermail
/cmake-developers/2015-September/026586.html cmake-developers mailing
list]. Reproducing the relevant parts of my message here:
> I found that in CMakeDetermineCompilerId.cmake, cmake compiles a test
program (CMAKE_DETERMINE_COMPILER_ID_BUILD) which defines certain strings
that describe the compiler, and then examines the strings in the compiled
a.out file (CMAKE_DETERMINE_COMPILER_ID_CHECK). If the file contains more
than one "INFO:compiler[...]" string, cmake assumes something went wrong
and sets COMPILER_ID_TWICE to 1 which causes the compiler id to be
forgotten.
>
> The problem is that when building universal, the a.out file produced by
the test will contain multiple copies of the strings -- once for each
architecture. What the compiler does for you when you use multiple -arch
flags is to compile the file separately, once for each architecture, then
glue the separate files together into a single file (using the lipo
program), so naturally such a file will contain multiple copies of any
strings. This is not a bug; this is how universal binaries work. The bug
is that cmake considers this valid condition to be erroneous.
>
> Here is an example of the duplicated strings:
>
> {{{
> $ lipo -info build/CMakeFiles/3.3.2/CompilerIdC/a.out
> Architectures in the fat file:
work/build/CMakeFiles/3.3.2/CompilerIdC/a.out are: x86_64 i386
> $ strings -arch all build/CMakeFiles/3.3.2/CompilerIdC/a.out
> INFO:compiler[AppleClang]
> INFO:platform[Darwin]
> INFO:arch[]
> INFO:compiler_version[00000007.00000000.00000000.07000072]
> INFO:compiler[AppleClang]
> INFO:platform[Darwin]
> INFO:arch[]
> INFO:compiler_version[00000007.00000000.00000000.07000072]
> }}}
>
> (I know cmake uses its internal FILE(STRINGS) command, not the strings
program, but I presume they are similar.)
>
> I was able to get cmake to correctly identify the compilers even when
building universal by simply removing the COMPILER_ID_TWICE stuff from
CMakeDetermineCompilerId.cmake, but perhaps you want something more
elegant that verifies that if there are multiple definitions of a
particular info line, all the definitions are the same.
Before making [attachment:cmake.diff such a change] to the cmake port,
I'll wait and see if the developers have a better suggestion.
--
Ticket URL: <https://trac.macports.org/ticket/48331#comment:5>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list