试图从源代码编译protobuf-3.6.1。编译成功。之后尝试编译grpc,然后看到此问题-
协议:加载共享库时出错:./.libs/libprotobuf.so:无法打开共享对象文件:无此类文件或目录
如果我使用gcc-4.8.5,看来我没有遇到此问题。不知道这有什么用。
alias gcc='/usr/local/bin/gcc'
/usr/local/bin/gcc
/tmp/centos/protobuf-3.6.1 > gcc --version
gcc (GCC) 7.3.0
ldd /usr/local/bin/protoc
linux-vdso.so.1 => (0x00007fff0e716000)
./.libs/libprotobuf.so => not found
./.libs/libprotoc.so => not found
libz.so.1 => /lib64/libz.so.1 (0x00007fe68a974000)
libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00007fe68a5f1000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe68a2ef000)
libgcc_s.so.1 => /usr/local/lib64/libgcc_s.so.1 (0x00007fe68a0d8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe689ebc000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe689aef000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe68ab8a000)
我想使用gcc7及更高版本。如何确保protoc与/usr/local/lib/libprotobuf.so链接