-
-
Notifications
You must be signed in to change notification settings - Fork 784
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
platform为windows的情况下默认禁用mingw的库文件 #5595
Comments
Title: Mingw library files are disabled by default when the platform is windows In what scenario do you need this feature?Related links I encountered this problem before, but it was actually not solved. I just removed mingw/bin in PATH. Improvement summary: After the platform is specified as windows, even if there is pkg-config in the PATH, the mingw library will be disabled by default. Describe possible solutionsxq114 mentioned #5527 (comment) Describe your alternativesNo response Other informationNo response |
话说为啥 xmake 会去找 pkg-config,不应该和 cmake/meson 一样么。 |
2023年的issue了,现在我也没测过,当时看输出是这样的
虽然提示是检查pkg-config,但是找到的包是显示pkgconfig::zlib。这里命名没有统一? |
It’s an issue in 2023. I haven’t tested it now. At that time, the output looked like this. |
pkg-config能找到的pkgconf也会找到,这不是关键问题,关键是找到之后判定后缀是.a还是.lib |
pkgconf that can be found by pkg-config will also be found. This is not the key issue. The key is to determine whether the suffix is .a or .lib after finding it. |
msys2的pkg-config好像内置了PKG_CONFIG_PATH,不过msys2也能装pkgconf,不用msys2也能装pkg-config,这两的区别不是决定性的 |
msys2's pkg-config seems to have built-in PKG_CONFIG_PATH, but msys2 can also install pkgconf, and pkg-config can be installed without msys2. The difference between the two is not decisive. |
目前找到后,返回的都是 links ,并不是完整的 filename,而且他设置了 -p windows ,用的 msvc ,那么即使 pkg-config 返回了 xmake/xmake/modules/core/tools/link.lua Line 106 in 9bb96d5
而之前 #4479 里面反应的 msys/mingw库混用问题,不是库文件混用,是 pkg-config 返回的 includedirs 导致的混用冲突,这里面还是有区别的。所以 lib 库是没用混用问题的,仅仅需要处理 includedir 冲突问题 下面是 #4479 之前的错误描述:
|
After currently finding it, all the links returned are not the complete filename, and he set -p windows and used msvc, so even if pkg-config returns xmake/xmake/modules/core/tools/link.lua Line 106 in 9bb96d5
The msys/mingw library mixing problem reflected in #4479 before is not a mixing of library files, but a mixing conflict caused by includedirs returned by pkg-config. There is still a difference. Here is the error description before #4479:
|
目前一种方式,就是对 windows 平台,完全禁用 pkgconfig 自动找库 ..
|
The current way is to completely disable pkgconfig's automatic library search for the windows platform..
|
这也不合适吧,pkgconfig还是有用的,检测到.a就排除也可以避免头文件混用,而且现在本来就要提取libfiles,其中顺便做个检测不好吗 |
不过考虑到有headeronly的library,完全禁用也可以 |
This is not appropriate, pkgconfig is still useful. If .a is detected, excluding it can avoid the mixing of header files. Moreover, we have to extract libfiles now. Isn’t it good to do a detection by the way? |
However, considering that there is a headeronly library, it can be completely disabled. |
没懂,怎么个检测 .a 排除法 |
I don’t understand, how to test .a elimination method |
https://github.com/xmake-io/xmake/blob/dev/xmake/modules/package/manager/pkgconfig/find_package.lua#L88-L89 Add a judgment here? |
windows plat 检测到 .a 就返回 nil? 那 headeronly 怎么处理呢 |
我暂时不清楚 #4479 里面的运行环境,但是根据目前的信息看,他多半应该是在加载了 msys2/mingw 的环境下,强行走 本身 windows 下用 pkg-config 并没啥问题,它支持 windows ,那就应该能用。 如果是上述我猜想的环境,那么 应该还存在 PKG_CONFIG_PATH 变量,设置到了 msys2 的路径,类似这种 $ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig 这会导致 pkg-config 默认从 msys2 中找库。 如果这个运行环境猜测的没问题,那么应该可以通过下面的方式来解决:
|
Windows plat returns nil when it detects .a? How to deal with headeronly? |
I don’t know the operating environment in #4479 yet, but according to the current information, he forced There is no problem in using pkg-config under windows. It supports windows, so it should work. If it is the environment I guessed above, then there should still be a PKG_CONFIG_PATH variable set to the path of msys2, similar to this $ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig This will cause pkg-config to look for libraries from msys2 by default. If there is no problem in guessing the running environment, then it should be solved in the following ways:
|
包的 PKG_CONFIG_PATH 是指xmake安装的包吗?那就无意义了,不如直接禁用pkgconfig。
|
Does the PKG_CONFIG_PATH of the package refer to the package installed by xmake? That's meaningless. It's better to disable pkgconfig directly.
|
在这里改,就是 windows 下,完全去掉 pkgconfig 的查找 |
The change here is to completely remove the search for pkgconfig under windows. |
暂时对 windows 禁用了 pkgconfig 查找,但是 mingw/msys2 下依然可用。 |
pkgconfig lookup is temporarily disabled for windows, but is still available under mingw/msys2. |
你在什么场景下需要该功能?
相关讨论的链接
#5527 (comment)
#4479
#5527 (comment)
之前遇到了这个问题,但是其实是没有解决的,只是自己把PATH里面的mingw/bin去掉了
改进总结:平台指定为windows之后,即便PATH里面有pkg-config,也会默认禁用mingw的库
描述可能的解决方案
感谢 @xq114 提到的 #5527 (comment)
描述你认为的候选方案
No response
其他信息
No response
The text was updated successfully, but these errors were encountered: