-
Notifications
You must be signed in to change notification settings - Fork 449
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
Fix issues with Win32
/ x86
compilation
#847
Changes from 1 commit
a7d3757
f0758a9
cff5008
136c211
f7137bb
22b7ff9
fbb27b3
5406491
65526a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,12 +39,7 @@ endif() | |
foreach(_target client server) | ||
add_executable(${_target} "${_target}.cpp") | ||
target_link_libraries( | ||
${_target} | ||
example_grpc_proto | ||
protobuf::libprotobuf | ||
gRPC::grpc++ | ||
gRPC::grpc++_reflection | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because there is no such package / target / library, at least not in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be mistaken on this one. But it all compiles without this target. I see where it is mentioned in gRPC build. But I had an issue with that one on Windows.. we do build all examples across all CI loops for CMake? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a library target as below. I think we build all examples in our CMake CI. We probably don't use use the reflection function in gRPC. https://github.com/grpc/grpc/blob/master/CMakeLists.txt#L3146 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, all examples are built so hopefully should be fine :) Though I faintly remember getting link error without this library, but all good if it builds fine in CI. |
||
opentelemetry_trace | ||
opentelemetry_exporter_ostream_span) | ||
${_target} example_grpc_proto protobuf::libprotobuf gRPC::grpc++ | ||
opentelemetry_trace opentelemetry_exporter_ostream_span) | ||
patch_protobuf_targets(${_target}) | ||
endforeach() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check target is Intel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree we should.. My point was mostly that if someone builds for non-Intel (arm, risc, ppc), they'd have to specify the
ARCH
variable manually. Since this variable is currently only being used for Windows dependencies and/or with vcpkg, possible supported architectures are[x86, x64, arm, arm64]
. I can try to improve this to handle Intel and ARM, but with a disclaimer above that any other non-Intel and non-ARM architectures should go thruif(DEFINED ENV{ARCH})
path above. Let me think it over.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThomsonTan - I carefully reviewed the options. The challenge is that on Windows - CMake does not necessarily properly populate the target architecture. This is described in CMake documentation:
Best we can come up with:
assume that users know what arch they are compiling for. And if this is ARM - on Windows they must manually specify the "exotic" target arch using environment variable, such as
set ARCH=arm
orset ARCH=arm64
, which will then be respected by the rest of logic that installs dependencies viavcpkg
.if users didn't specify the arch, then most likely they are building for Intel / AMD64 , nothing exotic.. And generic arch lookup would look like this (bulky!). This is much smarter than what I had done before, but doesn't really add much additional benefit..
The only benefit is if we ever want to auto-install dependencies via
vcpkg
on Linux or Mac, for example, then auto-detecting the target triplet comes in handy. It's a bit of an overkill. This PR for now is forWin32
only. And I don't see a simpler solution. I looked at how Samsung did in in their repo. For Windows they just assume that users manually specify the target arch by parameter, e.g. pretty much as in the first if-condition I had before.