Search code examples
bashgcccygwinmingw-w64

error trying to exec 'as': execvp: No such file or directory


When trying to build I get this error:

$ make CC=i686-w64-mingw32-gcc
  CC    aes.c
i686-w64-mingw32-gcc: error trying to exec 'as': execvp: No such file or directory

Solution

  • Set PATH to /usr/bin instead of /bin

    There is a known caveat where calling the compiler directly as /bin/x86_64-w64-mingw32-gcc will fail, use /usr/bin/x86_64-w64-mingw32-gcc instead and make sure that your PATH variable has /usr/bin before /bin.

    mingw-w64.sourceforge.net

    This is caused by a mounting problem. On linux you have /bin and /usr/bin, no big deal. On Cygwin you have C:\cygwin\bin. Then mount points are set like this.

    C:\cygwin\bin on /usr/bin
    C:\cygwin on /
    

    So technically you could represent C:\cygwin\bin with /bin or /usr/bin, although as stated above the former will not work.