protocolbuffers/protobuf

Static linking of protoc leads to segmentation fault

Closed

#15,441 opened on Jan 15, 2024

 (0 comments) (0 reactions) (0 assignees)C++ (16,128 forks)batch import
c++help wanted

Repository metrics

Stars
 (71,223 stars)
PR merge metrics
 (Avg merge 2d 11h) (185 merged PRs in 30d)

Description

What version of protobuf and what language are you using? Version: 25.2

What operating system (Linux, Windows, ...) and version? Ubuntu 20.04 (virtual machine and docker)

What runtime / compiler are you using (e.g., python version or gcc version) gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

What did you do? Steps to reproduce the behavior (Can also execute the commands inside of a virtual machine with Ubuntu 20.04): Dockerfile

FROM ubuntu:20.04

ARG BAZEL_VERSION=6.1.1
ARG PROTOBUF_VERSION=25.2

# install build essentials and wget
RUN apt-get update \
    && apt-get -y install build-essential wget \
    && rm -rf /var/lib/apt/lists/*

# isntall bazel
RUN cd /usr/bin \
    && wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64 \
    && chmod +x bazel-${BAZEL_VERSION}-linux-x86_64 \
    && ln -s bazel-${BAZEL_VERSION}-linux-x86_64 bazel \
    && cd -

# download protobuf and build protoc_static
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-${PROTOBUF_VERSION}.tar.gz \
    && tar xf protobuf-${PROTOBUF_VERSION}.tar.gz \
    && cd protobuf-${PROTOBUF_VERSION} \
    && bazel build :protoc_static \
    && ln -s $PWD/bazel-bin/protoc_static /usr/bin/protoc

run:

root@b3f025ec6d0a:/# protoc                                                                                                                                                                                 
Segmentation fault (core dumped)

What did you expect to see I expected to see the help message.

What did you see instead? I got a segmentation fault.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment Static linking of protoc works on Ubuntu 22.04 (docker and native)

Contributor guide