Skip to content

Prefix BoringSSL symbols for grpc_csharp_ext iOS builds.#26109

Merged
jtattermusch merged 1 commit intogrpc:masterfrom
julianxhokaxhiu:patch-1
Aug 19, 2021
Merged

Prefix BoringSSL symbols for grpc_csharp_ext iOS builds.#26109
jtattermusch merged 1 commit intogrpc:masterfrom
julianxhokaxhiu:patch-1

Conversation

@julianxhokaxhiu
Copy link
Copy Markdown
Contributor

@julianxhokaxhiu julianxhokaxhiu commented Apr 28, 2021

Prefix BoringSSL APIs with _GRPC_ by default on iOS, by actually isolating it against other libraries with might include openssl themselves and therefore allowing to embed gRPC on iOS completely mind free.

This patch essentially does what has already been done for cocoapods ( see #21194 ).

@drfloob

Prefix BoringSSL APIs with _GRPC_ by default on iOS, by actually isolating it against other libraries with might include openssl themselves and therefore allowing to embed gRPC on iOS completely mind free.

This patch essentially does what has already been done for cocoapods ( see grpc#21194 ).
@drfloob
Copy link
Copy Markdown
Member

drfloob commented Apr 28, 2021

Thanks for the patch! @jtattermusch please take a look, I think you might be most familiar with this area. Is there anywhere else this compiler flag would need to be added?

It doesn't seem to have affected the decision last time, but looking into this feature, I found in their API docs

This mechanism is under development and may change over time. Please contact the BoringSSL maintainers if making use of it.

It seems to have been stable enough for the past 2 years, but I'm curious if we had that conversation.

@drfloob drfloob requested a review from jtattermusch April 28, 2021 17:23
@drfloob drfloob added area/build platform/iOS release notes: no Indicates if PR should not be in release notes labels Apr 28, 2021
@jtattermusch jtattermusch changed the title Isolate BoringSSL for iOS builds Prefix BoringSSL symbols for grpc_csharp_ext iOS builds. May 5, 2021
PATH_CC="$(xcrun --sdk $SDK --find clang)"
PATH_CXX="$(xcrun --sdk $SDK --find clang++)"

CPPFLAGS="-O2 -Wframe-larger-than=16384 -arch $ARCH -isysroot $(xcrun --sdk $SDK --show-sdk-path) -mios-version-min=9.0 -DPB_NO_PACKED_STRUCTS=1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that this is actually enough to put the boringssl symbol prefixes in place.
Have you tested this or was this just an experiment?

https://github.com/google/boringssl/blob/master/BUILDING.md#building-with-prefixed-symbols

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using it in our own projects and works like a charm. I checked the symbols using nm and I double confirmed it once included in the project where grpc and openssl were clashing, and they are no more. So yes, that's all needed to get it up and running :) Let me know if I can help you further.

Copy link
Copy Markdown
Contributor Author

@julianxhokaxhiu julianxhokaxhiu May 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To explain it a little bit:

All the rest will be auto-wired up by boringssl and when grpc will statically link to it, will find symbols already renamed.

@jtattermusch
Copy link
Copy Markdown
Contributor

@julianxhokaxhiu
Copy link
Copy Markdown
Contributor Author

To be honest I'm not sure if that's related to my own commit because the only error that pops out is this one:

/Applications/Xcode_11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang: /Applications/Xcode_11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang: cannot execute binary file
make: *** [/Volumes/BuildData/tmpfs/src/github/grpc/workspace_csharp_ext_macos_ios/objs/ios_arm64/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.o] Error 126

What is expecting to be executing I have no idea. I know for sure that on macOS Big Sur, latest update and latest XCode it worked fine, as that was my use case. If you can point me where this execution happens in the script I'll be happy to help.

@julianxhokaxhiu
Copy link
Copy Markdown
Contributor Author

Is it possible to re-run a CI check to see if it's good to be merged now?

Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, as this simply makes sure that the same symbol prefixing mechanism will be used by grpc_csharp_ext build as in the ObjC build.

@jtattermusch
Copy link
Copy Markdown
Contributor

I'm rerunning the tests now and will merge if everything ends up green.

@jtattermusch
Copy link
Copy Markdown
Contributor

the C# windows failure is unrelated: https://source.cloud.google.com/results/invocations/db6997a6-4650-43de-bc64-8d290edb4123. Filed #27062

@jtattermusch jtattermusch merged commit ed1b207 into grpc:master Aug 19, 2021
@julianxhokaxhiu
Copy link
Copy Markdown
Contributor Author

Thank you!

@julianxhokaxhiu julianxhokaxhiu deleted the patch-1 branch August 19, 2021 13:26
Vignesh2208 pushed a commit to Vignesh2208/grpc that referenced this pull request Aug 20, 2021
Prefix BoringSSL APIs with _GRPC_ by default on iOS, by actually isolating it against other libraries with might include openssl themselves and therefore allowing to embed gRPC on iOS completely mind free.

This patch essentially does what has already been done for cocoapods ( see grpc#21194 ).
lidizheng pushed a commit to lidizheng/grpc that referenced this pull request Sep 23, 2021
Prefix BoringSSL APIs with _GRPC_ by default on iOS, by actually isolating it against other libraries with might include openssl themselves and therefore allowing to embed gRPC on iOS completely mind free.

This patch essentially does what has already been done for cocoapods ( see grpc#21194 ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build lang/C# platform/iOS release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants