dub icon indicating copy to clipboard operation
dub copied to clipboard

Building dub and dmd via dub itself fails

Open Clouud9 opened this issue 7 months ago • 2 comments

When I add dmd to a dub project that includes dub as a library, there's a build failure that I don't quite understand:

     Warning Selected package [email protected] does not match the dependency specification ~>2.110.0 in package deals. Need to "dub upgrade"?
     Warning Invalid source/import path: C:\Users\<user>\AppData\Local\dub\packages\dmd\2.111.0\dmd\generated\dub
     Pre-gen Running commands for dmd:lexer
Error C:\Users\<user>\AppData\Local\dub\packages\dub\1.40.0\dubconfig.d: The system cannot find the file specified.
Error Command failed with exit code 2: "C:\Users\<user>\Base\Programs\D\dmd2\windows\bin64\dub.exe" "--compiler=C:\Users\<user>\Base\Programs\D\dmd2\windows\bin64\dmd.exe" --single "C:\Users\<user>\AppData\Local\dub\packages\dub\1.40.0\dubconfig.d" -- "C:\Users\<user>\AppData\Local\dub\packages\dub\1.40.0\dubgenerated/dub" "C:\Users\<user>\AppData\Local\dub\packages\dub\1.40.0\dubVERSION" /etc

Here is my dub.json (with personal bits removed):

{
	"authors": [
		"<user>"
	],
	"configurations": [
		{
			"name": "debug",
			"targetType": "executable"
		}
	],
	"copyright": "Copyright © 2025, <name>",
	"dependencies": {
		"dmd": "~>2.111.0",
		"dub": "~>1.40.0"
	},
	"description": "A Language Server based on the DMD Frontend",
	"license": "BSL-1.0",
	"name": "<name>",
	"sourcePaths": [
		"test",
		"source"
	],
	"targetType": "executable"
}

Clouud9 avatar Jul 05 '25 01:07 Clouud9

Side note: For ~> dependencies, you want to use the minor version, not the patch one. Here ~>2.111 will remove the warning, and is the "right" default. Never got around to fix this for init, but it'll clean the warning.

As for you problem, what calls dub ? The last line reads:

Error Command failed with exit code 2: "C:\Users<user>\Base\Programs\D\dmd2\windows\bin64\dub.exe" "--compiler=C:\Users<user>\Base\Programs\D\dmd2\windows\bin64\dmd.exe" --single "C:\Users<user>\AppData\Local\dub\packages\dub\1.40.0\dubconfig.d" -- "C:\Users<user>\AppData\Local\dub\packages\dub\1.40.0\dubgenerated/dub" "C:\Users<user>\AppData\Local\dub\packages\dub\1.40.0\dubVERSION" /etc

Which means, dub is being called with that missing dubconfig.d as argument, so I would look one level up the stack.

Geod24 avatar Jul 25 '25 09:07 Geod24

Side note: For ~> dependencies, you want to use the minor version, not the patch one. Here ~>2.111 will remove the warning, and is the "right" default. Never got around to fix this for init, but it'll clean the warning.

As for you problem, what calls dub ? The last line reads:

Error Command failed with exit code 2: "C:\Users\Base\Programs\D\dmd2\windows\bin64\dub.exe" "--compiler=C:\Users\Base\Programs\D\dmd2\windows\bin64\dmd.exe" --single "C:\Users\AppData\Local\dub\packages\dub\1.40.0\dubconfig.d" -- "C:\Users\AppData\Local\dub\packages\dub\1.40.0\dubgenerated/dub" "C:\Users\AppData\Local\dub\packages\dub\1.40.0\dubVERSION" /etc

Which means, dub is being called with that missing dubconfig.d as argument, so I would look one level up the stack.

Dub is just being called from the command line, that's it.

Clouud9 avatar Aug 07 '25 14:08 Clouud9