Skip to content
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

add_packages 静态库时由于库重名导致符号丢失 #4964

Closed
TOMO-CAT opened this issue Apr 11, 2024 · 4 comments
Closed

add_packages 静态库时由于库重名导致符号丢失 #4964

TOMO-CAT opened this issue Apr 11, 2024 · 4 comments
Labels

Comments

@TOMO-CAT
Copy link

Xmake 版本

xmake v2.8.5

操作系统版本和架构

Linux 720ce3a659a2 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

描述问题

假设系统库中存在 k 库,而 add_packages("foo") 中 foo 也提供了 libk.a,当前 xmake 在链接 add_packages 引入的静态库时用的是 -L${target:pkgs("foo"):installdir("lib")} -lk 选项,从而导致我们在使用系统库 k 符号缺失。

期待的结果

希望可以提供一个 feature 让用户控制是使用 -l 使用 add_packages 引入的静态库,还是直接在链接时直接引用整个 libk.a 的绝对地址避免重名。

为了不影响之前的逻辑,默认使用 -l。

工程配置

target("my_binary", function()
    set_kind("binary")
    ....
    add_syslinks("k")
    add_packages("foo") -- 提供 libk.a 静态库
end)

附加信息和错误日志

丢失系统库 k 符号。

@TOMO-CAT TOMO-CAT added the bug label Apr 11, 2024
@Issues-translate-bot
Copy link

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


Title: add_packages When using a static library, symbols are lost due to duplicate library names.

@star-hengxing
Copy link
Contributor

#3889

@waruqi
Copy link
Member

waruqi commented May 13, 2024

试下这个。#5066 (comment)

@Issues-translate-bot
Copy link

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


Try this. #5066 (comment)

@waruqi waruqi closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants