0

About 20 minutes ago, I tried to compile a project of mine, and it compiled and linked fine into an executable. I added three D source files, edited some code, and tried to recompile. It failed. That in and of itself is nothing peculiar. However, the build output was:

dub build "accord" "--build=plain"
Building package accord in F:\Development\accord\
Target derelict-util 2.0.0 is up to date. Use --force to rebuild.
Target derelict-glfw3 1.1.0 is up to date. Use --force to rebuild.
Target derelict-gl3 1.0.13 is up to date. Use --force to rebuild.
Building accord ~master configuration "application", build type plain.
Compiling using dmd...
Linking...
Error: cannot read file C:\Users\Spirit.d
FAIL .dub/build/application-plain-windows-x86-dmd_2067-7C65CD25249AF071E7C1F1FC64628B8A
Error executing command build:
dmd failed with exit code 1.
Exit code 2
Build complete -- 1 error, 0 warnings

I am using Mono-D. Any other project I try seems to compile perfectly. I have no idea why Dub is looking in my users directory for a source file. My JSON file is the standard fare generated by Dub with Derelict-Util (v2.0.0), Derelict-GL3 (v1.0.13), and Derelict-GLFW3 (v1.1.0) as dependencies. I have spent some time trawling the interwebs looking for a solution, but might have missed something. If I did, please just point me in the right direction. Thanks!

[Edit] Verbose compiler output

F:\Development\accord>dub --vverbose -c -gc -w -gs -vcolumns
Error processing arguments: Can't parse string: bool should be
case-insensitive 'true' or 'false'
Run 'dub help' for usage information.

F:\Development\accord>dub --verbose -debug
Using dub registry url 'http://code.dlang.org/'
Refreshing local packages (refresh existing: true)...
Looking for local package map at C:\ProgramData\dub\packages\local-   packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Note: Failed to determine version of package accord at .. Assuming ~master.
Refreshing local packages (refresh existing: false)...
Looking for local package map at C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Found dependency derelict-util 2.0.0
Found dependency derelict-glfw3 1.1.0
Found dependency derelict-gl3 1.0.13
Checking for missing dependencies.
Using fixed selection derelict-util 2.0.0
Using fixed selection derelict-glfw3 1.1.0
Using fixed selection derelict-gl3 1.0.13
Refreshing local packages (refresh existing: false)...
Looking for local package map at C:\ProgramData\dub\packages\local-packages.json
Looking for local package map at C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\local-packages.json
Found dependency derelict-util 2.0.0
Found dependency derelict-glfw3 1.1.0
Found dependency derelict-gl3 1.0.13
Checking for upgrades.
Using cached upgrade results...
Generating using build
Generate target accord (executable F:\Development\accord accord)
Generate target derelict-util (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib DerelictUtil)
Generate target derelict-glfw3 (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib DerelictGLFW3)
Generate target derelict-gl3 (staticLibrary C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib DerelictGL3)
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x86-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib' doesn't exist, need rebuild.
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x8
6-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib -debug -g -w -version=Have_derelict_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\exception.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\loader.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\sharedlib.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\system.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\wintypes.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source\derelict\util\xtypes.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\.dub\build\library-debug-windows-x86-dmd_2067-C7756503D110D460F4F4728E71250CDA\DerelictUtil.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib' doesn't exist, need rebuild.
Building derelict-glfw3 1.1.0 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib -debug -g -w -version=Have_derelict_glfw3 -version=Have_derelict_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packag
es\derelict-glfw3-1.1.0\source\derelict\glfw3\glfw3.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\.dub\build\library-debug-windows-x86-dmd_2067-256C068A151384E40C20A4D884247016\DerelictGLFW3.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib
Target 'C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-windows-x86-dm
d_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib' doesn't exist, need rebuild.
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
dmd -lib -ofC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-windows-x8
6-dmd_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib -debug -g -w -version=Have_derelict_gl3 -version=Have_dereli
ct_util -debug=ebug -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source -IC:\Users\Spirit
of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\der
elict-gl3-1.0.13\source\derelict\opengl3\arb.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\
source\derelict\opengl3\cgl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\o
pengl3\constants.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\depr
ecatedConstants.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\depre
catedFunctions.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\ext.d
C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\functions.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\gl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\gl3.d C:\Users\Spirit of Fire\AppData\Roaming\dub\pa
ckages\derelict-gl3-1.0.13\source\derelict\opengl3\glx.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\glxext.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\internal.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\types.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\wgl.d C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\source\derelict\opengl3\wglext.d
Copying target from C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\.dub\build\library-debug-wi
ndows-x86-dmd_2067-80F0E608548819662CF8E3FD924A262A\DerelictGL3.lib to C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib
Target 'F:\Development\accord\.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.exe' doesn't exist, need rebuild.
Building accord ~master configuration "application", build type debug.
Compiling using dmd...
dmd -c -of.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.obj -debug -g -w -version=Have_accord -version=Have_derelict_util version=Have_derelict_glfw3 -version=Have_derelict_gl3 -debug=ebug -Isource -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\source -IC:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.
13\source source\accord\core\opengl\ContextConfigs.d source\accord\core\opengl\FramebufferConfigs.d source\accord\core\system\Window.d source\accord\util\Closable.d source\accord\util\collections\Stack.d source\accord\util\glutil.d source\accord\util\io\FileData.d source\accord\util\io\FileInputStream.d source\accord\util\io\InputStream.d source\accord\util\stringutil.d source\app.d
Linking...
dmd -of.dub\build\application-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.exe .dub\build\applicat
ion-debug-windows-x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\accord.obj C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-glfw3-1.1.0\lib\DerelictGLFW3.lib C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-gl3-1.0.13\lib\DerelictGL3.lib C:\Users\Spirit of Fire\AppData\Roaming\dub\packages\derelict-util-2.0.0\lib\DerelictUtil.lib -g

Error: cannot read file C:\Users\Spirit.d
FAIL .dub\build\application-debug-windows-
x86-dmd_2067-9CBD45F8F21245983EC54AD7179D55CE\ accord executable
Error executing command run:
dmd failed with exit code 1.

[EDIT]: I've identified the problem. The linker seems to think that I am building a library, and not an app. I don't know what I did to do that, but I don't know how to fix it. So, my question now is this: how to I change it back? Thanks.

[EDIT]: Nevermind. Changing the build type to executable did nothing.

[EDIT]: I tried using dub v0.9.22 (from v0.9.23) and it appears to link fine. I have no idea what's going on.

Straivers
  • 349
  • 1
  • 9
  • This is a strange one, do you have "import Spirit" anywhere in your source? – Colin Grogan Jun 12 '15 at 08:44
  • No. My user account on this computer is "Spirit of Fire". I don't know if that has any bearing on this problem. – Straivers Jun 13 '15 at 08:44
  • 2
    Hmm, I suspect dmd hitting the space char in spirit of fire and thinking that is the full path. – Colin Grogan Jun 13 '15 at 11:40
  • But why look there at all? All of my import are either dub packages or internal. – Straivers Jun 13 '15 at 13:17
  • Like a bothe said, it looks in numerous places for an import, the last of with is your user directory. I recommend deleting (or renaming) your dub packages directory to force it to redownload everything. I think on Windows it's %appdata%\dub\packages – Colin Grogan Jun 13 '15 at 14:37
  • I just did, twice, to no effect. The same error occurs. I considered creating a new project and copying all the source files over one by one, but that doesn't keep the problem from occurring again. – Straivers Jun 13 '15 at 15:03
  • This is almost certainly the space in the filename thing. Run `dub --vverbose your_args` (the vv is intentional - two vs for extra verbose debugging output) and you should see what exactly command it is running. I betcha is it is something like `c:\users\spirit of fire\some_cache\dubs_cache.o` but this will confirm it and we can track down if the bug is in Phobos (shell escaping), dub (not calling the escape function), or dmd (mishandling the argument). – Adam D. Ruppe Jun 14 '15 at 12:46
  • When it needs to build the dependencies, it appears to find it in the right place (`C:Users\Spirit of Fire\AppData\Roaming\dub\packages\...`) but then It tries to link as `...build files... -g` and fails immediately after that line. – Straivers Jun 15 '15 at 05:10
  • Can you post the output of dub --vverbose ? – Colin Grogan Jun 15 '15 at 12:53
  • So it's the linker phase that is failing. I couldn't see anything wrong with the command being passed to the linker, possible bug maybe? – Colin Grogan Jun 16 '15 at 04:16
  • Could it be prudent to mark this question as resolved then? – Straivers Jun 16 '15 at 04:19

1 Answers1

0

I suspect that the source files you added brought some hidden dependencies - go have a look for some imported 'Spirit' module, that should clearify why dmd (not dub(!) - it's dmd which fails to look for said import) can't find the file.

The C:\Users path seems to be a last resort where dmd looks for imported files.

[Edit] It's failing to link the entire thing whereas it should fail to compile all the stuff - that could be a hint either.

A Bothe
  • 83
  • 2
  • 5
  • The only imports I'm using right now are: `std.file`, `std.stdio`, `std.range.interfaces`, `derelict.opengl3.constants`, `derelict.glfw3.glfw3`, and a number of internal imports. Its a fairly new project. – Straivers Jun 13 '15 at 08:58