cross-rs / cross-toolchains

Additional Dockerfiles and crosstool-ng config files to build additional toolchains.
Apache License 2.0
88 stars 16 forks source link

'bash\r': No such file or directory #35

Closed strowk closed 1 year ago

strowk commented 1 year ago

Error 'bash\r': No such file or directory happens when, f.e. trying to cross build from windows to mac os due to CRLF end lines in some files (f.e. darwin.sh, but I noticed a lot of others with the same).

To check the file you can do (on windows f.e. in git bash):

git clone https://github.com/cross-rs/cross-toolchains
cat -e cross-toolchains/docker/darwin.sh

if you see ^M$ at end lines, f.e. like this:

#!/usr/bin/env bash^M$
^M$
set -x^M$

That file would be broken when running it from docker (which is what cross is doing).

I did not have the same issue on linux machine (probably some tooling - likely git - replaces CRLF to LF automatically; while it does not happen on windows machines).

strowk commented 1 year ago

Actually it seems like git actually replaced LF with CLRF when I was cloning the repo..

At least configuring git config --global core.autocrlf false seems to fix it. Maybe worth adding this to docs..