Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 607904 - cmake-utils.eclass: Set CMAKE_SYSTEM_PROCESSOR for cross compiling.
Summary: cmake-utils.eclass: Set CMAKE_SYSTEM_PROCESSOR for cross compiling.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-01 12:28 UTC by Alexis Ballier
Modified: 2017-02-06 23:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexis Ballier gentoo-dev 2017-02-01 12:28:33 UTC
media-libs/x265 fails to cross compile for arm here since it relies on CMAKE_SYSTEM_PROCESSOR for enabling some hand written assembly.

By default, CMAKE_SYSTEM_PROCESSOR is set to CMAKE_HOST_SYSTEM_PROCESSOR, which is obtained via 'uname -m' (this is not what cmake docs say but what the code of cmake 3.7.2 says...).

Setting CMAKE_SYSTEM_PROCESSOR to ${CHOST%%-*} in the cmake toolchain file seems to be what we need to get this work properly.


Proposed patch:

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 7b3500b197..512bd93c7b 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -538,6 +538,7 @@ enable_cmake-utils_src_configure() {
                SET (CMAKE_Fortran_COMPILER "${myFC/ /;}")
                SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
                SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
+               SET (CMAKE_SYSTEM_PROCESSOR "${CHOST%%-*}")
        _EOF_
 
        # We are using the C compiler for assembly by default.
Comment 1 Alexis Ballier gentoo-dev 2017-02-01 12:29:48 UTC
Note in case this was not clear: this was tested to fix cross compiling x265.
Comment 2 Michael Palimaka (kensington) gentoo-dev 2017-02-01 13:11:05 UTC
Looks fine to me.
Comment 3 Johannes Huber (RETIRED) gentoo-dev 2017-02-06 14:49:37 UTC
(In reply to Michael Palimaka (kensington) from comment #2)
> Looks fine to me.

+1
Comment 4 Maciej Mrozowski gentoo-dev 2017-02-06 23:04:59 UTC
Looks fine and should be harmless for non-crosscompilling as well.
Thanks, I took the liberty to push it to master.