rust-libxml
rust-libxml copied to clipboard
maybe a better approach to set library path
When I use this module, the rust compiler always couldn't find where the libxml2 located in. I just want to find out if there is a proper way to define a valid path of native library to compiler?
After several hours searching, I found something in official document website that I want to discuss.
link or links?
I tried to find a official introduction about the link section, but found nothing. Maybe I missed something?
Instead, there is a similar field named links in package section.
By using this field, we can override the build parameters by providing a project-level configuration, and no need to modify environment variables or create any softlink.
Documents about overriding build scripts are here.
In this situation, build scripts will be disabled since a target-override is provided.
The override method would not work when we use
linksection instead oflinksfield.
conclusion
I have no idea whether this is a better approach, compared with some manual filesystem operations?
So I create this to discuss it, please feel free to comment, edit or close this PR.
I'm not familiar with how to submit a PR, but I would be very happy if this could help somehow. And thank you for your continuously brilliant work!
~~The current setup isn't ideal on FreeBSD because I always need to set the LIBXML2 environment variable. When I remove the current panic! from the build.rs file, then the library compiles just fine (if I installed libxml2 first, of course). I don't know much about dynamic linking, but assuming the library won't be found is a bit pessimistic, in many cases it may be available at a standard location and the compiler will find it just fine.~~
~~Both on the current master branch and also with this PR, it all works nicely with the panic! removed from the build.rs. Also see the issue I added: #130~~
Forget about this, I was missing the instruction to install pkg-config on FreeBSD.