From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ptx.hi.pengutronix.de ([2001:6f8:1178:2:5054:ff:fec0:8e10] ident=Debian-exim) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UJ5W6-0002Wg-Jd for ptxdist@pengutronix.de; Fri, 22 Mar 2013 18:12:34 +0100 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.72) (envelope-from ) id 1UJ5W4-0000WC-Hc for ptxdist@pengutronix.de; Fri, 22 Mar 2013 18:12:32 +0100 Date: Fri, 22 Mar 2013 18:12:32 +0100 From: Michael Olbrich Message-ID: <20130322171232.GB1289@pengutronix.de> References: <20130322144442.GG28648@pengutronix.de> <1363965525-2049-1-git-send-email-bernhard@bwalle.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1363965525-2049-1-git-send-email-bernhard@bwalle.de> Subject: Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de On Fri, Mar 22, 2013 at 04:18:45PM +0100, Bernhard Walle wrote: > On Gentoo, the host compiler can only be executed if basename(argv[0]) > is 'gcc' (or 'g++' etc.), not if it's 'gcc.real'. Then it invokes > gcc-config and fails: > > | % ln -s /usr/bin/gcc gcc.real > | % ./gcc.real --version > | > | * gcc-config: Could not get portage CHOST! > | * gcc-config: You should verify that CHOST is set in one of these places: > | * gcc-config: - //etc/portage/make.conf > | * gcc-config: - active environment > | gcc-config: error: could not get compiler binary path: No such file or directory > > I'm not a Gentoo expert (I'm just forced to use it for that purpose ;-)), > so I cannot explain further details. > > This patch makes ptxdist working on Gentoo by changing the symbolic link > from .real to real/, i.e. moving the final toolchain symlink > to some other directory, keeping the basename. Applied with one modification... > Signed-off-by: Bernhard Walle > --- > v2: > - create directory in check_dirs() > - implement the change for both the native and the cross toolchain > > bin/ptxdist | 9 +++++---- > scripts/wrapper/libwrapper.sh | 2 +- > 2 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/bin/ptxdist b/bin/ptxdist > index 95382e6..ca09295 100755 > --- a/bin/ptxdist > +++ b/bin/ptxdist > @@ -510,7 +510,8 @@ check_dirs() { > done > > rm -rf -- "${PTX_WRAPPER_DIR}" && > - mkdir -p -- "${PTX_WRAPPER_DIR}" || ptxd_bailout "cannot create dir: '${PTX_WRAPPER_DIR}'" > + mkdir -p -- "${PTX_WRAPPER_DIR}/real" || > + ptxd_bailout "cannot create dir: '${PTX_WRAPPER_DIR}/real'" > > # check for case sensitive file system > for dir in \ > @@ -588,12 +589,12 @@ check_compiler() { > ;; > esac > > - ln -sf "${cc_abs}" "${PTX_WRAPPER_DIR}/${cc_default}.real" && > + ln -sf "${cc_abs}" "${PTX_WRAPPER_DIR}/real/${cc_default}" && > ln -sf "${SCRIPTSDIR}/wrapper/host-${cc_default}-wrapper" "${PTX_WRAPPER_DIR}/${cc_default}" && > > if [ -n "${cc_alternate}" ]; then > ln -sf "${cc_default}" "${PTX_WRAPPER_DIR}/${cc_alternate}" && > - ln -sf "${cc_default}.real" "${PTX_WRAPPER_DIR}/${cc_alternate}.real" > + ln -sf "${cc_default}" "${PTX_WRAPPER_DIR}/real/${cc_alternate}" > fi || \ > ptxd_bailout "unable to create compiler wrapper link" > done > @@ -674,7 +675,7 @@ check_compiler() { > rm -f "${PTXDIST_PLATFORMDIR}/selected_toolchain" && > ln -sf "${toolchain}" "${PTXDIST_PLATFORMDIR}/selected_toolchain" && > for cc in gcc g++ cpp ld; do > - ln -sf "$(which ${compiler_prefix}${cc})" "${PTX_WRAPPER_DIR}/${compiler_prefix}${cc}.real" && > + ln -sf "$(which ${compiler_prefix}${cc})" "${PTX_WRAPPER_DIR}/real/${compiler_prefix}${cc}" && > ln -sf "${SCRIPTSDIR}/wrapper/${cc}-wrapper" "${PTX_WRAPPER_DIR}/${compiler_prefix}${cc}" > done > } > diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh > index f376f7f..ede99cb 100644 > --- a/scripts/wrapper/libwrapper.sh > +++ b/scripts/wrapper/libwrapper.sh > @@ -24,7 +24,7 @@ wrapper_exec() { > if [ "${PTXDIST_VERBOSE}" = 1 -a -n "${PTXDIST_FD_LOGFILE}" ]; then > echo "wrapper: ${PTXDIST_CCACHE} ${0##*/} ${ARG_LIST} $* ${LATE_ARG_LIST}" >&${PTXDIST_FD_LOGFILE} > fi > - exec ${PTXDIST_CCACHE} $0.real ${ARG_LIST} "$@" ${LATE_ARG_LIST} > + exec ${PTXDIST_CCACHE} "$(dirname "$0")/real/$(basename "$0")" ${ARG_LIST} "$@" ${LATE_ARG_LIST} I've replaced dirname/basename with some shell magic. That's faster. Michael > } > > cc_check_args() { > -- > 1.8.2 > > > -- > ptxdist mailing list > ptxdist@pengutronix.de > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- ptxdist mailing list ptxdist@pengutronix.de