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

FreeBSD instructions #130

Closed
rudolphfroger opened this issue Mar 3, 2024 · 4 comments · Fixed by #131
Closed

FreeBSD instructions #130

rudolphfroger opened this issue Mar 3, 2024 · 4 comments · Fixed by #131

Comments

@rudolphfroger
Copy link
Contributor

rudolphfroger commented Mar 3, 2024

Hi,

Here are FreeBSD instructions for in the README.md:

$ pkg install libxml2
$ LIBXML2=/usr/local/lib/libxml2.so cargo build

Btw, it would be nice if the crate could be build without setting an environment variable. Removing the panic!("Could not find libxml2.") from build.rs enables this on FreeBSD.

@dginev
Copy link
Member

dginev commented Mar 3, 2024

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:

rust-libxml/build.rs

Lines 31 to 36 in 2380450

#[cfg(any(target_family = "unix", target_os = "macos"))]
{
if pkg_config_dep::find() {
return;
}
}

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?

@rudolphfroger
Copy link
Contributor Author

rudolphfroger commented Mar 4, 2024

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.

@rudolphfroger
Copy link
Contributor Author

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

@dginev
Copy link
Member

dginev commented Mar 5, 2024

Thank you for contributing this @rudolphfroger !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants