xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.81k stars 774 forks source link

Improve find system library files #5433

Open star-hengxing opened 1 month ago

star-hengxing commented 1 month ago

Is your feature request related to a problem? Please describe.

https://github.com/xmake-io/xmake/issues/5066#issuecomment-2108092571

Describe the solution you'd like

N/A

Describe alternatives you've considered

No response

Additional context

No response

xq114 commented 1 month ago

https://github.com/xmake-io/xmake/issues/5384

star-hengxing commented 1 month ago

5384

目前 apt/pacman 等系统包管理还没支持提取 libfiles 来适配 add_packages("zlib", {linkpath = true})

补充相关讨论 https://github.com/xmake-io/xmake/discussions/5432

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


5384

Currently, system package management such as apt/pacman does not support extracting libfiles to adapt add_packages("zlib", {linkpath = true})

Supplement related discussions https://github.com/xmake-io/xmake/discussions/5432

waruqi commented 1 month ago

apt 里有对 libfiles 的查找

https://github.com/xmake-io/xmake/blob/b0524faed10267bfe351f79186c1cac649682223/xmake/modules/package/manager/apt/find_package.lua#L58

还有 vcpkg conan里也有支持。。其他的暂时没有

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


There is a search for libfiles in apt

https://github.com/xmake-io/xmake/blob/b0524faed10267bfe351f79186c1cac649682223/xmake/modules/package/manager/apt/find_package.lua#L58

There is also support in vcpkg conan. . There are no others at the moment

KkemChen commented 1 month ago

话说 add_requires(apt::xxxx) 会链接静态库还是动态库

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Say add_requires(apt::xxxx) Will it be linked to a static library or a dynamic library?

waruqi commented 1 month ago

pacman 的加上了 https://github.com/xmake-io/xmake/pull/5446

star-hengxing commented 1 month ago

有些系统包管理同时提供静态库和动态库,比如 msys2 pacman,这个能用 configs shared 配置么

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Some system package managers provide both static libraries and dynamic libraries, such as msys2 pacman. Can this be configured using configs shared?

waruqi commented 1 month ago

有些系统包管理同时提供静态库和动态库,比如 msys2 pacman,这个能用 configs shared 配置么

暂时支持不了,这种就没法走 -L/-l 了,只能强制走 linkpath 完整路径,目前它是在 add_packages 阶段决策的,没法在 find_package 阶段搞。。

那就要在 add_packages 阶段 去根据 configs + linkpath 区分处理了。。这个时候 configs 信息也没了,还得单独缓存特殊处理。。有点复杂,懒得搞。

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Some system package managers provide both static libraries and dynamic libraries, such as msys2 pacman. Can this be configured using configs shared?

It is not supported for the time being. This method cannot be used with -L/-l. It can only be forced to use the full linkpath path. Currently, it is determined in the add_packages stage and cannot be done in the find_package stage. .

Then we need to distinguish between configs + linkpath in the add_packages stage. . At this time, the configs information is gone and must be cached separately for special processing. . It's a bit complicated and I'm too lazy to do it.

KkemChen commented 1 month ago

有些系统包管理同时提供静态库和动态库,比如 msys2 pacman,这个能用 configs shared 配置么

暂时支持不了,这种就没法走 -L/-l 了,只能强制走 linkpath 完整路径,目前它是在 add_packages 阶段决策的,没法在 find_package 阶段搞。。

那就要在 add_packages 阶段 去根据 configs + linkpath 区分处理了。。这个时候 configs 信息也没了,还得单独缓存特殊处理。。有点复杂,懒得搞。

强烈要求 apt的库也能指定 shared或static ✊ 提上日程.jgp

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Some system package managers provide both static libraries and dynamic libraries, such as msys2 pacman. Can this be configured using configs shared?

It is not supported for the time being. This method cannot be used with -L/-l. It can only be forced to use the full linkpath path. Currently, it is decided in the add_packages stage and cannot be done in the find_package stage. .

Then we need to distinguish between configs + linkpath in the add_packages stage. . At this time, the configs information is gone and must be cached separately for special processing. . It's a bit complicated and I'm too lazy to do it.

It is strongly requested that the apt library can also specify shared or static ✊ Put it on the agenda.jgp

xq114 commented 1 month ago

有些系统包管理同时提供静态库和动态库,比如 msys2 pacman,这个能用 configs shared 配置么

暂时支持不了,这种就没法走 -L/-l 了,只能强制走 linkpath 完整路径,目前它是在 add_packages 阶段决策的,没法在 find_package 阶段搞。。

那就要在 add_packages 阶段 去根据 configs + linkpath 区分处理了。。这个时候 configs 信息也没了,还得单独缓存特殊处理。。有点复杂,懒得搞。

不需要,加-Wl,-Bstatic或者-Wl,-Bdynamic就行了

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Some system package managers provide both static libraries and dynamic libraries, such as msys2 pacman. Can this be configured using configs shared?

It is not supported for the time being. This method cannot be used with -L/-l. It can only be forced to use the full linkpath path. Currently, it is decided in the add_packages stage and cannot be done in the find_package stage. .

Then we need to distinguish between configs + linkpath in the add_packages stage. . At this time, the configs information is gone and must be cached separately for special processing. . It's a bit complicated and I'm too lazy to do it.

No, just add -Wl,-Bstatic or -Wl,-Bdynamic.

star-hengxing commented 1 month ago

那就要在 add_packages 阶段 去根据 configs + linkpath 区分处理了。。这个时候 configs 信息也没了,还得单独缓存特殊处理。。有点复杂,懒得搞。

那只在 find package 做这一步,暂时不考虑 linkpath 应该可以吧

Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


Then we need to distinguish between configs + linkpath in the add_packages stage. . At this time, the configs information is gone and must be cached separately for special processing. . It's a bit complicated and I'm too lazy to do it.

Then only do this step in find package, and it should be okay to ignore linkpath for the time being.