Closed rudolphfroger closed 8 months ago
I am not a FreeBSD user so I may be missing something obvious. The ENV variable is only needed when the actual attempt at finding libxml2.so fails. For unix systems we have an actual attempt to find it via pkg_config
:
https://github.com/KWARC/rust-libxml/blob/23804509dacb93dc5b9df76d1155fc41fb2cd349/build.rs#L31-L36
Is this not workable on FreeBSD? If so, what is a usual alternative?
Or do we need to add , target_os = "freebsd"
to the cfg enumeration?
I've tried using pkg_config
but that won't work either. But the build-system on itself is already capable of finding libxml2
on its own, so I there's no need to do anything special in build.rs
.
I just got a report van a colleague that his Linux system also needs the LIBXML2
environment variable before he got it working. I think many systems would build the crate fine without the current panic!
in build.rs
.
After some more fiddling around, I found out that I need to install the pkgconf
package on FreeBSD, which provides pkg-config
. So the instructions for FreeBSD actually are:
$ pkg install libxml2 pkgconf
$ cargo build
It would be nice if you could add that to the README.md
Thank you for contributing this @rudolphfroger !
Hi,
Here are FreeBSD instructions for in the
README.md
:Btw, it would be nice if the crate could be build without setting an environment variable. Removing the
panic!("Could not find libxml2.")
frombuild.rs
enables this on FreeBSD.