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.
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.