MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0015835 | CMake | CMake | public | 2015-11-05 16:44 | 2016-06-10 14:31 |
|
Reporter | David Ryskalczyk | |
Assigned To | Kitware Robot | |
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | moved | |
Platform | Apple | OS | Mac OS X | OS Version | 10.11 |
Product Version | CMake 3.3.2 | |
Target Version | | Fixed in Version | | |
|
Summary | 0015835: Teach BasicConfigVersion to support Apple universal binaries |
Description | CMake currently hardcodes the bitness of a built package in the .cmake config file. As Mac OS X supports universal binaries, where a package can be compiled as both 32 and 64 bit, this is inaccurate, and causes problems when linking to libraries built as universal using CMAKE_OSX_ARCHITECTURES.
This affects all versions of Mac OS X. |
Steps To Reproduce | Build a library as a universal binary (using -DCMAKE_OSX_ARCHITECTURES=x86_64;i386); then try compiling a program that uses that library as either x86_64 or i386. One of them will work, the other will not. If the Config .cmake file is opened in an editor, it is obvious that the bitness is recorded and checked, based on the value of CMAKE_SIZEOF_VOID_P — which is inaccurate when the binary is built as universal. |
Additional Information | A better fix might be to store a list of architectures/bitness that the package is built as, but I'm unsure of how to do this in CMake.
A patch is attached which simply ignores the bitness section of the config .cmake files when building on OS X. |
Tags | No tags attached. |
Relationships | |
Attached Files | cmake-osx-universal-patch.diff (2,026) 2015-11-05 16:44 https://public.kitware.com/Bug/file/5564/cmake-osx-universal-patch.diff |
|
Issue History |
Date Modified | Username | Field | Change |
2015-11-05 16:44 | David Ryskalczyk | New Issue | |
2015-11-05 16:44 | David Ryskalczyk | File Added: cmake-osx-universal-patch.diff | |
2015-11-06 08:36 | Brad King | Note Added: 0039841 | |
2015-11-06 09:23 | David Ryskalczyk | Note Added: 0039844 | |
2015-11-06 09:24 | David Ryskalczyk | Note Edited: 0039844 | bug_revision_view_page.php?bugnote_id=39844#r1948 |
2015-11-06 10:33 | Brad King | Summary | CMake hardcodes bitness in .cmake files for universal binaries => Teach BasicConfigVersion to support Apple universal binaries |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042881 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes |
|
(0039841)
|
Brad King
|
2015-11-06 08:36
|
|
The purpose of the CMAKE_SIZEOF_VOID_P check is to guard against architecture mismatches, so on OS X this block should somehow check CMAKE_OSX_ARCHITECTURES instead, at least if the project was built with that set. |
|
|
(0039844)
|
David Ryskalczyk
|
2015-11-06 09:23
(edited on: 2015-11-06 09:24) |
|
This would require mapping from CMAKE_OSX_ARCHITECTURES to CMAKE_SIZEOF_VOID_P:
If a project is built with CMAKE_OSX_ARCHITECTURES set to i386;x86_64 (or likewise the equivalent for iOS), then it will be built in both 32-bit and 64-bit, and both 32-bit and 64-bit void pointers are acceptable. If a project then is built as single 32-bit or 64-bit and links against a universal package, CMAKE_OSX_ARCHITECTURES may not be set at all, so there may not be anything to compare to. The only solution I can see is one that would require a hardcoded list indicating that i386 is 32-bit, x86_64 is 64-bit, etc, unless there is something in the CMake internals that can be used here — and I'm not sufficiently familiar with that.
If there's a better way to do this, I'd like to know.
|
|
|
(0042881)
|
Kitware Robot
|
2016-06-10 14:29
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|