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

maybe a better approach to set library path #101

Closed
wants to merge 1 commit into from

Conversation

meltfar
Copy link

@meltfar meltfar commented May 20, 2022

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 link section instead of links field.

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!

@rudolphfroger
Copy link
Contributor

rudolphfroger commented Mar 3, 2024

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.

@dginev dginev closed this Jun 3, 2024
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 this pull request may close these issues.

3 participants