dub icon indicating copy to clipboard operation
dub copied to clipboard

Error when using an executable subConfiguration

Open Abscissa opened this issue 10 years ago • 3 comments

{
    "name": "foobar",
    "dependencies": {
        "ddox": "~>0.10.8"
    },
    "subConfigurations": {
        "ddox": "application"
    }
}
$ dub build
Error executing command build:
Could not resolve configuration for package foobar

Abscissa avatar Jun 18 '15 20:06 Abscissa

I think I've just hit this same issue:

$ dub test
Could not resolve configuration for package consoled

The consoled package is here: https://github.com/robik/ConsoleD

SingingBush avatar Aug 22 '16 12:08 SingingBush

I think I might also have hit this issue. The strange thing is, the problem only appears on Windows. On Linux / OS X everything works fine. This is the resulting error meassage when running dub build:

Could not resolve configuration for package vibe-d

Here is my dub.json:

{
	"name": "fsical-management",
	"authors": [
		"Johannes Loher",
		"Oliver Rümpelein"
	],
	"dependencies": {
		"dauth": "~>0.6.3",
		"mysql-native": "~>1.1.4",
		"vibe-d": "~>0.8.2",
		"vibe-d:tls": "~>0.8.2",
		"poodinis": "~>8.0.1"
	},
    "subConfigurations": {
        "vibe-d:tls": "openssl-1.1"
    },
	"description": "A tool to manage the calendar of the Fachschaft Mathe/Physik Uni Regensburg ",
	"copyright": "Copyright © 2018, Johannes Loher",
	"license": "MIT",
	"targetType": "executable",
	"targetPath": "generated",
	"configurations": [
		{
			"name": "executable"
		},
		{
			"name": "unittest",
			"targetType": "executable",
			"preBuildCommands": ["dub run unit-threaded -c gen_ut_main -- -f generated/ut.d test"],
			"mainSourceFile": "generated/ut.d",
			"excludedSourceFiles": ["source/fsicalmanagement/app.d"],
			"sourcePaths": ["test"],
			"dependencies": {
				"unit-threaded": "~>0.7.38"
			},
			"versions": ["unitUnthreaded"]
		}
	]
}

ghost91- avatar Apr 10 '18 17:04 ghost91-

Self contained example:

.\dub.json:

{
    "name": "mypkg",
    "targetType": "none",
    "subPackages": [
        "sub"
    ],
    "dependencies": {
        "mypkg:sub": "*"
    },
    "subConfigurations": {
        "mypkg:sub": "special"
    }
}

.\sub\dub.json:

{
    "name": "sub",
    "targetType": "executable",
    "configurations": [
        {
            "name": "default"
        },
        {
            "name": "special",
            "versions": [
                "special"
            ]
        }
    ]
}

.\sub\source\app.d:

import std.stdio;

void main()
{
    version (special)
    {
        writeln("Special version");
    }
    else
    {
        writeln("Standard version");
    }
}

Result:

> dub build
Error Could not resolve configuration for package mypkg

Expected:

> dub build
    Starting Performing "debug" build using dmd.exe for x86_64.
    Building mypkg:sub ~main: building configuration [special]
     Linking mypkg_sub

This is not limited to Windows, it happens on Linux as well. Note that when the targetType of sub is changed from executable to library, dub builds the special configuration as expected.

veelo avatar May 15 '25 15:05 veelo