cnabio / duffle

CNAB installer
https://duffle.sh
MIT License
375 stars 54 forks source link

Windows build fails with `/bin/sh: Command not found` #837

Closed itowlson closed 5 years ago

itowlson commented 5 years ago

Cloning current master and running make build (or make build-windows) on Windows gives the following:

docker run -it --rm -e SKIP_DOCKER=true -v /cygdrive/c/Users/itowlson/go/src/github.com/deislabs/duffle/:/go/src/github.com/deislabs/duffle -w /go/src/github.com/deislabs/duffle quay.io/deis/lightweight-docker-go:v0.7.0 bash -c "GOOS=windows LDFLAGS=\"-w -s -X github.com/deislabs/duffle/pkg/version.Version=0.3.0 \" scripts/build.sh"
make: /bin/sh: Command not found

The culprit seems to be the call to scripts/build.sh. Not sure if this is meant to be running in the build container but at the moment it isn't!

jeremyrickard commented 5 years ago

I haven't been able to replicate this, but I am seeing an error with what looks like windows line ending problems after cloning on Windows...

C:\Users\jerem\projects\duffle-windows\duffle>make
docker run -it --rm -e SKIP_DOCKER=true -v C:/Users/jerem/projects/duffle-windows/duffle/:/go/src/github.com/deislabs/duffle -w /go/src/github.com/deislabs/duffle quay.io/deis/lightweight-docker-go:v0.7.0 bash -c "LDFLAGS=\"-w -s -X github.com/deislabs/duffle/pkg/version.Version=8b05b9f\" scripts/build.sh"
/usr/bin/env: 'bash\r': No such file or directory
make: *** [build-all-bins] Error 127

This is fixed locally on my windows machine by running dos2unix and changing that. So the right thing to do is probably add a .gitattributes file that forces that.

itowlson commented 5 years ago

Confirming I can no longer replicate the original 'command not found' error, and the LF fix was sufficient for me to build on Windows.