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

Functions missing in libjulia.so.1.7, no longer able to generate FFI bindings due to missing headers #41464

Closed
Taaitaaiger opened this issue Jul 4, 2021 · 6 comments · Fixed by #41466

Comments

@Taaitaaiger
Copy link
Contributor

Today I tried to migrate jlrs, a crate that provides bindings to the Julia C API for Rust, to Julia 1.7.0-beta2. I've run into two problems.

The first is related to how the low-level bindings are created: this uses bindgen which automatically generates Rust FFI bindings to C and C++ libraries. Previously this worked without any problems in combination with Julia, but now causes an error because the support directory and its contents are not available in the include directory. This can be solved relatively easily by creating a symlink to the support directory.

The second, larger issue, is that some functions that should be exported aren't actually exported by libjulia.so. Both jl_get_pgcstack and jl_field_index are marked as JL_DLLEXPORT. I can find the latter if I inspect libjulia.so.1.6 with nm, but I can't find either in libjulia.so.1.7. Compilation of tests eventually fails due to a linker error because it can't find these functions. If I redefine these two functions to just call exit(1) in a custom C library everything compiles and the tests run until jl_get_pgcstack is called "outside" Julia.

My code can be found here if that's useful: https://github.com/Taaitaaiger/jlrs/tree/dev-1.7

@giordano
Copy link
Contributor

giordano commented Jul 5, 2021

jl_get_pgcstack has been exported by #41320

@fingolfin
Copy link
Contributor

The header problems were fixed in #41308 so that will be fine in beta3

that leaves jl_field_index

@fingolfin
Copy link
Contributor

In general I wonder what the relation between functions marked with JL_DLLEXPORT and functions listed in src/jl_exported_funcs.inc is -- I would have expected the two to coincide, but that's clearly not the case, tons more things are in the former category compared to the later.

@fingolfin
Copy link
Contributor

I've submitted PR #41466. @Taaitaaiger if you apply the patches we pointed to and rebuild Julia, does it then work? Would be good to discover if there are other issues so that they can be resolved with beta3.

@Taaitaaiger
Copy link
Contributor Author

Thanks for the quick replies and patches, I should be able to test this later today.

@Taaitaaiger
Copy link
Contributor Author

I've applied the changes from the three PRs and rebuilt Julia, this solves all my issues. Everything compiles and the tests succeed.

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.

3 participants