Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 435324 - sys-apps/file-5.11: cross compile does not respect BUILD_CC
Summary: sys-apps/file-5.11: cross compile does not respect BUILD_CC
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-17 12:21 UTC by Ambroz Bizjak
Modified: 2012-09-19 18:34 UTC (History)
0 users

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


Attachments
emerge output (bug,3.64 KB, text/plain)
2012-09-17 12:22 UTC, Ambroz Bizjak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ambroz Bizjak 2012-09-17 12:21:51 UTC
When the version of file on the host is different from the version being cross-compiled, the ebuild will build itself a file to use for cross_compilation:

                ac_cv_header_zlib_h=no \
                ac_cv_lib_z_gzopen=no \
                CHOST=${CBUILD} \
                CFLAGS=${BUILD_CFLAGS} \
                CXXFLAGS=${BUILD_CXXFLAGS} \
                CPPFLAGS=${BUILD_CPPFLAGS} \
                LDFLAGS="${BUILD_LDFLAGS} -static" \
                do_configure --disable-shared

But CC and CXX were missed here. If they are set, it will try to use the cross compiler to build a native executable, and fail. Fix is to also add:

CC=${BUILD_CC} \
CXX=${BUILD_CXX} \

I've confirmed that this fixes it.

Reproducible: Always
Comment 1 Ambroz Bizjak 2012-09-17 12:22:49 UTC
Created attachment 324090 [details]
emerge output

This is emerge output from failing compile. The setup is as I describe on http://code.google.com/p/ambro-cross-overlay/
Comment 2 SpanKY gentoo-dev 2012-09-19 05:02:05 UTC
try this patch:

--- file-5.11.ebuild    26 Jul 2012 16:35:01 -0000      1.8
+++ file-5.11.ebuild    19 Sep 2012 05:01:53 -0000
@@ -47,6 +47,7 @@ src_configure() {
        # because people often don't keep matching host/target
        # file versions #362941
        if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
+               tc-export_build_env BUILD_C{C,XX}
                ac_cv_header_zlib_h=no \
                ac_cv_lib_z_gzopen=no \
                CHOST=${CBUILD} \
@@ -54,6 +55,8 @@ src_configure() {
                CXXFLAGS=${BUILD_CXXFLAGS} \
                CPPFLAGS=${BUILD_CPPFLAGS} \
                LDFLAGS="${BUILD_LDFLAGS} -static" \
+               CC=${BUILD_CC} \
+               CXX=${BUILD_CXX} \
                do_configure --disable-shared
        fi
Comment 3 Ambroz Bizjak 2012-09-19 14:31:18 UTC
It works. (yes, I made sure file on host is still different version)
Comment 4 SpanKY gentoo-dev 2012-09-19 18:34:36 UTC
should be all set now in the tree; thanks for the report!

Commit message: Use BUILD_{CC,CXX} when cross-compiling
http://sources.gentoo.org/sys-apps/file/file-5.11.ebuild?r1=1.8&r2=1.9