0

I am trying to compile opentelementry-cpp project (https://github.com/open-telemetry/opentelemetry-cpp) but it results in errors.

This are the commands I am running:

RUN git clone -b v1.1.1 https://github.com/open-telemetry/opentelemetry-cpp otel && \
    cd /root/otel && \
    git submodule update --init

RUN export LD_LIBRARY_PATH=/opt/grpc/lib/:/opt/protobuf/lib64:/opt/zlib/lib:$LD_LIBRARY_PATH && \
    source /opt/rh/devtoolset-10/enable && \
    cd /root/otel && \
    mkdir build && \
    cd build && \
    cmake3 \
        -DCMAKE_INSTALL_PREFIX:PATH=/opt/otel \
        -DCMAKE_BUILD_TYPE=Release \
        -DBUILD_SHARED_LIBS=ON \
        -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
        -DWITH_ZIPKIN=OFF \
        -DWITH_JAEGER=OFF \
        -DBUILD_TESTING=OFF \
        -DWITH_OTLP=ON \
        -DWITH_OTLP_GRPC=ON \
        -DWITH_METRICS_PREVIEW=OFF \
        -DWITH_LOGS_PREVIEW=OFF \
        -DgRPC_DIR=/opt/grpc/lib/cmake/grpc/ \
        -Dnlohmann_json_DIR=/opt/nlohmann_json/lib64/cmake/nlohmann_json/ \
        -DProtobuf_INCLUDE_DIR=/opt/protobuf/include \
        -DProtobuf_LIBRARY=/opt/protobuf/lib64/libprotoc.so \
        -DProtobuf_PROTOC_LIBRARY=/opt/protobuf/lib64/libprotoc.sos \
        -DPROTOBUF_PROTOC_EXECUTABLE=/opt/protobuf/bin/protoc \
        -Dc-ares_DIR=/opt/cares/lib64/cmake/c-ares \
        -Dabsl_DIR=/opt/abseil-cpp/lib64/cmake/absl \
        -Dre2_DIR=/opt/re2/lib64/cmake/re2 \
        -DCMAKE_CXX_FLAGS=-I/opt/grpc/include\ -I/opt/abseil-cpp/include \
        .. && \
    make && \
    make install

The error I get in the end is this:

#19 65.08 [ 74%] Building CXX object examples/grpc/CMakeFiles/server.dir/server.cc.o
#19 71.59 [ 75%] Linking CXX executable server
#19 71.65 /opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: CMakeFiles/server.dir/server.cc.o: undefined reference to symbol '_ZN6google8protobuf8internal14ArenaStringPtr3SetENS2_12EmptyDefaultERKSsPNS0_5ArenaE'
#19 71.65 /opt/rh/devtoolset-10/root/usr/libexec/gcc/x86_64-redhat-linux/10/ld: /opt/protobuf/lib64/libprotobuf.so.3.15.8.0: error adding symbols: DSO missing from command line
#19 71.65 collect2: error: ld returned 1 exit status
#19 71.65 make[2]: *** [examples/grpc/CMakeFiles/server.dir/build.make:155: examples/grpc/server] Error 1
#19 71.65 make[1]: *** [CMakeFiles/Makefile2:1098: examples/grpc/CMakeFiles/server.dir/all] Error 2
#19 71.65 make: *** [Makefile:150: all] Error 2

Any hint how to solve this problem?

MrPython
  • 162
  • 1
  • 8
  • 1
    Variable `Protobuf_LIBRARY` should be assigned to the `protobuf` library, not to the `protoc` library as you currently have (`/opt/protobuf/lib64/libprotoc.so`). – Tsyvarev Feb 02 '22 at 15:10
  • Thank you! After your comment I also saw there was a typo in another line. – MrPython Feb 02 '22 at 15:49

0 Answers0