Package libprotobuf was not found in the pkg-config search path

5,813

Why do you want to build the protobuf-c Ubuntu repository package from source? It's a good practice and more convenient to prefer installing Ubuntu repository packages with apt instead of downloading them and compiling them. protobuf-c gets automatically updated when an update becomes available if you install it with apt. So you see it's more secure to install it with apt both ways.

To install Protocol Buffers C compiler (protobuf-c) in all currently supported versions of Ubuntu open the terminal and type:

sudo apt install protobuf-c-compiler  

In Ubuntu 18.04 this command installs version 1.2.1 of protobuf-c, and in Ubuntu 19.04 this installs version 1.3.1.

Protocol Buffers are a flexible, efficient, automated mechanism for serializing structured data - similar to XML, but smaller, faster and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format.

Share:
5,813

Related videos on Youtube

Lohit raj
Author by

Lohit raj

Updated on September 18, 2022

Comments

  • Lohit raj
    Lohit raj almost 2 years

    I am installing protobuf-c 1.3.2

    after ./configure it shows

        protobuf-c 1.3.2
    
            CC:                     gcc
            CFLAGS:                 -g -O2
            CXX:                    g++ -std=c++11
            CXXFLAGS:               -g -O2
            LDFLAGS:                
            LIBS:                   
    
            prefix:                 /usr/local
            sysconfdir:             ${prefix}/etc
            libdir:                 ${exec_prefix}/lib
            includedir:             ${prefix}/include
            pkgconfigdir:           ${libdir}/pkgconfig
    
            bigendian:              no
            protobuf version:       libprotoc 3.8.0
    
    

    but pkg-config --cflags 'libprotobuf >= 1.0.0' is not working. it says

    Package libprotobuf was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libprotobuf.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libprotobuf' found
    

    pkg-config --variable pc_path pkg-config shows

    /usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
    
    • steeldriver
      steeldriver almost 5 years
      What is the problem you are trying to solve, exactly? Why do you believe that your pkg-config command should work?
    • Lohit raj
      Lohit raj almost 5 years
      hey, when i am installing with make install i got permission issues, which i forgot to mention. I uninstalled and installed again with sudo access. And now its woring fine.
  • Lohit raj
    Lohit raj almost 5 years
    Thanks karel, sorry i didn't put my make status. Thanks anyway.
  • karel
    karel almost 5 years
    This is the standard way of compiling all .tar.gz packages from source, but the question remains why did you compile protobuf-c from source instead of installing it with apt? It's a good practice and more convenient to prefer installing Ubuntu repository packages with apt instead of downloading them and compiling them.