Skip to content
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

Long file paths crash compilation on windows #911

Closed
WebFreak001 opened this issue Aug 17, 2016 · 6 comments
Closed

Long file paths crash compilation on windows #911

WebFreak001 opened this issue Aug 17, 2016 · 6 comments

Comments

@WebFreak001
Copy link
Member

When I compile my dub package in a nested folder somewhere in like C:\Users\MyUsername\Development\My_D_Projects\From2016\Old\my-super-awesome-project-with-some-long-filename and I have some dependency in it like experimental_allocator it will crash with this error message:

Error: Error writing file '..\..\..\..\Roaming\dub\packages\experimental_allocator-2.70.0-b1\experimental_allocator\.dub\build\library-release-windows-x86-dmd_2071-09237FFF1A90ED11A7976B16E7AB1A89\experimental_allocator.lib'
dmd failed with exit code 1.

On Windows there is by default a file path length limit of 259 characters and either dub or dmd aren't using the extended windows paths using \\?\ which increases the length limit to 32767 characters. So Windows doesnt allow you to write the file.

Reproducable project in my case:

cd %appdata%
cd ..
cd Local\Temp
mkdir workspaced-install-636070322740907409
cd workspaced-install-636070322740907409
git clone https://github.com/Hackerpilot/DCD.git DCD
cd DCD
dub build --build=release --config=client --force

crash

@WebFreak001
Copy link
Member Author

Another issue which probably has the same cause:

libdparse ~master: building configuration "library"...
Error: failed to create path to file: .dub\obj\libdparse\.dub\build\library-debug-windows-x86_64-ldc_0-DCDD4FDB2EDFDAE1509F1E37E3AAEA55\dparse.lib
no such file or directory
ldc2 failed with exit code 1.

@WebFreak001
Copy link
Member Author

Workaround for Windows 10: in the registry set HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled to 1 and then reboot or restart the command line and editor

@helgaros
Copy link

I think it's useful to use the long path tool program

@s-ludwig
Copy link
Member

Optlink can surely be added to the list, too. I think the DUB fix for this should happen in Phobos. There is no reason to let this ugly piece of WinAPI design leak through to all application code in a cross platform environment.

@s-ludwig
Copy link
Member

Just mentioning that a tiny improvement to this has been merged: #1242

@WebFreak001
Copy link
Member Author

fixed by #2589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants