diff mbox series

Error message when compiler not present

Message ID CACPK8XemTPvV9KTuMDXew3vxzOw=A2Cj-ToVpe=ZSjrrYC-XRQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series Error message when compiler not present | expand

Commit Message

Joel Stanley May 7, 2019, 5:55 a.m. UTC
Hello,

The other day I was attempting a kernel build and stumbled across this:

$ CROSS_COMPILE=foo make
/bin/sh: 1: foogcc: not found
make: foogcc: Command not found
/bin/sh: 1: foogcc: not found
/bin/sh: 1: foogcc: not found
scripts/kconfig/conf  --syncconfig Kconfig
./scripts/gcc-version.sh: 17: ./scripts/gcc-version.sh: foogcc: not found
./scripts/gcc-version.sh: 18: ./scripts/gcc-version.sh: foogcc: not found
./scripts/gcc-version.sh: 19: ./scripts/gcc-version.sh: foogcc: not found
./scripts/gcc-version.sh: 17: ./scripts/gcc-version.sh: foogcc: not found
./scripts/gcc-version.sh: 18: ./scripts/gcc-version.sh: foogcc: not found
./scripts/gcc-version.sh: 19: ./scripts/gcc-version.sh: foogcc: not found
./scripts/clang-version.sh: 11: ./scripts/clang-version.sh: foogcc: not found
./scripts/gcc-plugin.sh: 11: ./scripts/gcc-plugin.sh: foogcc: not found
init/Kconfig:16:warning: 'GCC_VERSION': number is invalid
/bin/sh: 1: foogcc: not found
make: foogcc: Command not found
Compiler lacks asm-goto support.
make: *** [arch/x86/Makefile:302: checkbin] Error 1

I had something more sensible for CROSS_COMPILE, but the point is it
did not exist in my $PATH.

I tried the patch below but there's still something calling the
$(CROSS_COMPILE)gcc before gcc-version:

$ CROSS_COMPILE=foo  make
/bin/sh: 1: foogcc: not found
make: foogcc: Command not found
Compiler lacks asm-goto support.

This isn't a big deal but if there's a simple fix it would be nice to clean up.

Cheers,

Joel

Comments

Masahiro Yamada May 9, 2019, 7:40 a.m. UTC | #1
Hi Joel,

On Tue, May 7, 2019 at 2:56 PM Joel Stanley <joel@jms.id.au> wrote:
>
> Hello,
>
> The other day I was attempting a kernel build and stumbled across this:
>
> $ CROSS_COMPILE=foo make
> /bin/sh: 1: foogcc: not found
> make: foogcc: Command not found
> /bin/sh: 1: foogcc: not found
> /bin/sh: 1: foogcc: not found
> scripts/kconfig/conf  --syncconfig Kconfig
> ./scripts/gcc-version.sh: 17: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/gcc-version.sh: 18: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/gcc-version.sh: 19: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/gcc-version.sh: 17: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/gcc-version.sh: 18: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/gcc-version.sh: 19: ./scripts/gcc-version.sh: foogcc: not found
> ./scripts/clang-version.sh: 11: ./scripts/clang-version.sh: foogcc: not found
> ./scripts/gcc-plugin.sh: 11: ./scripts/gcc-plugin.sh: foogcc: not found
> init/Kconfig:16:warning: 'GCC_VERSION': number is invalid
> /bin/sh: 1: foogcc: not found
> make: foogcc: Command not found
> Compiler lacks asm-goto support.
> make: *** [arch/x86/Makefile:302: checkbin] Error 1
>
> I had something more sensible for CROSS_COMPILE, but the point is it
> did not exist in my $PATH.
>
> I tried the patch below but there's still something calling the
> $(CROSS_COMPILE)gcc before gcc-version:
>
> $ CROSS_COMPILE=foo  make
> /bin/sh: 1: foogcc: not found
> make: foogcc: Command not found
> Compiler lacks asm-goto support.
>
> This isn't a big deal but if there's a simple fix it would be nice to clean up.

Yeah, I had noticed this, and it is somewhat ugly.

Instead of fixing every script,
I want to terminate Kconfig in the very beginning of the parse stage.

https://patchwork.kernel.org/patch/10936811/


I still see some "/bin/sh: 1: foogcc: not found" in the build stage,
but not fixing up every $(shell ...) calls
since displaying some warnings is not a big deal.

Thanks.

>
> Cheers,
>
> Joel
>
> --- a/scripts/gcc-version.sh
> +++ b/scripts/gcc-version.sh
> @@ -8,6 +8,11 @@
>
>  compiler="$*"
>
> +if [ -x "command -v ${#compiler}" ]; then
> +       echo "Error: Compiler not found." >&2
> +       exit 1
> +fi
> +
>  if [ ${#compiler} -eq 0 ]; then
>         echo "Error: No compiler specified." >&2
>         printf "Usage:\n\t$0 <gcc-command>\n" >&2
diff mbox series

Patch

--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -8,6 +8,11 @@ 

 compiler="$*"

+if [ -x "command -v ${#compiler}" ]; then
+       echo "Error: Compiler not found." >&2
+       exit 1
+fi
+
 if [ ${#compiler} -eq 0 ]; then
        echo "Error: No compiler specified." >&2
        printf "Usage:\n\t$0 <gcc-command>\n" >&2