Skip to content

cabal doesn't inherit the path from cabal/config in PowerShell #9519

Closed
@jasagredo

Description

@jasagredo

Describe the bug

Cabal config specifies (as configured by GHCup):

extra-include-dirs: C:\msys64\mingw64\include
extra-lib-dirs: C:\msys64\mingw64\lib
extra-prog-path: C:\ghcup\bin,
                 C:\cabal\bin,
                 C:\msys64\mingw64\bin,
                 C:\msys64\usr\bin

And I have this test-suite that depends on external DLLs:

➜ ldd ./dist-newstyle/build/x86_64-windows/ghc-9.6.3/ouroboros-consensus-cardano-0.12.1.0/t/cardano-test/build/cardano-test/cardano-test.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffcf45d0000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffcf34c0000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffcf1ef0000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffcf1da0000)
        SHELL32.dll => /c/WINDOWS/System32/SHELL32.dll (0x7ffcf2770000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7ffcf1d00000)
        libsodium-26.dll => /mingw64/bin/libsodium-26.dll (0x7ffc37c60000)
        libsecp256k1-0.dll => /mingw64/bin/libsecp256k1-0.dll (0x7ffbf91c0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffcf3650000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ffcf3590000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7ffcf3f50000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ffcf2440000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7ffcf1ec0000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7ffcf2ff0000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffcf3740000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7ffcf1b70000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ffcf3d10000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x7ffcc3fa0000)
        ole32.dll => /c/WINDOWS/System32/ole32.dll (0x7ffcf24f0000)
        dbghelp.dll => /c/WINDOWS/SYSTEM32/dbghelp.dll (0x7ffcebaa0000)
        combase.dll => /c/WINDOWS/System32/combase.dll (0x7ffcf3870000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7ffccef00000)
        combase.dll => /c/Windows/System32/combase.dll (0x1462d380000)
        OLEAUT32.dll => /c/WINDOWS/System32/OLEAUT32.dll (0x7ffcf2690000)
        CRYPTBASE.DLL => /c/WINDOWS/SYSTEM32/CRYPTBASE.DLL (0x7ffcf1190000)
        WINMM.dll => /c/WINDOWS/SYSTEM32/WINMM.dll (0x7ffce7f50000)
        IPHLPAPI.DLL => /c/WINDOWS/SYSTEM32/IPHLPAPI.DLL (0x7ffcf0370000)
        dbgcore.DLL => /c/WINDOWS/SYSTEM32/dbgcore.DLL (0x7ffcbd580000)

However, when I try to run it the following just aborts with no error message:

PS C:\Users\Javier\code\cardano\ouroboros-consensus> cabal run cardano-test --verbose -- -p "/ExtLedgerState_Conway/"
Warning: C:\cabal\config: Unrecognized stanza on line 33
Project settings changed, reconfiguring...
Warning: C:\cabal\config: Unrecognized stanza on line 33
creating C:\Users\Javier\code\cardano\ouroboros-consensus\dist-newstyle
creating C:\Users\Javier\code\cardano\ouroboros-consensus\dist-newstyle\cache
this build was affected by the following (project) config files:
- ./asserts.cabal
- C:\Users\Javier\code\cardano\ouroboros-consensus\cabal.project
- C:\Users\Javier\code\cardano\ouroboros-consensus\cabal.project.local
creating C:\Users\Javier\code\cardano\ouroboros-consensus\dist-newstyle\build
creating C:\Users\Javier\code\cardano\ouroboros-consensus\dist-newstyle\tmp
Selecting ouroboros-consensus-cardano-0.12.1.0-inplace-cardano-test to supply
cardano-test
Running: "C:\Users\Javier\code\cardano\ouroboros-consensus\dist-newstyle\build\x86_64-windows\ghc-9.6.3\ouroboros-consensus-cardano-0.12.1.0\t\cardano-test\build\cardano-test\cardano-test" "-p" "/ExtLedgerState_Conway/"

It is using C:\cabal\config because if I introduce garbage there I see:

Warning: C:\cabal\config: Unrecognized stanza on line 33
Project settings changed, reconfiguring...
Warning: C:\cabal\config: Unrecognized stanza on line 33

If I manually extend the PATH, it works:

PS C:\Users\Javier\code\cardano\ouroboros-consensus> $env:Path += ';C:\msys64\mingw64\bin'
PS C:\Users\Javier\code\cardano\ouroboros-consensus> cabal run cardano-test -- -p "/ExtLedgerState_Conway/"
cardano
  Golden tests
    SerialiseDisk
      ExtLedgerState
        ExtLedgerState_Conway: OK

All 1 tests passed (0.01s)

Which suggests the pwsh path is not being extended properly.

Expected behavior

I would expect cabal to extend the PATH also on PowerShell.

System information

  • MINGW64_NT-10.0-22621
  • cabal-install version 3.10.2.0, compiled using version 3.10.2.1 of the Cabal library

Additional context

In MinGW shell it works just fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions