0

I'm trying to get protocol buffer working with intelliJ and gradle. However, I'm running into this error: Execution failed for task ':generateProto'.

protoc: stdout: . stderr: protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object file: No such file or directory

I've seen this post: Protobuf cannot find shared libraries that explains the situation. But my question is that everything runs perfect on terminal as shown below:

yuefengzhao@zyf-ubuntu:~$ which protoc /usr/local/bin/protoc

yuefengzhao@zyf-ubuntu:~$ protoc --version libprotoc 2.6.1 But it's just not working at all on intelliJ. I'm not sure if intelliJ is configured so that protoc is pointing to eleswhere rather than what's set up in terminal.

scrrenshot of build.gradle and error message

Also, it's one of the requirements that I have to use protobuf v2.6.1

I've spent many hours trying and failing, looking for tons of solutions online but still couldn't wrap my head around. Any help would be appreciated!

Maxon Zhao
  • 11
  • 1
  • Are you sure it's IntelliJ IDEA specific? Does the same gradle build work without errors if you run it in the system terminal via `./gradlew build`? – CrazyCoder Jan 19 '22 at 19:38

1 Answers1

1

After debugging all night, I figured it's path to protoc that causing the problem. In my system terminal, protoc points to /usr/local/bin as expected when I do which protoc. But IntelliJ somehow gets a different path, pointing to /yuefeng/bin which is under /home.

The solutions is to start IntelliJ from system terminal instead of GUI (I'm using ToolBox) - a suggestion from IntelliJ support team. I guess this is just a glitch from IntelliJ.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Maxon Zhao
  • 11
  • 1