-
Notifications
You must be signed in to change notification settings - Fork 2
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
mimalloc
is not being linked when building with the Cargo with LTO enabled.
#8
Comments
Thank you for opening the issue! I didn't know Regarding the problem, LTO provides a small but measurable boost in performance, and Does the workaround have any downsides? |
Nothing I can think of, I guess maybe I should also say I've only reproduced this bug on Linux and I don't know how
I've started maintaining it quite recently, mostly because I felt to be able to adopt some orphaned package and I went for the most popular yet flagged as outdated one back then. I also have some experience with Rust (which will definitely come in handy), it's nothing impresive (I see myself still as a beginner, as I still have to become way more familiar with a language syntax like standard library, macros, multi-threading, practical use of async and C interoperability to consider myself knowledgeable enough to see myself as a Rust intermediate dev). If you want to, you might share there your AUR username and I might transfer package ownership to you or make you a co-maintainer, so you might as well by yourself maintain |
I'll add the
Oh, I don't use Arch anymore, I was just suprised that |
The deployment worked as expected, closing the issue. |
Description
As I've started to bring the latest version of
hunt
into the AUR, I've happened to get some linking errors on my machine. What's more weird, it happened only for me while runningcargo build
withinmakepkg
enviroment, which could explain it went unnoticed for quite some time.I've linked the issue to the lack of
mimalloc
in the linker command-line while building it with LTO enabled – inmakepkg
, this is done simply by appendinglto
to theoptions=()
array in themakepkg.conf
or in package-specific options. I currently have no clue what LTO changes in terms of generating a command for linking the native libraries into the final binary, I didn't dig into this problem that much. So there might be a better proper way to fix it, maybe it's even an issue for an upstream project to resolve in the reality.Logs
I'll skip the part that mentions exactly which symbols aren't being found by the linker, to keep the logs a bit shorter than they would be normally, since I've already found the right native library that provides them (symbols in logs quite point to
mimalloc
with the errors telling there's undefined reference to symbols likemi_free
ormi_malloc_aligned
). I've also splitted the logs by the beginning part and the ending part.Here's what's at start of the logs (basically the command line used for linting this, with some stuff replaced to not to leak any info about some paths on my PC or my username):
Here's useful part and the last line of the logs I get from
cargo
, it's basically telling how the one might resolve this in their project (I used that to go with the solution utilising thebuild.rs
):Workarounds
I was able to workaround the error by enforcing to link
mimalloc
with the followingbuild.rs
(placed in the top-level directory of the Rust project, i.e. next toCargo.toml
):I suppose claiming that LTO is unsupported is another way to resolve this issue, so either action could be done. As mentioned before, I'm myself the current maintainer of
hunt
in AUR, so I currently went for using thebuild.rs
as a workaround, but an option to disable LTO for this package is possible as well.The text was updated successfully, but these errors were encountered: