0

I'm running a makefile in Cygwin. The makefile first calls make_standalone_toolchain.py, which creates all of the toolchains. I think I'm saying this right, but I'm not a Linux person and I'm not sure of the terminology. Regardless, this works.

Then, the makefile calls a shell script which uses one of the toolchains. Here is the code in the shell script that is throwing the error:

cat > $test.c << EOF
int foo() { return 0; }
EOF
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
if try $CC -c $CFLAGS $test.c; then
  :
else
  echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
  leave 1
fi

And here is the logged error in configure.log:

Checking for obsessive-compulsive compiler options...
=== ztest1530.c ===
int foo() { return 0; }
===
aarch64-linux-android-gcc -c -fstack-protector-all -march=armv8-a -ftree-vectorize -fuse-ld=gold -O3 ztest1530.c
./configure: line 373: aarch64-linux-android-gcc: command not found
(exit code 127)
Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
** ./configure aborting.
--------------------

In the makefile:

CC=aarch64-linux-android-gcc

And the passed-in CFLAGS:

CFLAGS="-fstack-protector-all -march=armv8-a -ftree-vectorize -fuse-ld=gold -O3"

It says that aarch64-linux-android-gcc: command not found
but I have this in the toolchain/bin folder: aarch64-linux-android-gcc.cmd
and I have the toolchain/bin folder in the PATH Environment Variable.

I think I might have to call this differently:

if try $CC -c $CFLAGS $test.c; then

since it is a .cmd file. I'm not sure if this is the issue or if this is how it should be done. Thanks for any help you can give.

Edit

Thank you @SomethingDark, for pointing out that you cannot run batch files in cygwin, I was overlooking that. However, in the toolchain/bin folder, next to the .cmd file, I also have a aarch64-linux-android-gcc file. Why does cygwin not see this file even though I have the path set in the Environment Variables?

Alexa Kirk
  • 152
  • 10
  • .cmd is ba**t**ch, .sh is bash. You can't run batch scripts in cygwin. – SomethingDark Nov 09 '22 at 22:29
  • Have you tried conditional assignment, like if cygwin CC=…cmd ? – Philippe Nov 10 '22 at 00:30
  • The error message from the script is misleading; the problem is that you don't _have_ a compiler. – tripleee Nov 10 '22 at 14:41
  • See also https://stackoverflow.com/a/56312275/874188 – tripleee Nov 10 '22 at 14:42
  • But I do have the compiler in the toolchain/bin folder. It is called `aarch64-linux-android-gcc` And I have the path to the at folder in the Path Environment Variable. And it is visible in cygwin when I type `echo $PATH`. So why does it show as `command not found`? – Alexa Kirk Nov 10 '22 at 16:08
  • I'm guessing that's a shell script (you'd have to run `file aarch64-linux-android-gcc` to confirm) and that there's something in that script that can't be found and _that's_ what's being reported. If it's a regular executable, you may just need to call it with the full path to that file instead. – SomethingDark Nov 10 '22 at 19:53
  • AFIK, `try` is not a standard utility in Cygwin. What is it doing? – user1934428 Nov 14 '22 at 09:05
  • @SomethingDark you said that you can't run batch scripts in cygwin, but according to [this post](https://stackoverflow.com/questions/787522/why-is-it-that-cygwin-can-run-bat-scripts), you can. I think I found my issue, running make_standalone_toolchain.py does not create the aarch64-linux-android-gcc shell script. I was wrong that it was present in the directory. But I should be able to run the aarch64-linux-android-gcc.cmd, right? – Alexa Kirk Nov 14 '22 at 17:41
  • No idea; I don't use Cygwin. imo there's no reason to use it all since WSL exists. – SomethingDark Nov 14 '22 at 18:55

0 Answers0