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

Removing boost.asio's Bazel references to OpenSSL because they break bazel query #3

Conversation

Techrocket9
Copy link

Removing references to OpenSSL because OpenSSL references break bazel query for targets that rely on boost.asio due to the fact that OpenSSL is not in BCR yet.

The bazel module for boost.asio only supports boringssl anyway.

@zaucy
Copy link
Member

zaucy commented Jan 13, 2024

could you elaborate? I'm able to query without issue.

@zaucy zaucy added the question label Jan 13, 2024
@Techrocket9
Copy link
Author

Apologies, I think it's just query 'deps(//someTargetThatDependsOnAsio)' queries that exhibit this issue.

@zaucy zaucy force-pushed the bazelboost-1.83.0 branch from 99d9fd8 to 58b57fc Compare January 15, 2024 18:38
@zaucy zaucy mentioned this pull request Jun 2, 2024
@andrewkatson
Copy link

@zaucy If I were to make a registry and a repo that supported openssl on all three major platforms would we be able to use it here so openssl works with this repo? Otherwise people have to migrate to boringssl.

@zaucy
Copy link
Member

zaucy commented Jun 7, 2024

I think it would be better to add openssl to the BCR if possible. Eventually I'd like bazelboost to be on the BCR as well. The bazelboost registry will only be used for development. Ideally users would not have to use it.

@andrewkatson
Copy link

Okay Ill see if I can get it added

@andrewkatson
Copy link

andrewkatson commented Jun 11, 2024

@zaucy I am trying to get openssl included into the BCR but ran into some snags bazel-contrib/rules_foreign_cc#1208

While I get that up and running I was wondering if you could remove openssl support from boost.asio because we cannot use bazel query on targets that depend on boost.asio so I am having trouble debugging other things.

…l query` for targets that rely on `boost.asio` due to the fact that OpenSSL is not in BCR yet.
@zaucy zaucy force-pushed the bazelboost-1.83.0 branch from 58b57fc to 37ce34c Compare June 11, 2024 15:18
@zaucy
Copy link
Member

zaucy commented Jun 11, 2024

going with rules_foreign_cc, eh? I've had a lot of trouble with that one in the past. I hope it ends up working well!

While I get that up and running I was wondering if you could remove openssl support from boost.asio because we cannot use bazel query

Sure I'll update this branch and see if I can get it merged. Last time the CI was failing and I didn't look into why.

@andrewkatson
Copy link

I only did it that way because they actually have a working example in their directory of examples! So all I have to do is get pkg-config working again on the most recent MacOS and I am good to go. Ill lyk how it goes!

@andrewkatson
Copy link

@zaucy what issues did you run into with rules_foreign_cc. They just pushed their updated version and its saying that it cannot find rm. I assume its a sandbox and $PATH issue but am not sure if youve already solved this.

What is odd is their example builds: https://github.com/bazelbuild/rules_foreign_cc/tree/main/examples/third_party/openssl

But mine doesn't: https://github.com/andrewkatson/openssl

I tried to convert theirs to bzlmod style but seem to have missed some specificity.

@zaucy
Copy link
Member

zaucy commented Jul 5, 2024

I can't say I've ran into exactly what you are. Last time I used it was before modules even existed.

My first thought would be to double check the .bazelrc files to see if they differ.

@andrewkatson
Copy link

andrewkatson commented Jul 5, 2024

Okay Ill look into that!

Edit: @zaucy I looked into it and the files are mostly the same. The remaining options didn't seem too different and when I made them the same I got the same errors. So I am trying to find another way to do this. I tried https://bazel.build/rules/lib/repo/http#http_file but what is odd is that I get an error about needing a BUILD file in the source. But the bzlmod migration guide says this is the replacement for http_archive.... so do you know why it needs a BUILD file?

Edit2: Seems there is no pre-built version of openssl available in the thing I was downloading. I will find a hosted one.

Edit3: Oh my gosh there is no prebuilt openssl binary hosted online that can be used for this. Do you know how people are solving the openssl dependency issue in bzlmod?

Edit4: Okay I've started down the path of using a shell script or perl_binary to run Configure and then make which seems to be bearing fruit outside of bazel but not inside of it. I am pretty sure the sandboxing is making it so none of the Perl modules can be found.

@andrewkatson
Copy link

@zaucy I have something that gets it building without rules_foreign_cc and Im almost done with the tests. Its pretty hacky so I was wondering if youd be willing to take a look and give me some pointers before I put it in front of the bazel folks.

@andrewkatson
Copy link

I fixed all the tests and got a working MODULE based openssl build! Im going to propose adding it to BCR.

@zaucy
Copy link
Member

zaucy commented Jul 28, 2024

That's great! Can't wait to see it in the BCR :)

@traceon
Copy link

traceon commented Oct 10, 2024

Noob question: how do you even select the SSL implementation or enable it at all when depending on boost.asio? I'm getting missing symbols.

consuming:

bazel_dep(name = "boost.asio", version = "1.83.0")

then

    deps = [
        "@boost.asio",
    ],

EDIT: adding common [email protected]//:ssl=boringssl to my .bazelrc seems to help (but openssl still not found in the registry). Wonder, if there is a way to do this in my MODULE.bazel instead?

@zaucy
Copy link
Member

zaucy commented Oct 12, 2024

you would have to define a repository called openssl in your WORKSPACE. TBH i'm only using boringssl atm. Until there is an openssl in the BCR (or you add one yourself with a git_override or someting) so that you can use it in MODULE.bazel

@traceon
Copy link

traceon commented Oct 12, 2024

Yeah, but how do you actually switch to it (i.e., tell boost.asio to use openssl), apart from .bashrc workaround I mentioned. (Assuming openssl is imported either via git_override or is available through BCR.)

@zaucy
Copy link
Member

zaucy commented Oct 13, 2024

Adding flag via .bazelrc or when you invoke bazel is the way. It's not a workaround.

@andrewkatson
Copy link

@zaucy someone actually beat met to it. I moved and haven't had a linux/windows machine so I couldn't quash all my bugs. See https://registry.bazel.build/modules/openssl. Can we use this to fix asio?

@zaucy
Copy link
Member

zaucy commented Dec 10, 2024

started it here #5 doesn't work immediately. Will look at it in the next week.

I'm closing this PR in favour of #5.

@zaucy zaucy closed this Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants