jeroen / protolite

Fast and Simple Object Serialization to Protocol Buffers
Other
48 stars 9 forks source link

Trouble installing protolite from source: string_view does not name a type? #25

Open robintschoetschel opened 6 months ago

robintschoetschel commented 6 months ago

Hi there,

I'm having trouble installing protolite, and am at my wits end... Maybe you can help me figure out what's going wrong? I've attached an install log, and can share the dockerfile

I have the requirements installed (on debian bookworm).

Thank you!

* installing *source* package ‘protolite’ ...
** package ‘protolite’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lprotobuf
Found C++17 compiler: aarch64-conda-linux-gnu-c++ -std=gnu++17 -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1710256210330/work=/usr/local/src/conda/r-base-4.2.3 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix
Using libprotoc 25.3 from /opt/conda/bin/protoc
Warning: protoc version libprotoc 25.3 might not match libproto version 3.21.12.
** libs
aarch64-conda-linux-gnu-c++ -std=gnu++14 -I"/opt/conda/lib/R/include" -DNDEBUG -DUSENEWAPI -I'/opt/conda/lib/R/library/Rcpp/include' -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include -I/opt/conda/include -Wl,-rpath-link,/opt/conda/lib -fvisibility=hidden -fpic -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1710256210330/work=/usr/local/src/conda/r-base-4.2.3 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -c RcppExports.cpp -o RcppExports.o
aarch64-conda-linux-gnu-c++ -std=gnu++14 -I"/opt/conda/lib/R/include" -DNDEBUG -DUSENEWAPI -I'/opt/conda/lib/R/library/Rcpp/include' -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include -I/opt/conda/include -Wl,-rpath-link,/opt/conda/lib -fvisibility=hidden -fpic -fvisibility-inlines-hidden -fmessage-length=0 -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1710256210330/work=/usr/local/src/conda/r-base-4.2.3 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -c geobuf.cpp -o geobuf.o
In file included from /opt/conda/include/google/protobuf/stubs/common.h:20,
from /opt/conda/include/google/protobuf/io/coded_stream.h:107,
from geobuf.pb.h:26,
from geobuf.cpp:1:
/opt/conda/include/absl/strings/string_view.h:53:26: error: 'string_view' in namespace 'std' does not name a type
53 | using string_view = std::string_view;
| ^~~~~~~~~~~
/opt/conda/include/absl/strings/string_view.h:53:21: note: 'std::string_view' is only available from C++17 onwards
jeroen commented 6 months ago

If you are using anaconda you probably need to install it from here: https://anaconda.org/conda-forge/r-protolite

robintschoetschel commented 6 months ago

Ah, that was quick, thanks! The conda-packages don't support aarch64, unfortunately, so I'm stuck with compiling

jeroen commented 6 months ago

OK that really complicates things. The problem is that conda has it's own compilers, which are incompatible with the debian system libraries, hence we cannot use libprotobuf and protoc from Debian.

Using libprotoc 25.3 from /opt/conda/bin/protoc
Warning: protoc version libprotoc 25.3 might not match libproto version 3.21.12.

From these lines in your output it seems to be finding the conda version of protoc but the debian version of libprotobuf, which would explain compile errors.

I do not use anaconda myself but maybe you need some way to get the conda version of protobuf on your path? Perhaps you need to install https://anaconda.org/conda-forge/libprotobuf? OR set PKG_CONFIG_PATH to the location of the the protobuf.pc file that comes with anaconda?


FWIW, I would recommend not using anaconda if you don't have to.

You can install an up-to-date version of r-base that is compatible with all native compilers and libraries in Debian from https://cran.r-project.org/bin/linux/debian/#debian-bookworm