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

@com_github_grpc_grpc//:envoy_annotations_upb fails with error upb requires C99 or C++11 or MSVC >= 2015. #26121

Closed
basavaraj29 opened this issue Apr 29, 2021 · 5 comments

Comments

@basavaraj29
Copy link

What version of gRPC and what language are you using?

gRPC version v1.37.0
language python

What operating system (Linux, Windows,...) and version?

Linux. rhel 7.9

What runtime / compiler are you using (e.g. python version or version of gcc)

gcc gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

What did you do?

cloned the latest version of grpc/grpc repository and did a bazel build @com_github_grpc_grpc//:envoy_annotations_upb
Also tried building with flags --cxxopt=-std=c++11, still didn't work

What did you expect to see?

that the target passes

What did you see instead?

ERROR: /home/basav/grpc/BUILD:3481:16: C++ compilation of rule '//:google_api_upb' failed (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 40 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 40 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
In file included from external/upb/upb/upb.h:15:0,
                 from external/upb/upb/table.int.h:25,
                 from external/upb/upb/msg.h:15,
                 from src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c:10:
external/upb/upb/port_def.inc:27:2: error: #error upb requires C99 or C++11 or MSVC >= 2015.
 #error upb requires C99 or C++11 or MSVC >= 2015.
  ^

Anything else we should know about your project / environment?

NA

@drfloob
Copy link
Member

drfloob commented Apr 29, 2021

Interesting. GCC 4.8.5 should support C++11 (https://www.gnu.org/software/gcc/gcc-4.8/cxx0x_status.html)
Can you run with bazel build -s --cxxopt='-std=c++11' to ensure that -std='c++11' is actually being passed to gcc?

@veblush maybe you have some extra insight here.

@basavaraj29
Copy link
Author

Ran bazel build -s --cxxopt='-std=c++11' @com_github_grpc_grpc//:envoy_annotations_upb, still facing the same issue.

@veblush
Copy link
Contributor

veblush commented Apr 30, 2021

@basavaraj29 It isn't clear to me why upb fails to get proper __STDC_VERSION__ nor __cplusplus. This has been like this for a while, I suspect that this is bazel or rhel specific. Beside this error, gcc 4.8 is now too old to build gRPC so I recommend to use later versions of gcc, which possibly solves this very problem as well). It appears that you can use gcc 7 on RHEL 7 (doc).

@drfloob
Copy link
Member

drfloob commented May 3, 2021

I'm going to close this, since gcc 4.8 isn't supported (see the list of supported compilers and environments here: https://grpc.io/docs/). Please feel free to reopen this if you're still facing the same problem with a newer compiler.

@drfloob drfloob closed this as completed May 3, 2021
@basavaraj29
Copy link
Author

Post upgrading to gcc 8.3.1, I still faced the same issue on rhel. Including the flag --incompatible_linkopts_to_linklibs solved the issue for me. bazelbuild/bazel#9254

And as you guys rightly pointed out, it didn't work with gcc 4.8 despite providing the flag. thank you @veblush, @drfloob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants