* [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
@ 2013-03-22 11:27 Bernhard Walle
2013-03-22 14:17 ` Marc Kleine-Budde
0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Walle @ 2013-03-22 11:27 UTC (permalink / raw)
To: ptxdist
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 <name>.real to real/<name>, i.e. moving the final toolchain symlink
to some other directory, keeping the basename.
It only changes that for the host compiler since a (usually manually
built) cross-compiler doesn't have that problem.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
bin/ptxdist | 5 +++--
scripts/wrapper/libwrapper.sh | 9 ++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
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
- 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_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
diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh
index f376f7f..adf2f08 100644
--- a/scripts/wrapper/libwrapper.sh
+++ b/scripts/wrapper/libwrapper.sh
@@ -21,10 +21,17 @@ fi
. ${PTXDIST_PLATFORMCONFIG}
wrapper_exec() {
+ local compiler_link
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}
+ for c in $0.real "$(dirname $0)/real/$(basename $0)" ; do
+ if [ -x "$c" ] ; then
+ compiler_link="$c"
+ break
+ fi
+ done
+ exec ${PTXDIST_CCACHE} "$compiler_link" ${ARG_LIST} "$@" ${LATE_ARG_LIST}
}
cc_check_args() {
--
1.8.2
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 11:27 [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux Bernhard Walle
@ 2013-03-22 14:17 ` Marc Kleine-Budde
2013-03-22 14:31 ` Bernhard Walle
0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2013-03-22 14:17 UTC (permalink / raw)
To: ptxdist; +Cc: Bernhard Walle
[-- Attachment #1.1: Type: text/plain, Size: 3403 bytes --]
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:
>
> | % 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 <name>.real to real/<name>, i.e. moving the final toolchain symlink
> to some other directory, keeping the basename.
>
> It only changes that for the host compiler since a (usually manually
> built) cross-compiler doesn't have that problem.
>
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
> bin/ptxdist | 5 +++--
> scripts/wrapper/libwrapper.sh | 9 ++++++++-
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> 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
>
> - 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_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
> diff --git a/scripts/wrapper/libwrapper.sh b/scripts/wrapper/libwrapper.sh
> index f376f7f..adf2f08 100644
> --- a/scripts/wrapper/libwrapper.sh
> +++ b/scripts/wrapper/libwrapper.sh
> @@ -21,10 +21,17 @@ fi
> . ${PTXDIST_PLATFORMCONFIG}
>
> wrapper_exec() {
> + local compiler_link
> 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}
> + for c in $0.real "$(dirname $0)/real/$(basename $0)" ; do
> + if [ -x "$c" ] ; then
> + compiler_link="$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_LIST}
> }
>
> cc_check_args() {
>
--
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 |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 14:17 ` Marc Kleine-Budde
@ 2013-03-22 14:31 ` Bernhard Walle
2013-03-22 14:33 ` Marc Kleine-Budde
2013-03-22 14:44 ` Michael Olbrich
0 siblings, 2 replies; 7+ messages in thread
From: Bernhard Walle @ 2013-03-22 14:31 UTC (permalink / raw)
To: ptxdist
* Marc Kleine-Budde <mkl@pengutronix.de> [2013-03-22 15:17]:
>
> 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
Agreed. But I'm waiting if mol accepts the change at all before I'm
sending a new patch.
Regards,
Bernhard
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 14:31 ` Bernhard Walle
@ 2013-03-22 14:33 ` Marc Kleine-Budde
2013-03-22 14:44 ` Michael Olbrich
1 sibling, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2013-03-22 14:33 UTC (permalink / raw)
To: ptxdist; +Cc: Bernhard Walle
[-- Attachment #1.1: Type: text/plain, Size: 704 bytes --]
On 03/22/2013 03:31 PM, Bernhard Walle wrote:
> * Marc Kleine-Budde <mkl@pengutronix.de> [2013-03-22 15:17]:
>>
>> 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
>
> Agreed. But I'm waiting if mol accepts the change at all before I'm
> sending a new patch.
ACK.
Have a nive weekend,
Marc
--
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 |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
[-- Attachment #2: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 14:31 ` Bernhard Walle
2013-03-22 14:33 ` Marc Kleine-Budde
@ 2013-03-22 14:44 ` Michael Olbrich
2013-03-22 15:18 ` Bernhard Walle
1 sibling, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2013-03-22 14:44 UTC (permalink / raw)
To: ptxdist
On Fri, Mar 22, 2013 at 03:31:52PM +0100, Bernhard Walle wrote:
> * Marc Kleine-Budde <mkl@pengutronix.de> [2013-03-22 15:17]:
> >
> > 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
>
> Agreed. But I'm waiting if mol accepts the change at all before I'm
> sending a new patch.
I like it in general. But as Marc said, do the same for the target wrapper,
so everything matches.
Also create the directory in check_dirs(). Just change the existing mkdir
for ${PTX_WRAPPER_DIR}.
Michael
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 14:44 ` Michael Olbrich
@ 2013-03-22 15:18 ` Bernhard Walle
2013-03-22 17:12 ` Michael Olbrich
0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Walle @ 2013-03-22 15:18 UTC (permalink / raw)
To: ptxdist
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 <name>.real to real/<name>, i.e. moving the final toolchain symlink
to some other directory, keeping the basename.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
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}
}
cc_check_args() {
--
1.8.2
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux
2013-03-22 15:18 ` Bernhard Walle
@ 2013-03-22 17:12 ` Michael Olbrich
0 siblings, 0 replies; 7+ messages in thread
From: Michael Olbrich @ 2013-03-22 17:12 UTC (permalink / raw)
To: ptxdist
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 <name>.real to real/<name>, i.e. moving the final toolchain symlink
> to some other directory, keeping the basename.
Applied with one modification...
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-03-22 17:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22 11:27 [ptxdist] [PATCH] Fix (host) gcc wrapper on Gentoo Linux Bernhard Walle
2013-03-22 14:17 ` Marc Kleine-Budde
2013-03-22 14:31 ` Bernhard Walle
2013-03-22 14:33 ` Marc Kleine-Budde
2013-03-22 14:44 ` Michael Olbrich
2013-03-22 15:18 ` Bernhard Walle
2013-03-22 17:12 ` Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox