Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]symbol lookup error #999

Closed
yhx-coder opened this issue Jul 7, 2022 · 4 comments
Closed

[Question]symbol lookup error #999

yhx-coder opened this issue Jul 7, 2022 · 4 comments

Comments

@yhx-coder
Copy link

yhx-coder commented Jul 7, 2022

I want to run stratum_bmv2 outside of the container. After installing the Debian package, I try to run it by stratum_bmv2. The bash shows that
stratum_bmv2: symbol lookup error: /usr/local/lib/libsimpleswitch_runner.so.0: undefined symbol: _ZTIN15sswitch_runtime25InvalidMirroringOperationE.
What shuold I do? Could someone give me some help? thanks a lot.
I use ubuntu18.04 and stratum_bmv2_22.06.

@yhx-coder yhx-coder changed the title symbol lookup error [Question]symbol lookup error Jul 7, 2022
@Dscano
Copy link
Contributor

Dscano commented Jul 7, 2022

Hi yhx-coder,

did you build on your own the stratum_bmv2 or you download it form stratum assets? That error seems related to bmv2 switch rather than stratum. https://github.com/p4lang/behavioral-model/search?q=InvalidMirroringOperation

@pudelkoM
Copy link
Member

pudelkoM commented Jul 7, 2022

The bmv2 version is not as self-contained as the others. It requires some libraries that have to be manually installed beforehand.
You can check how the bmv2 Docker image built and replicate that locally:

stratum/Dockerfile.build

Lines 63 to 85 in 88d02d5

ARG PI_COMMIT
RUN git clone https://github.com/p4lang/PI.git /tmp/PI && \
cd /tmp/PI && git checkout ${PI_COMMIT} && \
git submodule update --init --recursive && \
./autogen.sh && \
./configure --without-bmv2 --without-proto --without-fe-cpp \
--without-cli --without-internal-rpc && \
make -j${JOBS} && make install && ldconfig && \
rm -rf /tmp/PI
ARG BMV2_COMMIT
ENV BMV2_INSTALL /usr/local
RUN git clone https://github.com/p4lang/behavioral-model.git /tmp/bmv2 && \
cd /tmp/bmv2 && git checkout ${BMV2_COMMIT} && \
./autogen.sh && \
./configure --without-targets --with-pi --disable-elogger \
--without-nanomsg --without-thrift --prefix=${BMV2_INSTALL} \
CXXFLAGS="-I${PWD}/targets/simple_switch -DWITH_SIMPLE_SWITCH -isystem$BMV2_INSTALL/include -isystem$PI_INSTALL/include -L$PI_INSTALL/lib" && \
make -j${JOBS} && make install && ldconfig && \
cd targets/simple_switch && \
make -j${JOBS} && make install && ldconfig && \
cp /tmp/bmv2/tools/veth* ${BMV2_INSTALL}/bin/ && \
rm -rf /tmp/bmv2

ENV BUILD_DEPS \
python-setuptools \
python-pip \
help2man
RUN apt-get update && \
apt-get install -y --no-install-recommends ${BUILD_DEPS}
# Build Mininet
RUN mkdir /tmp/mininet
WORKDIR /tmp/mininet
RUN curl -L https://github.com/mininet/mininet/tarball/master | \
tar xz --strip-components 1
# Install in a special directory that we will copy to the runtime image.
RUN mkdir -p /output
RUN PREFIX=/output make install-mnexec install-manpages
RUN python setup.py install --root /output
# Install `m` utility so user can attach to a mininet host directly
RUN cp util/m /output/bin/m && sed -i 's#sudo##g' /output/bin/m
# Copy Stratum souce to build additionally needed targets.
COPY . /tmp/stratum
WORKDIR /tmp/stratum
# As well as the P4Runtime Python bindings installed by PI. This is not needed
# to run mininet, but it's useful to execute Python scripts acting as a
# P4Runtime client, e.g. control plane apps or PTF tests.
RUN bazel build @com_github_p4lang_p4runtime//:p4runtime_proto \
@com_google_protobuf//:protobuf_python \
@com_google_googleapis//google/rpc:status_cc_proto \
@com_google_googleapis//google/rpc:status_proto \
@com_google_googleapis//google/rpc:error_details_cc_proto \
@com_google_googleapis//google/rpc:error_details_proto \
@com_google_googleapis//google/rpc:code_cc_proto \
@com_google_googleapis//google/rpc:code_proto \
@com_github_grpc_grpc//src/compiler:grpc_python_plugin
ENV PYTHON_PACKAGE_BASE /output/usr/local/lib/python2.7/dist-packages
RUN ./bazel-out/host/bin/external/com_google_protobuf/protoc \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/v1/p4data.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/v1/p4runtime.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/config/v1/p4info.proto \
./bazel-stratum/external/com_github_p4lang_p4runtime/p4/config/v1/p4types.proto \
./bazel-stratum/external/com_google_googleapis/google/rpc/status.proto \
./bazel-stratum/external/com_google_googleapis/google/rpc/code.proto \
-I./bazel-stratum/external/com_google_googleapis -I./bazel-stratum/external/com_github_p4lang_p4runtime \
-I./bazel-stratum/external/com_google_protobuf/src \
--python_out $PYTHON_PACKAGE_BASE --grpc_out $PYTHON_PACKAGE_BASE \
--plugin=protoc-gen-grpc=./bazel-bin/external/com_github_grpc_grpc/src/compiler/grpc_python_plugin
RUN touch $PYTHON_PACKAGE_BASE/p4/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/v1/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/config/__init__.py && \
touch $PYTHON_PACKAGE_BASE/p4/config/v1/__init__.py && \
touch $PYTHON_PACKAGE_BASE/google/__init__.py && \
touch $PYTHON_PACKAGE_BASE/google/rpc/__init__.py
# Install a version of the protobuf and grpc python bindings that is
# compatible to that used to generate the P4Runtime ones.
ARG PROTOBUF_VER=3.14.0
ARG GRPC_VER=1.33.2
RUN pip install --root /output "protobuf<=${PROTOBUF_VER}"
RUN pip install --root /output "grpcio<=${GRPC_VER}"

@yhx-coder
Copy link
Author

yhx-coder commented Jul 11, 2022

thanks. I try to follow the Dockerfile.build, the previous error is fixed.However, another error happens: stratum_bmv2: undefined symbol: _pi_port_status_get.Now I guess the the reason is that I don't build the bmv2 or pi correcttly. It's a little difficult for me :( .I decide to use the docker. thanks for your support.

@pudelkoM
Copy link
Member

Sorry to hear that. Getting the PI and bmv2 setup right is indeed tricky. That's why we're relying on docker images for it.
I hope you can solve your use case with docker.

If there is anything else, feel free to re-open this issue or create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants