Generated Makefiles break on linux when there are space(s) in the directory path
Before opening a new bug report, please read Reporting Bugs and consider if this is something you can contribute yourself. If this a new bug, help us help you by filling in the template below.
What seems to be the problem? When a person uses a path name to a project on linux that contains a space, the build process fails. We noticed the generated Makefiles do not account for the spaces in the paths and the build process will throw an error. Below is a santised generated Makefile command.
Linking foo.plugin^M g++ -o "../../../linux-x86_64/foo.plugin.so" -L"/home/user/project name/release" -L/usr/lib64 -Wl,-rpath=/home/user/project name/release/python/lib -lpython3.11 g++: error: name/release/python/lib: No such file or directory make[1]: *** [Makefile:102: ../../../linux-x86_64/foo.plugin.so] Error 1
What did you expect to happen? I would have expected the generated Makefiles would account for the spaces in the directory paths. I notice the -L LIBDIRS are quoted, but not the rpath.
What have you tried so far? We are not using spaces in the directory names on linux, but we can't manage all developers local development environment.
How can we reproduce this? I would suggest trying any project on linux, checking out the git project where the root directory has a space, like "project name".
- [ ] Visual Studio 2022 (vs2022)
- [ ] Visual Studio 2019 (vs2019)
- [ ] Visual Studio 2017 (vs2017)
- [ ] Visual Studio 2015 (vs2015)
- [ ] Visual Studio 2012 (vs2012)
- [ ] Visual Studio 2010 (vs2010)
- [ ] Visual Studio 2008 (vs2008)
- [ ] Visual Studio 2005 (vs2005)
- [X] GNU Makefile (gmake)
- [ ] GNU Makefile Legacy (gmakelegacy)
- [ ] XCode (xcode)
- [ ] Codelite
- [ ] Other (Please list below)
What version of Premake are you using? 5.0.0-beta2
Is this gmake or gmake2?
Apologies, I should have mentioned that. This is gmake2.
@nickclark2016 looks like we just need to update the getrunpathdirs functions in the toolsets to use p.quoted like the getLibraryDirectories functions?
Appears to be the correct course of action
Getting around to taking a look at this. I will try to have a fix out within the next day or two
Would it be possible for you to update to beta5 and verify a later version of Premake does not resolve your problem?
And would it be possible to get a little more context in terms of your Premake file and the generated Makefile.
Looking even further into this, I would highly suggest naming patterns including spaces. This is a known issue within GNU Make itself (see https://savannah.gnu.org/bugs/?712).
Apologies, I cannot share the generated makefile and premake due to intellectual property (IP) restrictions. A simple test is placing a space in the project's root name and generating the makefile. As you can see some of the paths are encased in quotes to address the space, except for the rpath. This is why I figured there might be a solution to address the rpath, but if this is due to inheriting the known GNU Make issue, then I understand it cannot be addressed at this time.
I'll definitely keep investigating a workaround. Were you able to verify against the latest release?
Not at this time. I won't be able to get to it for a couple of weeks. I will let you know when I do. I appreciate this work towards solving this issue.