Skip to content

Dub Integration doesn't work #6957

@Clouud9

Description

@Clouud9

Xmake Version

v3.0.3+master.8bcc3569c

Operating System Version and Architecture

Windows 11 24H2

Describe Bug

XMake doesn't seem to respect the dub.json configuration of a package that's been installed (dmd). Additionally it's unable to fetch packages properly too.

Expected Behavior

XMake should be looking at files inside DMD's compiler directory, instead of inside src. For fetching packages, xmake should just properly execute the dub fetch command.

Project Configuration

The DMD issue prevents the fetching issue from cropping up, so "dmd" would have to be removed from add_packages to

add_rules("mode.debug", "mode.release")
add_requires("dub::dmd", {alias = "dmd"})
add_requires("dub::emsi_containers", {alias = "emsi_containers"})

target("debuggd-plugin")
    set_default(true)
    set_kind("shared")
    add_files("src/*.d|src/main.d")

-- Add these as subdirs? 
target("debuggd-d")
    set_default(false)
    set_kind("static")
    
target("debuggd-cpp")
    set_default(false)
    set_kind("static")

target("debuggd")
    set_kind("binary")
    add_files("src/*.d")
    add_deps("debuggd-d", "debuggd-cpp")
    add_packages("dmd", "emsi_containers")

Additional Information and Error Logs

For the DMD Issue:

PS C:\Users\user\Base\Projects\D\debuggd> xmake build
checking for Microsoft Visual Studio (x64) version ... 2022
[ 67%]: compiling.release src\main.d
[ 67%]: compiling.release src\main.d
error: src\main.d(2): Error: unable to read module `frontend`
import dmd.frontend;
       ^
src\main.d(2):        Expected 'dmd\frontend.d' or 'dmd\frontend\package.d' in one of the following import paths:
import path[0] = C:\Users\user\AppData\Local\dub\packages\dmd\2.111.0\dmd\src
import path[1] = C:\Users\user\AppData\Local\dub\packages\emsi_containers\0.9.0\emsi_containers\src
import path[2] = C:\Users\user\Base\Programs\D\dmd2\windows\bin64\..\..\src\phobos
import path[3] = C:\Users\user\Base\Programs\D\dmd2\windows\bin64\..\..\src\druntime\import
  > in src\main.d

For fetching emsi_containers:

PS C:\Users\user\Base\Projects\D\debuggd> xmake
[ 33%]: compiling.release src\main.d
[ 54%]: compiling.release src\main.d
error: src\main.d(2): Error: unable to read module `slist`
import containers.slist;
       ^
src\main.d(2):        Expected 'containers\slist.d' or 'containers\slist\package.d' in one of the following import paths:
import path[0] = C:\Users\user\Base\Programs\D\dmd2\windows\bin64\..\..\src\phobos
import path[1] = C:\Users\user\Base\Programs\D\dmd2\windows\bin64\..\..\src\druntime\import
  > in src\main.d

I have heard that even when xmake recognizes that it needs to install a dub package, it just errors out without an explanation. This has been brought up in other issues but they've all been closed without being resolved. For this specific example I believe that what's happening instead is that emsi_containers is just not recognized as missing. When I fetched it myself with dub it was still unable to properly import the files, as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions