From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Message-ID: <514C680D.7070504@pengutronix.de> Date: Fri, 22 Mar 2013 15:17:49 +0100 From: Marc Kleine-Budde MIME-Version: 1.0 References: <1363951674-14651-1-git-send-email-bernhard@bwalle.de> In-Reply-To: <1363951674-14651-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: multipart/mixed; boundary="===============0039725197==" Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Bernhard Walle This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============0039725197== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2KWGSEERPQPCUPAAIGJVI" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2KWGSEERPQPCUPAAIGJVI Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 03/22/2013 12:27 PM, 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: >=20 > | % 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 p= laces: > | * gcc-config: - //etc/portage/make.conf > | * gcc-config: - active environment > | gcc-config: error: could not get compiler binary path: No such file = or directory >=20 > I'm not a Gentoo expert (I'm just forced to use it for that purpose ;-)= ), > so I cannot explain further details. >=20 > This patch makes ptxdist working on Gentoo by changing the symbolic lin= k > from .real to real/, i.e. moving the final toolchain symlin= k > to some other directory, keeping the basename. >=20 > It only changes that for the host compiler since a (usually manually > built) cross-compiler doesn't have that problem. >=20 > Signed-off-by: Bernhard Walle > --- > bin/ptxdist | 5 +++-- > scripts/wrapper/libwrapper.sh | 9 ++++++++- > 2 files changed, 11 insertions(+), 3 deletions(-) >=20 > diff --git a/bin/ptxdist b/bin/ptxdist > index 95382e6..a6317bf 100755 > --- a/bin/ptxdist > +++ b/bin/ptxdist > @@ -588,12 +588,13 @@ check_compiler() { > ;; > esac > =20 > - ln -sf "${cc_abs}" "${PTX_WRAPPER_DIR}/${cc_default}.real" && > + [ -d "${PTX_WRAPPER_DIR}/real" ] || mkdir "${PTX_WRAPPER_DIR}/real" > + ln -sf "${cc_abs}" "${PTX_WRAPPER_DIR}/real/${cc_default}" && > ln -sf "${SCRIPTSDIR}/wrapper/host-${cc_default}-wrapper" "${PTX_WRA= PPER_DIR}/${cc_default}" && > =20 > 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 > diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper= =2Esh > index f376f7f..adf2f08 100644 > --- a/scripts/wrapper/libwrapper.sh > +++ b/scripts/wrapper/libwrapper.sh > @@ -21,10 +21,17 @@ fi > . ${PTXDIST_PLATFORMCONFIG} > =20 > wrapper_exec() { > + local compiler_link > if [ "${PTXDIST_VERBOSE}" =3D 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} > + for c in $0.real "$(dirname $0)/real/$(basename $0)" ; do > + if [ -x "$c" ] ; then > + compiler_link=3D"$c" > + break > + fi > + done We don't want to have this loop in the hot path. Iff we agree on the real/X instead of X.real solution, then you should convert all (host and cross) to use real/X Marc > + exec ${PTXDIST_CCACHE} "$compiler_link" ${ARG_LIST} "$@" ${LATE_ARG_L= IST} > } > =20 > cc_check_args() { >=20 --=20 Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | ------enig2KWGSEERPQPCUPAAIGJVI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlFMaBAACgkQjTAFq1RaXHPDXgCfRYTOQJVUgVDYKZstu4WlF88C EXYAmwZF5eVHD9caZyvFwCzryJ+yKtqS =1WkN -----END PGP SIGNATURE----- ------enig2KWGSEERPQPCUPAAIGJVI-- --===============0039725197== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ptxdist mailing list ptxdist@pengutronix.de --===============0039725197==--