premake-core
premake-core copied to clipboard
Premake5 trying to include /usr/bin/bitmap instead of folder with premake5 script
What seems to be the problem?
Premake5 5.0-beta1
tries to include /usr/bin/bitmap
instead of folder with premake5 script.
This is because premake5 is located in /usr/bin
.
Here is result:
$ premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Error: /usr/bin/bitmap:1: unexpected symbol near '<\127>'
What did you expect to happen?
Expected successful building of configuration.
What have you tried so far?
Renamed bitmap
binary, so premake5 can't find it:
$ sudo mv /usr/bin/bitmap /usr/bin/bitmap.old
$ premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Building configurations...
Running action 'gmake'...
Generated projects/linux/gmake/Makefile...
Generated projects/linux/gmake/gmsv_network.make...
Done (684ms).
Tried use locally located premake5
$ ./premake5 gmake --gmcommon="$HOME/garrysmod_common"
Selected version 3 of the project generator
Building configurations...
Running action 'gmake'...
Generated projects/linux/gmake/Makefile...
Generated projects/linux/gmake/gmsv_network.make...
Done (650ms).
How can we reproduce this?
Place premake5 at /usr/bin
$ cp ./premake5 /usr/bin/
Creating project with bitmap folder
-- premake5.lua
print('Including bitmap')
include('bitmap')
-- bitmap/premake5.lua
print('Hello from bitmap!')
Place premake5 to /usr/bin
and build configuration
$ premake5 gmake
Including bitmap
Error: /usr/bin/bitmap:1: unexpected symbol near '<\127>'
What version of Premake are you using?
Premake 5.0-beta1 from releases
Anything else we should know?
Premake5 was running on debian 10
Interesting fact. The problem is not with the premake5 version, but with the location of the binary. If premake5 is in /usr/bin, it will search /usr/bin first.
Upd: updated issue text (past was invalid)
So it sounds like what you're expecting the behavior to be is for it to search the directory that premake was invoked from first for includes, rather than the directory that the premake executable is located in?
Exactly! Sorry for confusing description of problem. If something is missing, tell me.
Thanks for the answer!
No worries, just trying to make sure I've got a full understanding of the problem. So if I'm correct, the folder structure is like:
/usr
bin
premake5
bitmap
/proj
premake5.lua
bitmap
premake5.lua
As a work around, could you try forcing it to include('bitmap/premake5.lua')
and seeing if that is a temporary workaround. Per the locating scripts documentation, this is definitely incorrect behavior and should be addressed.
Made the project as you mentioned above. Here's what I got:
When I used include('bitmap')
$ premake5
Error: /usr/bin/bitmap:1: unexpected symbol near '<\127>'
When I used include('bitmap/premake5.lua')
$ premake5
Hello from Bitmap!
Type 'premake5 --help' for help
Awesome. So at least we know that including explicit paths still works, just looks like our implicit path ordering is different than our documentation/spec says.