MantisBT - CMake
View Issue Details
0013742CMakeCMakepublic2012-11-26 15:332013-04-17 08:54
Nick Hutchinson 
Brad King 
normalminoralways
closedfixed 
LinuxUbuntu12.10
CMake 2.8.10.1 
CMake 2.8.11CMake 2.8.11 
0013742: support multiarch include paths for Debian/Ubuntu
On my Ubuntu 12.10 box, headers for libffi are located at /usr/include/i386-linux-gnu/. This means that a simple find_path(FFI_INCLUDE_DIR NAMES ffi.h) won't find the header, as /usr/include/i386-linux-gnu/ is not searched by default. It ought to be; when compiling with either GCC or Clang, this directory is in the default #include search list.
1. On a multiarch system, e.g. Ubuntu, attempt to use find_path() to find an architecture-specific header.

Expected behaviour:
It "just works": CMake searches the appropriate include directory, without requiring the user to add any supplementary search paths, suffixes, and so on. This seems to be the behaviour with find_library(), for example.

Actual behaviour:
CMake fails to find the header.
I'm not sure how robust this is, but I'm currently working around this issue by using the following:

find_file(FFI_INCLUDE_DIR NAMES ffi.h PATH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE})
No tags attached.
related to 0012037closed Brad King support multiarch lib paths for Debian/Ubuntu 
patch 0001-Teach-find_-path-file-about-Linux-multiarch-13742.patch (2,431) 2012-11-26 17:07
https://public.kitware.com/Bug/file/4576/0001-Teach-find_-path-file-about-Linux-multiarch-13742.patch
Issue History
2012-11-26 15:33Nick HutchinsonNew Issue
2012-11-26 16:18Brad KingNote Added: 0031717
2012-11-26 16:18Brad KingRelationship addedrelated to 0012037
2012-11-26 16:19Brad KingTarget Version => CMake 2.8.11
2012-11-26 16:19Brad KingSummaryfind_path() ought to pick up architecture-specific headers on multiarch systems => support multiarch include paths for Debian/Ubuntu
2012-11-26 17:07Brad KingAssigned To => Brad King
2012-11-26 17:07Brad KingStatusnew => assigned
2012-11-26 17:07Brad KingFile Added: 0001-Teach-find_-path-file-about-Linux-multiarch-13742.patch
2012-11-26 17:07Brad KingNote Added: 0031720
2012-11-27 08:48Brad KingNote Added: 0031724
2012-11-27 08:48Brad KingStatusassigned => resolved
2012-11-27 08:48Brad KingResolutionopen => fixed
2012-11-27 08:48Brad KingFixed in Version => CMake 2.8.11
2013-04-17 08:54Robert MaynardNote Added: 0032883
2013-04-17 08:54Robert MaynardStatusresolved => closed

Notes
(0031717)
Brad King   
2012-11-26 16:18   
According to

 http://wiki.debian.org/Multiarch/LibraryPathOverview#Multiarch_and_cross-compilation [^]

there is not yet a standard place for multiarch headers, but page says it was lasted edited on 2011-09-18. I now see /usr/include/<triplet> listed here:

 https://wiki.ubuntu.com/MultiarchCross [^]

Multiarch support was added in find_library here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b41ad3b3 [^]

for issue 0012037. A similar change will be needed for find_path and find_file.
(0031720)
Brad King   
2012-11-26 17:07   
Please try attached "0001-Teach-find_-path-file-about-Linux-multiarch-13742.patch".
(0031724)
Brad King   
2012-11-27 08:48   
Fixed and test added:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b96f6fc2 [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da1d9bac [^]
(0032883)
Robert Maynard   
2013-04-17 08:54   
Closing resolved issues that have not been updated in more than 4 months.