-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[opentelemetry-cpp] opentelemetry-cpp/1.14.2: the option -o with_otlp_grpc=True fails to build when compiling with MSVC (Visual Studio) #25975
Comments
Here is what I did to resolve this issue: master...JeremyBorys:conan-center-index:master I can submit this upstream if we are good with this. |
Hi @JeremyBorys thanks a lot for taking the time to report this issue and propose a solution, we appreciate it! The idea for the fix is probably the way to go, but I'm thinking if this should be a fix in the grpc side of things, and its recipe should be the one telling its consumers to add that definition to their compiler invokations. I'll double check with the team and will let you know once I know more :) |
Thanks @AbrilRBS There are definitely pros and cons to both approaches I will be looking forward to hearing back from you :) |
I was checking https://github.com/open-telemetry/opentelemetry-cpp/issues, but they have not had a report for this issue on their end, which strikes me as unusual, as this seems like it would be a problem outside of Conan too. Also, after talking with the team, your current suggestion would be better than doing it on grpc's side, as we don't control/know every TU that ends up being affected, and that can have unintended consequences! So the current plan is to report this issue upstream, see if they are aware of it! I can do it, but I'm happy to let you report it if your prefer! Also, some notes while we wait:
The scope would also make it so it only applies to this recipe. From the CLI, it would be similar: With this, no modifications are needed for the recipe and the fix can be added to your profile/invokation while we find the proper fix for the recipe itself!
PS: Just noticed that your proposed solution should use |
I agree. In a discussion with a colleague, we noticed that contradiction as well: the build results differ when using Conan compared to building without it. I didn't spend time investigating why that contradiction exists.
I also agree, that was my interpretation as well that grpc won't be able to export
If you can report it I would prefer that. I am a little unclear of who we are planning to report this too, grpc or opentelemetry-cpp Thank you for the following suggestion:
I was looking for exactly this but was unable to locate on the documentation. Is this the right page: https://docs.conan.io/2/reference/tools/build.html ? This is a really useful feature!
Oh yeah that makes much more sense! Thanks for pointing that out! |
Thanks for going over this!
When in doubt - I would say whoever is including Windows.h without guarding it should be the starting point. Note that opentelemetry actually removed defining On the other hand, grpc's own headers do have some protection for this: As it stands - I'd try to find a minimal reproducible example in a C++ source file that includes the relevant header files to reproduce the issue, and report it to opentelemetry first. Would you mind updating this issue description with the full log so that we can check which exact versions were resolved by Conan? Thanks! |
Note: with
to overcome this particular error - but it may fail down the line depending on whether whoever calls the |
Description
We are building opentelemetry-cpp with msvc and grpc support, the recipe is failing to build. We expect that -o with_otlp_grpc=True should successfully build.
I don't know of any workarounds other than to update the recipe with:
I have narrowed down the issue to MSVC having preprocessor macros for
MIN(a, b)
andMAX(a, b)
and grpc definesmin()
andmax()
functions in a class:https://github.com/grpc/grpc/blob/master/include/grpc/event_engine/memory_request.h#L45-L46
Since this class is included and used by opentelemetry this fails to correctly interpret the header file. The following are errors caused when compiling this package with the option:
-o with_otlp_grpc
with msvc:We have tested this with version 1.14.2 and 1.17.0 and the behaviour is the same
I have already fixed this in my fork
Package and Environment Details
Conan profile
Build profile:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
Steps to reproduce
conan create recipe/opentelemetry-cpp/all -o with_otlp_grpc=True --version 1.14.2
conan create recipe/opentelemetry-cpp/all -o with_otlp_grpc=True --version 1.17.0
Logs
Click to expand log
The text was updated successfully, but these errors were encountered: