-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cabal can not find pkg-config even though the right directory has been added to the extra-prog-path #9800
Comments
which version is this on? 3.10? head? |
3.10 |
@jasagredo it may been fixed in 3.12, as #9519 was fixed. Did you try with |
Yeah, I did some work on the extra-prog-path (breaking other stuff in the way 😁). I'm pretty sure it has been fixed for 3.12? I think there is no support for previous releases. Do you think we can close the issue? |
Seems it was released in 3.10.3.0: https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.10.3.0.md |
I don't care. I solved my original problem by not relying on |
I am pretty happy with pkg-config on Windows. I haven't had any problems so far. Anyways, I'm then closing the issue as it seems the original problem was fixed already. |
If you know how to get e.g. windows libpq (Postgres) to have a Using e.g. pacman to install postgresql lib is an option, but I don't think that's what most people would do. |
I do use pacman always to install my stuff.
|
@jasagredo as said, that's not an option. The GHA (and I assume many people) don't do that. They would use https://www.postgresql.org/download/windows/ |
Not sure I agree. GHA has msys2, can't you install the pacman library there? |
This is drifting off-topic. |
I think this is the most relevant issue for my current problem, and I'm not sure if this is a bug in Cabal. I'm running the recommended Cabal version (3.12.1.0) installed through GHCup. I have an issue where Cabal can't find pkg-config, even though
I've installed ❯ cabal exec -- pacman -S mingw64/mingw-w64-x86_64-pkg-config
❯ cabal exec -- pacman -S mingw64/mingw-w64-x86_64-opus
However, if I include
Does anybody know how I might resolve this, and what's going wrong internally with Cabal? I was under the impression that If this issue looks like a Cabal bug, could the issue be reopened? |
I don't have an immediate answer. Let's investigate. The first thing to check is what is there in your global cabal config which seems it would be in G:\Programs\cabal\config. Then I would make sure what MSYS2 environment you are running this shell in, what does Next I'd try to see if you can get a version for the library calling If all looks right, I would check the v3 output of cabal. |
I was able to reproduce the behavior you are experiencing:
This was in PowerShell. The issue is that the package db is populated before custom paths are added to the PATH. |
Wow, thanks! I was going to reply to your first reply tomorrow (I'm preoccupied this weekend), and I will, but it's reassuring that you've also encountered the same issue this quickly. My shell for reference is straight up normal CMD, not a mingw-bash or powershell shell. So the only way I interface with the MSYS2 environment is through |
To be precise, it is GHCup the one that installed your MSYS2, and the recommended way to interface with it is I think the issue is legitimate and re-reading this thread I think @phadej's request at the top was also legitimate, it was just that I didn't understand it at that time. Cabal configures some of the programs without taking into account the extra-prog-paths in the config. I also learned that pkg-config doesn't seem to be added right away to the program DB and instead we ask for it several times:
|
Thank you for the detailed inspection! My repro from the Windows cmd shell looks exactly like yours, pretty much. I also appreciate your explanation of GHCup setting up MSYS2 (and extra-prog-path), I was slightly confused myself where I got it installed from. Just to summarise my understanding (please correct me if I'm wrong, I'm thinking by typing):
So theoretically the solution seems to be to try the PATH addition at the very beginning of cabal's pipeline. I don't think doing so will have negative consequences on other OSes if we do this anyway later? Unfortunately, I'm not entirely versed in the cabal codebase so I can't tell if this is difficult architecturally or not. Perhaps it being difficult to do is why cabal checks for pkg-config multiple times like you said (i.e., it may have been designed to modify PATH in between those calls, deliberately checking for pkg-config before and after for some reason). |
Your understanding is right. This should not be very difficult. It is a matter of passing down the data read from |
In particular we should call
when running this action
with the paths that should come from the configProgramPathExtra in savedConfigureFlags in SavedConfig returned by loadConfig
|
I follow! I'm slightly confused though:
But within |
@yutotakano You should be able to use cabal from #10790 (either compile it locally or download it from CI once it is built, it will appear at the bottom of this page, but I'd rather build it myself with
It was adding the local paths, but not the ones in the global config. My PR adds those too |
@jasagredo Thank you! I compiled it locally and verified that it is able to find pkg-config and thus opus as well! My cabal build succeeds :) I was prepared to dive in myself but I was a bit worried, so I just want to say a big thank you for implementing the PR! |
This happens on windows, where
pkg-config
is in mingw path, but not in globalPATH
. And there are good reasons to not add mingw-path to global $PATH (hint: it will break everything else on the windows system).I experienced this myself trying to use pkgconfig on Windows. And apparently others as well https://discourse.haskell.org/t/installing-a-library-with-c-dependencies-on-windows/8557/4
The text was updated successfully, but these errors were encountered: