Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Error writing file #21

Closed
dmi7ry opened this issue Jun 30, 2016 · 6 comments
Closed

Error writing file #21

dmi7ry opened this issue Jun 30, 2016 · 6 comments

Comments

@dmi7ry
Copy link

dmi7ry commented Jun 30, 2016

Same problem when selected option 3 (dfmt)

Dmitry@DMITRY-COMP d:\dlang\workspace-d
$ install.bat

Dmitry@DMITRY-COMP d:\dlang\workspace-d
$ dub run :installer -- .
Building package workspace-d:installer in d:\dlang\workspace-d\installer\
Performing "debug" build using dmd for x86.
workspace-d:installer 2.7.1+commit.15.gfd0cd7e: building configuration "application"...
Linking...
Running .\installer\iworkspaced.exe .
Welcome to the workspace-d installation guide.
Make sure, you have dub and git installed.

LDC is required on your platform!

Which optional dependencies do you want to install?
[1] DCD - auto completion
[2] DScanner - code linting
[3] dfmt - code formatting
Enter a comma separated list of numbers
Selected [all]: 1
Using existing git repository for workspace-d
Compiling...
$ dub upgrade
Upgrading project in d:\dlang\workspace-d
Fetching dub 1.0.0 (getting selected version)...
Placing dub 1.0.0 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching painlessjson 1.3.7 (getting selected version)...
Placing painlessjson 1.3.7 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching painlesstraits 0.2.0 (getting selected version)...
Placing painlesstraits 0.2.0 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching dunit 1.0.12 (getting selected version)...
Placing dunit 1.0.12 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
$ dub build --compiler=ldc2 --combined --build=release
Performing "release" build using ldc2 for x86.
workspace-d 2.7.1+commit.15.gfd0cd7e: building configuration "application"...
C:\Users\Dmitry\AppData\Roaming\dub\packages\dub-1.0.0\dub\source\dub\internal\sdlang\lexer.d(16): Deprecation: module std.stream is deprecated - It will be removed from Phobos in October 2016. If you still need it, go to https://github.com/DigitalMars/undeaD
Using Visual Studio: F:\Programs\Visual Studio\2015\
Copying files for dub...
Successfully compiled workspace-d!
Cloning DCD into C:\Users\Dmitry\AppData\Local\Temp\workspaced-install-636029021464176453
$ git clone -q https://github.com/Hackerpilot/DCD.git DCD
Checking out v0.9.0-alpha4
$ git checkout -q v0.9.0-alpha4
Compiling...
$ dub upgrade
Upgrading project in C:\Users\Dmitry\AppData\Local\Temp\workspaced-install-636029021464176453\DCD
Fetching dsymbol 0.2.0-alpha7 (getting selected version)...
Placing dsymbol 0.2.0-alpha7 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching emsi_containers 0.4.3 (getting selected version)...
Placing emsi_containers 0.4.3 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching experimental_allocator 2.70.0-b1 (getting selected version)...
Placing experimental_allocator 2.70.0-b1 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching msgpack-d 1.0.0-beta.3 (getting selected version)...
Placing msgpack-d 1.0.0-beta.3 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
Fetching libdparse 0.7.0-alpha9 (getting selected version)...
Placing libdparse 0.7.0-alpha9 to C:\Users\Dmitry\AppData\Roaming\dub\packages\...
$ dub build --build=release --config=client
Performing "release" build using dmd for x86.
experimental_allocator 2.70.0-b1: building configuration "library"...
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.
Error while compiling DCD.
Program exited with code 1

Windows 7 x64
DUB version 1.0.0, built on Jun 20 2016
LDC - the LLVM D compiler (1.0.0)
DMD32 D Compiler v2.071.1

@WebFreak001
Copy link
Member

Try deleting the dub dependencies where it fails from C:\Users\Dmitry\AppData\Roaming\dub\packages first. In this case it would be experimental_allocator-2.70.0-b1 and probably some more after that

@dmi7ry
Copy link
Author

dmi7ry commented Jun 30, 2016

Of course I tried

@WebFreak001
Copy link
Member

ok I finally found out why this happens!

It's because dub tries to write the file to a path that is longer than the maximum file path length windows accepts. In my case this was:

C:\Users\WebFreak\AppData\Local\Temp\workspaced-install-636070322740907409\DCD\..\..\..\..\Roaming\dub\packages\experimental_allocator-2.70.0-b1\experimental_allocator\.dub\build\library-release-windows-x86-dmd_2071-09237FFF1A90ED11A7976B16E7AB1A89\experimental_allocator.lib

This path is 276 characters long but IIRC windows paths can be at most 240 characters. However there is some extended file path mode which dub isnt using. So this issue happens because of dub and because the temporary folder is too long.

I could instead write to C:\tmp\workspace-d-123456 but there might be issues there with protection

@WebFreak001
Copy link
Member

So right now the installer for DCD and dfmt is broken because of that package and the long name. Depending on your username it might also be broken for Dscanner. You need to manually install these packages while there is no fix for that

@WebFreak001
Copy link
Member

I will make the install path a bit shorter and that should fix it for some people. Otherwise we need to wait for dub/dmd to use Windows' extended file paths. I made an issue on dub for this already: dlang/dub#911

@WebFreak001
Copy link
Member

gonna close because this is most likely already no longer an issue with modern dub

reopen if you still experience an issue

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

No branches or pull requests

2 participants