titzer / virgil

A fast and lightweight native programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make fails in the virgil folder

eliotmoss opened this issue · comments

When I run make in the virgil folder I get this output:

bin/dev/aeneas bootstrap
bin/dev/aeneas: line 7: cd: too many arguments
rm: cannot remove '/home/moss/local/projects/virgil/bin': Is a directory
rm: cannot remove '/home/moss/local/projects/virgil/bin': Is a directory
rm: cannot remove '/home/moss/local/projects/virgil/bin': Is a directory
rm: cannot remove '/home/moss/local/projects/virgil/bin': Is a directory
rm: cannot remove '/home/moss/local/projects/virgil/bin': Is a directory
cp: target '/home/moss/local/projects/virgil/bin/v3c' is not a directory
bin/dev/aeneas: line 359: /home/moss/local/projects/virgil/bin: Is a directory
bin/dev/aeneas: line 145: /home/moss/local/projects/virgil/bin: Is a directory
bin/dev/aeneas: line 160: aeneas bootstrap: no stable compiler binary for any host in ${$HOSTS}: bad substitution
make: *** [Makefile:20: bootstrap] Error 1

This is under Windows Subsystem for Linux with Ubuntu and bash as my shell.
I am able to compile/run example Virgil programs using the supplies binaries.

Thanks for filing the issue. Looks like it's a problem with that script's attempt to find out what directory it's in, probably the bin directory. Are there any symlinks involved? If you add echo $BIN to line 4 of bin/dev/aeneas, what does it print?

It prints two directories. A fix is to change line 3 to read:

BIN=$(cd·$(dirname·${BASH_SOURCE[0]})/..·>·/dev/null·&&·builtin·pwd)

That is, add > /dev/null so that there is no output from cd, only from pwd.

For further bulletproofing, I might write builtin cd instead of cd and builtin pwd instead of pwd. :-)

Actually, just doing builtin cd and builtin pwd might be enough. I have my cd aliased to do more stuff and to echo where it is switching to.

Oh, you do like to live dangerously my friend :-)

I've added builtin to the cd and pwd commands at the top. Let me know if there are further occurrences that trip you up; I've done a fair bit of directory magic in the test scripts and all, and I can't vet it all in the moment.

You could also just blame me for having a weird cd!

Nah, happy to make things work out of the box for more users. A little defensiveness in the shell scripts is a small price to pay for saving the next person a headscratcher.

Closing, as the make issue is addressed. Feel free to file more issues if this crops up in other places.