无法发出“protobuf-c”警告:未找到包“protobuf”

无法发出“protobuf-c”警告:未找到包“protobuf”

我正在尝试建立protobuf-c从这里https://github.com/protobuf-c

但我最终收到了这个错误。

checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/arm-poky-linux-gnueabi/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether C compiler accepts "-Wc99-c11-compat"... yes
checking whether C compiler accepts "-Werror=incompatible-pointer-types"... yes
checking whether C compiler accepts "-Werror=int-conversion"... yes
checking whether C compiler accepts "-Wnull-dereference"... no
checking for doxygen... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for protobuf... no
checking for protobuf... no
configure: error: Package requirements (protobuf >= 2.6.0) were not met:

No package 'protobuf' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

我确实尝试了其他帖子中的建议来添加 PKG_CONFIG_PATH。但我很好奇这是否是因为我拥有比预期更新的 protobuf 版本?

来自配置日志:

configure:16759: checking for pkg-config
configure:16777: found /usr/bin/pkg-config
configure:16789: result: /usr/bin/pkg-config
configure:16814: checking pkg-config is at least version 0.9.0
configure:16817: result: yes
configure:16879: checking for protobuf
configure:16886: $PKG_CONFIG --exists --print-errors "protobuf >= 3.0.0"
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
configure:16889: $? = 1
configure:16903: $PKG_CONFIG --exists --print-errors "protobuf >= 3.0.0"
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
configure:16906: $? = 1
configure:16920: result: no
No package 'protobuf' found
configure:16938: checking for protobuf
configure:16945: $PKG_CONFIG --exists --print-errors "protobuf >= 2.6.0"
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
configure:16948: $? = 1
configure:16962: $PKG_CONFIG --exists --print-errors "protobuf >= 2.6.0"
Package protobuf was not found in the pkg-config search path.
Perhaps you should add the directory containing `protobuf.pc'
to the PKG_CONFIG_PATH environment variable
No package 'protobuf' found
configure:16965: $? = 1
configure:16979: result: no
No package 'protobuf' found
configure:16995: error: Package requirements (protobuf >= 2.6.0) were not met:

No package 'protobuf' found

当我尝试找到 protobuf 时,它显示路径正确

# whereis pkgconfig
pkgconfig: /usr/lib/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig
# echo $PKG_CONFIG_PATH
usr/lib/pkgconfig
# find / -name protobuf
/usr/local/include/google/protobuf
# protoc --version
libprotoc 3.4.0

运行于:armv7l 4.1.15-tx6+g77f6154 Yocto Linux

答案1

在网上尝试了很多建议后,我偶然发现一个中文网站建议添加这条路径:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

到目前为止,我添加了下面的行,但没有起作用

export PKG_CONFIG_PATH=/usr/lib/pkgconfig

添加此行后, 导出 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

./configure 成功

protobuf-c 1.3.0

    CC:                     gcc
    CFLAGS:                 -g -O2
    CXX:                    g++
    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.4.0

相关内容