Protobuf error compiling on macOS

948 views
Skip to first unread message

Marquis Wong

unread,
Oct 13, 2021, 5:23:26 PM10/13/21
to Repo and Gerrit Discussion
Hello,

I'm trying to build Gerrit on macOS, and I keep on getting errors related to compiling protobuf.

In file included from external/com_google_protobuf/src/google/protobuf/stubs/statusor.cc:31:
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:193:29: error: no member named 'UNKNOWN' in 'google::protobuf::util::status_internal::Status'
    : status_(util::Status::UNKNOWN) {
              ~~~~~~~~~~~~~~^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:199:22: error: use of undeclared identifier 'error'
    status_ = Status(error::INTERNAL, "Status::OK is not a valid argument.");
                     ^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:208:22: error: use of undeclared identifier 'error'
    status_ = Status(error::INTERNAL, "nullptr is not a valid argument.");
                     ^
external/com_google_protobuf/src/google/protobuf/stubs/statusor.h:210:23: error: no member named 'OK' in 'google::protobuf::util::status_internal::Status'
    status_ = Status::OK;
              ~~~~~~~~^

I suspect my problem is the gcc version.

I've been using what I think is the default version that gets installed with Xcode

✗ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I'm running macOS Big Sur 11.6, and Java 11:

✗ java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Homebrew (build 11.0.12+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.12+0, mixed mode)

The documentation doesn't say what GCC versions are required. I've successfully build on Linux with gcc 4.8.5, but it's difficult to get that version installed on Big Sur.

Tom Shi

unread,
Nov 4, 2021, 4:43:28 AM11/4/21
to Repo and Gerrit Discussion
hi mate, did you fix this? I'm on the same issue with it. looking for solutions.

Tianyu 

Matthias Sohn

unread,
Nov 4, 2021, 10:37:39 AM11/4/21
to Tom Shi, Repo and Gerrit Discussion
On Thu, Nov 4, 2021 at 9:43 AM Tom Shi <tom.sh...@gmail.com> wrote:
hi mate, did you fix this? I'm on the same issue with it. looking for solutions.

I am on MacOS 11.6 and have XCode 13.0 installed.

With that the gcc version is:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1

Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 
and I can build gerrit with that

-Matthias

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/12f77129-fe5b-4a3c-b18e-2c146907cd17n%40googlegroups.com.

Marquis Wong

unread,
Nov 4, 2021, 3:49:20 PM11/4/21
to Repo and Gerrit Discussion
I did get this issue resolved, if you're having the exact same error.

It wasn't an issue with GCC, but rather other protobuf versions installed. Gerrit depends on protobuf 3.14, and I had a different version already installed. I uninstalled it (and the things depending on it, which included MySQL, which was somewhat inconvenient), and Gerrit built successfully.

I eventually decided to build inside a Docker image instead to avoid random dependencies breaking the build.
Reply all
Reply to author
Forward
0 new messages