Thread overview
Infuriating DUB/DMD build bug.
October 05
I've got a github project and using DUB with DMD and I keep running into this problem. I've tried deleting the entire ...\AppData\Roaming\dub\packages folder, but the
problem repeats the very next build attempt.

Fetching derelict-util 2.0.6 (getting selected version)...
Fetching derelict-ft 1.1.3 (getting selected version)...
Fetching derelict-gl3 1.0.23 (getting selected version)...
Fetching derelict-assimp3 1.3.0 (getting selected version)...
Fetching gl3n 1.3.1 (getting selected version)...
Fetching derelict-al 1.0.3 (getting selected version)...
Fetching derelict-fmod 2.0.4 (getting selected version)...
Fetching derelict-fi 2.0.3 (getting selected version)...
Fetching derelict-glfw3 3.1.3 (getting selected version)...
Performing "$DFLAGS" build using dmd for x86_64.
derelict-util 2.0.6: building configuration "library"...
derelict-al 1.0.3: building configuration "library"...
derelict-assimp3 1.3.0: building configuration "library"...
derelict-fi 2.0.3: building configuration "library"...
derelict-fmod 2.0.4: building configuration "library"...
derelict-ft 1.1.3: building configuration "library"...
derelict-gl3 1.0.23: building configuration "library"...
derelict-glfw3 3.1.3: building configuration "derelict-glfw3-dynamic"...
Error: Error writing file '..\..\..\..\AppData\Roaming\dub\packages\derelict-glfw3-3.1.3\derelict-glfw3\.dub\build\derelict-glfw3-dynamic-$DFLAGS-windows-x86_64-dmd_2076-A09416BA47731198A57C73719DAAFE33\DerelictGLFW3.lib'
dmd failed with exit code 1.

I've cloned DMD and when I searched for "Error writing file" all it pulls up is:

/**
 * Writes a file, terminate the program on error
 *
 * Params:
 *   loc = The line number information from where the call originates
 *   f = a `ddmd.root.file.File` handle to write
 */
extern (C++) void writeFile(Loc loc, File* f)
{
    if (f.write())
    {
        error(loc, "Error writing file '%s'", f.name.toChars());
        fatal();
    }
}

But shouldn't there be a line number before "Error writing file"?

With writing files, that's usually a permissions thing?  But all the other 8 packages build fine?

Note: I had a similar problem with derelict-assimp3 package, so I went to an entirely different system and cloned my project.  But now it fails with the same error, but with
a different package.






October 06
On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:

> With writing files, that's usually a permissions thing?  But all the other 8 packages build fine?
>
> Note: I had a similar problem with derelict-assimp3 package, so I went to an entirely different system and cloned my project.  But now it fails with the same error, but with
> a different package.

Looks like it may be a system error as a result of the path being too long. I've encountered that a couple times over the years when building projects with dub. What I suggest you try is to remove the offending package(s) from AppData/Roaming/dub/packages, create a new directory off C: (say, C:\dub, manually fetch the packages you need into that directory and use `dub add-local` on them (see an example in the derelict docs [1]), then try to build your project again and see what happens.
October 06
On Friday, 6 October 2017 at 09:12:09 UTC, Mike Parker wrote:
> On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:

> AppData/Roaming/dub/packages, create a new directory off C: (say, C:\dub, manually fetch the packages you need into that directory and use `dub add-local` on them (see an example in the derelict docs [1]), then try to build your project again and see what happens.

[1] http://derelictorg.github.io/building/without-dub/#fetching-packages-with-dub
October 06
On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:
>
> I've got a github project and using DUB with DMD and I keep running into this problem. I've tried deleting the entire ...\AppData\Roaming\dub\packages folder, but the
> problem repeats the very next build attempt.
>
> [...]

See my post in learn on dmd path.  The dmd path code was written in 1987 and could do with an update to process longer windows paths properly.  We are working on this and I guess a chance a pull request on Monday but it depends on what else comes up.  In any case it's a trivial fix.

Presuming I am right about it being a path length problem.

October 07
On Friday, 6 October 2017 at 23:02:56 UTC, Laeeth Isharc wrote:
> On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:
>>
>> I've got a github project and using DUB with DMD and I keep running into this problem. I've tried deleting the entire ...\AppData\Roaming\dub\packages folder, but the
>> problem repeats the very next build attempt.
>>
>> [...]
>
> See my post in learn on dmd path.  The dmd path code was written in 1987 and could do with an update to process longer windows paths properly.  We are working on this and I guess a chance a pull request on Monday but it depends on what else comes up.  In any case it's a trivial fix.
>
> Presuming I am right about it being a path length problem.

I did! But i didn't say anything because i wasn't sure if they were related. I'm pretty sure it is path related because the exact same dub.sdl files work fine on Linux and MacOS. (It's a cross platform project)

Glad it is a trivial fix. Curious what it involves.  Let me know if I can help out in any way.  Mike Parker was kind enough to show me a manual dub local workaround for this issue. But I'll hold off now and see if your change does the fix.

If it does, it will be the best timed bug fix ever :)
October 13
On Saturday, 7 October 2017 at 19:34:53 UTC, WhatMeForget wrote:
> On Friday, 6 October 2017 at 23:02:56 UTC, Laeeth Isharc wrote:
>> On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote:
>>>
>>> I've got a github project and using DUB with DMD and I keep running into this problem. I've tried deleting the entire ...\AppData\Roaming\dub\packages folder, but the
>>> problem repeats the very next build attempt.
>>>
>>> [...]
>>
>> See my post in learn on dmd path.  The dmd path code was written in 1987 and could do with an update to process longer windows paths properly.  We are working on this and I guess a chance a pull request on Monday but it depends on what else comes up.  In any case it's a trivial fix.
>>
>> Presuming I am right about it being a path length problem.
>
> I did! But i didn't say anything because i wasn't sure if they were related. I'm pretty sure it is path related because the exact same dub.sdl files work fine on Linux and MacOS. (It's a cross platform project)
>
> Glad it is a trivial fix. Curious what it involves.  Let me know if I can help out in any way.  Mike Parker was kind enough to show me a manual dub local workaround for this issue. But I'll hold off now and see if your change does the fix.
>
> If it does, it will be the best timed bug fix ever :)

Turned out to be more fiddly than I hoped because of unicode.  Atila did the work, but it's awaiting a pre-review to be sure it's okay before submitting.  In case it's helpful in the meantime, it seems to work (but use at your own risk):
https://github.com/kaleidicassociates/dmd/pull/1