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

rust-openssl: Cross compilation issues with prebuilt 'openssl' libs #2255

Open
vithalsm opened this issue Jul 1, 2024 · 4 comments
Open

Comments

@vithalsm
Copy link

vithalsm commented Jul 1, 2024

Hi,
Here is my scenario:
openssl-3.x - cross crompiled as 'conan' package and published to our internal conan registry.
Application:
. Wants to use 'rust-openssl' by setting 'dependency' to openssl and openssl-sys (as explained in the README).
. Install pre-built cross compiled openssl-libs via 'build-dependencies' and build.rs. Build script build.rs uses 'conan2-rs' to run 'conan commands' to pull the dependencies (openssl system libs in this case).

However, this method doesn't work, as 'dependencies' are executed prior to 'build-dependencies'.
Hence 'openssl-sys' fails as build script runs later.

So, in such cases, is there any other alternatives?
If there are ways to achieve the same as described above please help with the info.

=====================================================
[dependencies]
openssl-sys = "0.9"
openssl = "0.10"

[build-dependencies]
conan2 = {version = "0.1.1"}
bindgen= {version = "0.69.4"}

build.rs ==>
...
...
use conan2::ConanInstall;
ConanInstall::new()
.profile(&conan_profile)
.build("missing")
.run()
.parse()
.emit();
...
...

@sfackler
Copy link
Owner

sfackler commented Jul 1, 2024

You would need to orchestrate conan outside of cargo.

@vithalsm
Copy link
Author

vithalsm commented Jul 1, 2024

Thanks @sfackler for the response.
Could you please elaborate on "orchestrate conan outside of cargo"?

@sfackler
Copy link
Owner

sfackler commented Jul 1, 2024

If you want to use Conan, you will need to run conan install with the proper generators, etc, and then call cargo build with the environment set up appropriately to point to the conan-installed openssl.

@vithalsm
Copy link
Author

vithalsm commented Jul 1, 2024

Ok. Thought about same, but wasn't sure how easy/difficult it would be to export the paths dynamically.
Same for using sub-crates within a workspace, wherein, using the first crate to do conan job via its build script and second using the stuffs.

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

No branches or pull requests

2 participants