Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 576978

Summary: media-libs/soxr: cross-compile fails due to HAVE_WORDS_BIGENDIAN cmake macro that executes tests programs
Product: Gentoo Linux Reporter: Denis Sokolovsky <ganellon>
Component: Current packagesAssignee: Cross compilation support <cross>
Status: UNCONFIRMED ---    
Severity: normal CC: embedded, jstein, sound
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: TryRunResults.cmake
build.log
emerge-x86_64-isis_multilib-linux-gnu --info soxr

Description Denis Sokolovsky 2016-03-10 16:52:29 UTC
Created attachment 427902 [details]
TryRunResults.cmake

After environment preparation with crossdev build of media-libs/soxr failed on configure phase with message "cmake failed".

From "build.log":
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   HAVE_WORDS_BIGENDIAN_EXITCODE (advanced)
For details see /usr/x86_64-isis_multilib-linux-gnu/tmp/portage/media-libs/soxr-0.1.2/work/soxr-0.1.2-Source-abi_x86_64.amd64/TryRunResults.cmake
-- Performing Test HAVE_WORDS_BIGENDIAN - Failed
Comment 1 Pacho Ramos gentoo-dev 2016-03-14 12:34:42 UTC
please provide full build.log and emerge --info soxr
Comment 2 Denis Sokolovsky 2016-03-14 14:06:48 UTC
Created attachment 428206 [details]
build.log

It doesn't contain any useful information.
Comment 3 Denis Sokolovsky 2016-03-14 14:07:54 UTC
Created attachment 428208 [details]
emerge-x86_64-isis_multilib-linux-gnu --info soxr
Comment 4 Alexis Ballier gentoo-dev 2016-03-14 15:31:44 UTC
well, I remember adding CMAKE_EXTRA_CACHE_FILE to cmake-utils.eclass for this specific case.

crossdev has config.site support for fixing that kind of failure with autotools, I don't know of any plan to do the same for cmake, not even if it would make sense, so I'll leave crossdev maintainers comment



there isn't much we can do on the ebuild side, what I do with that kind of failure, is:
- fill the TryRunResults.cmake file properly
- copy it to e.g. $SYSROOT/etc/portage/TryRunResults.cmake/${package_name}
- add a "$CAT/$PKG $PKG.conf" line to $SYSROOT/etc/portage/package.env
- create a $SYSROOT/etc/portage/env/$PKG file containing:
 CMAKE_EXTRA_CACHE_FILE="${SYSROOT}/etc/portage/TryRunResults.cmake/$PKG"


now portage & cmake-utils.eclass will append this cache file when you build "$CAT/$PKG", giving it the try run result it is asking for
Comment 5 SpanKY gentoo-dev 2016-03-14 18:07:33 UTC
i don't think crossdev is relevant here ... any code using TRY_RUN w/out compile-time fallback is bad.  especially when the question can easily be answered w/only compile-time tests.

i'm assuming "HAVE_WORDS_BIGENDIAN_EXITCODE" is just a "is the target big endian" test, in which case autotools solved this ages ago.  this is sadly people re-inventing autotools (and failing) because they don't understand how to do it properly in the first place.

look at the AC_C_BIGENDIAN macro to see how autotools does it using only compile checks.  or if you want to fire&forget w/out fixing it upstream, toolchain-funcs has a `tc-endian` func you can insert into the soxr ebuild.