Gangmax Blog

Fix the "google/protobuf/descriptor.proto: file not found" issue

Today when I use “protoc” to compile some protobuf files, I get the “google/protobuf/descriptor.proto: file not found” error.

That means the protobuf files I’m compiling uses this “descriptor.proto” file but cannot find it. I googled this error and here it says that on Debian we can install “libprotobuf-dev” and “libprotoc-dev” packages to fix this issue. However I’m using Mac. This doesn’t work.

Then I found the “descriptor.proto” file can be found in the official “protobuf“ project. After that the fix is easy.

1
2
3
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v2.5.0

After that, using the following command to compile and the issue is gone:

1
protoc -I ~/code/github/protobuf/src something.proto

Today when I run a Gradle build I get the following error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
> gradle clean build       
Expiring Daemon because JVM Tenured space is exhausted
Daemon will be stopped at the end of the build after running out of JVM memory
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted

> Task :xxx-protobuf-internal-proto-3.1.0:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Problem in daemon expiration check
java.lang.OutOfMemoryError: GC overhead limit exceeded
at sun.util.resources.LocaleData$LocaleDataResourceBundleControl.toBundleName(LocaleData.java:272)
at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2643)
at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1510)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:1474)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1370)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:899)
at sun.util.resources.LocaleData$1.run(LocaleData.java:167)
at sun.util.resources.LocaleData$1.run(LocaleData.java:163)
at java.security.AccessController.doPrivileged(Native Method)
at sun.util.resources.LocaleData.getBundle(LocaleData.java:163)
at sun.util.resources.LocaleData.getNumberFormatData(LocaleData.java:159)
at sun.util.locale.provider.LocaleResources.getDecimalFormatSymbolsData(LocaleResources.java:168)
at java.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols.java:616)
at java.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:113)
at sun.util.locale.provider.DecimalFormatSymbolsProviderImpl.getInstance(DecimalFormatSymbolsProviderImpl.java:85)
at java.text.DecimalFormatSymbols.getInstance(DecimalFormatSymbols.java:180)
at java.util.Formatter.getZero(Formatter.java:2283)
at java.util.Formatter.<init>(Formatter.java:1892)
at java.util.Formatter.<init>(Formatter.java:1914)
at java.lang.String.format(String.java:2940)
at org.gradle.launcher.daemon.server.health.DaemonMemoryStatus.exceedsThreshold(DaemonMemoryStatus.java:106)
at org.gradle.launcher.daemon.server.health.DaemonMemoryStatus.isTenuredSpaceExhausted(DaemonMemoryStatus.java:60)
at org.gradle.launcher.daemon.server.health.LowTenuredSpaceDaemonExpirationStrategy.checkExpiration(LowTenuredSpaceDaemonExpirationStrategy.java:39)
at org.gradle.launcher.daemon.server.expiry.AnyDaemonExpirationStrategy.checkExpiration(AnyDaemonExpirationStrategy.java:43)
at org.gradle.launcher.daemon.server.health.HealthExpirationStrategy.checkExpiration(HealthExpirationStrategy.java:38)
at org.gradle.launcher.daemon.server.expiry.AnyDaemonExpirationStrategy.checkExpiration(AnyDaemonExpirationStrategy.java:43)
at org.gradle.launcher.daemon.server.MasterExpirationStrategy.checkExpiration(MasterExpirationStrategy.java:73)
at org.gradle.launcher.daemon.server.Daemon$DaemonExpirationPeriodicCheck.run(Daemon.java:269)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
Problem in daemon expiration check
java.lang.OutOfMemoryError: GC overhead limit exceeded
Failed to execute org.gradle.launcher.daemon.server.Daemon$DaemonExpirationPeriodicCheck@133713d.
java.lang.OutOfMemoryError: GC overhead limit exceeded

> Task :xxx-protobuf-internal-proto-3.7.1:compileJava FAILED


The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: GC overhead limit exceeded

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':xxx-protobuf-internal-proto-3.7.1:compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 10m 54s
47 actionable tasks: 47 executed

Here is an answer of how to solve this issue but I don’t try it yet.

Comments