-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC build fails owing to overly long build directory names #4226
Comments
cc @sarum9in |
We've run into the in mesa as well. |
I thought we were already using response files for these but apparently we only do that for linker invocations. |
I think response files are already being used (I remember being irritated by It looks to me like the args make it fine to |
So the problem is #3246. name_part = self.name.replace('/', '@').replace('\\', '@')
assert not has_path_sep(self.type_suffix())
myid = name_part + self.type_suffix()
if self.subdir:
subdir_part = self.subdir.replace('/', '@').replace('\\', '@')
myid = subdir_part + '@@' + myid It was shorter in the past: base = self.name + self.type_suffix()
if self.subproject == '':
return base
return self.subproject + '@@' + base The problem with previous approach is that it did not allow same ids in different subdirectories. New approach takes this into account, but unfortunately it effectively doubles the name size. I have a possible workaround in mind: let's hash subdir_part of id with some short stable hashing function (e.g. sha). So the code would effectively be name_part = self.name.replace('/', '@').replace('\\', '@')
assert not has_path_sep(self.type_suffix())
myid = name_part + self.type_suffix()
if self.subdir:
subdir_part = self.subdir.replace('/', '@').replace('\\', '@')
myid = SOME_SHA_FUNC(subdir_part) + '@@' + myid This will not look as nice unfortunately but will solve the problem. Thoughts? |
I don't mind the hash - and for me the paths are quite unwieldy anyway, so I don't think there's too much lost from an aesthetic point of view - perhaps an abbreviated/short hash would be enough here? (8 chars) |
On a related note, using a hash could be needed to uniquify target ID per install directory. See #4019 (comment). |
@tp-m I will prepare a patch today/tomorrow and create a PR. Let's give it a try if it works for your builds and see if we get any other feedback regarding more obfuscated IDs. |
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Base32 is safe for both case-insensitive filesystems and Visual Studio IDs. It is also shorter than hex. Closes mesonbuild#4226.
Does setting the registry key mentioned in https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation help? |
That does help, and it is also an option in the Python installer, but it only works on Windows 10 so we need to fix this either way. |
…xes #1556 When using glib as a meson subproject on Windows the build currently fails due to too long paths during the build process. See mesonbuild/meson#4226 for the upstream bug. To work around the issue shorten the filenames of the generated gdbus files.
I've opened https://gitlab.gnome.org/GNOME/glib/merge_requests/370 in glib to work this around temporarily. |
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Base32 is safe for both case-insensitive filesystems and Visual Studio IDs. It is also shorter than hex. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes #4226.
This issue still affects files generated by the Windows module for compiling Windows rc files. The build fails with the error:
It seems that the Windows module wasn't updated when this change was made. Additionally, I started attempting a simple fix but still ran into the path limit issue due to prepending "Windows resource for file " to the beginning of the name, causing a failure with a log file:
Granted, this could be fixed with some directory layout changes to my project, but it would be nice to not have to do that. Note, this only occurs when building with a Visual Studio solution file. Building via ninja is fine. |
Fixed-size hash makes paths shorter and prevents doubling of path length because of subdir usage in target id: "subdir/id" would generate "subdir/{subdir-without-slashes}@@id" target otherwise. Export construct_id_from_path() to aid tests. Add a separate unit test for this function to make sure it is not broken unexpectedly. Closes mesonbuild#4226.
still affected, I think meson need to watch the filename/path length and use hash for the ones exceed limit. |
Still affected as well |
So I'm building
gst-build
on Windows, with glib as a subproject. The build fails with the following error message:[1/1857] Compiling C object subprojects/glib/gio/tests/gdbus-object-manager-example/subprojects@glib@gio@tests@gdbus-object-manager-example@@libgdbus-example-objectmanager@sha/meson-generated_.._gdbus-example-objectmanager-generated.c.obj. FAILED: subprojects/glib/gio/tests/gdbus-object-manager-example/subprojects@glib@gio@tests@gdbus-object-manager-example@@libgdbus-example-objectmanager@sha/meson-generated_.._gdbus-example-objectmanager-generated.c.obj cl @subprojects/glib/gio/tests/gdbus-object-manager-example/subprojects@glib@gio@tests@gdbus-object-manager-example@@libgdbus-example-objectmanager@sha/meson-generated_.._gdbus-example-objectmanager-generated.c.obj.rsp subprojects/glib/gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager-generated.c: fatal error C1041: cannot open program database 'subprojects\\glib\\gio\\tests\\gdbus-object-manager-example\\subprojects@glib@gio@tests@gdbus-object-manager-example@@libgdbus-example-objectmanager@sha\\meson-generated_.._gdbus-example-objectmanager-generated.c.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
Turns out the problem is the overly long build directory paths here, exceeding the default 260 path limit.
The build works fine if I use
c:\build
as build directory instead.I understand why these paths might be needed in the flat layout case, but Meson knows that we don't use a flat layout here, so I think it shouldn't be using these long cluttery paths in this case.
The text was updated successfully, but these errors were encountered: