I am trying to integrate the Drake simulation for OpenSUSE. I have created this GitHub repository with a OpenSUSE 15.4 docker file in it and tried to run in the Docker image the following build steps in the Drake repository:
dan@d10fea7706bb:~/drake/cmake> cmake ..
dan@d10fea7706bb:~/drake/cmake> make install
.I get the following error
ERROR: Traceback (most recent call last):
File "/home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/external/mumps_internal/BUILD.bazel", line 9, column 16, in <toplevel>
hdrs = glob([
Error in glob: glob pattern 'include/**' didn't match anything, but allow_empty is set to False (the default value of allow_empty can be set with --incompatible_disallow_empty_glob).
ERROR: /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/external/ipopt_internal_fromsource/BUILD.bazel:347:16: no such target '@mumps_internal//:dmumps_seq': target 'dmumps_seq' not declared in package '' defined by /home/dan/.cache/bazel/_bazel_/7ea85213ca47cc67b02970ecea7788b3/external/mumps_internal/BUILD.bazel (Tip: use `query "@mumps_internal//:*"` to see all the targets in that package) and referenced by '@ipopt_internal_fromsource//:ipopt'
This is the Dockerfile I used (also viewable in the GitHub repository)
# Use OpenSUSE Leap 15.4 as base
FROM opensuse/leap:15.4
# Install vim, sudo, and other necessary tools and libraries for drake
RUN zypper --non-interactive update && \
zypper --non-interactive install -y vim sudo git cmake make java-1_8_0-openjdk-devel \
glib2-devel lapack-devel libX11-devel ocl-icd-devel opencl-headers patch patchelf \
pkg-config python3-devel python3-pygame zlib-devel pkg-config libfmt8 eigen3-devel \
libmumps5 mumps-devel gcc-fortran nasm
# Add the repository for newer GCC versions, install GCC 9, and set it as default
RUN zypper addrepo -f http://download.opensuse.org/repositories/devel:/gcc/openSUSE_Leap_15.3/ devel_gcc && \
zypper --non-interactive --gpg-auto-import-keys refresh && \
zypper --non-interactive install -y gcc9 gcc9-c++ && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9
# Clone, build, and install fmt and spdlog from source
RUN cd /tmp && \
git clone https://github.com/fmtlib/fmt.git && \
cd fmt && mkdir build && cd build && cmake .. && make install && \
cd /tmp && \
git clone https://github.com/gabime/spdlog.git && \
cd spdlog && mkdir build && cd build && cmake .. && make install
# Install Bazelisk
RUN curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.5/bazelisk-linux-amd64 > /usr/local/bin/bazelisk && \
chmod +x /usr/local/bin/bazelisk && \
ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
# Create .pc files for LAPACK and BLAS
RUN echo -e "prefix=/usr\nexec_prefix=\${prefix}\nlibdir=\${exec_prefix}/lib64\nincludedir=\${prefix}/include\n\nName: LAPACK\nDescription: Linear Algebra Package\nVersion: 3.9.0\nLibs: -L\${libdir} -llapack\nCflags: -I\${includedir}" > /usr/share/pkgconfig/lapack.pc && \
echo -e "prefix=/usr\nexec_prefix=\${prefix}\nlibdir=\${exec_prefix}/lib64\nincludedir=\${prefix}/include\n\nName: BLAS\nDescription: Basic Linear Algebra Subprograms\nVersion: 3.9.0\nLibs: -L\${libdir} -lblas\nCflags: -I\${includedir}" > /usr/share/pkgconfig/blas.pc
# Set up the environment for user 'dan'
RUN groupadd -r dan && \
useradd -m -s /bin/bash -r -g dan dan && \
mkdir -p /home/dan/drake && \
chown -R dan:dan /home/dan/drake && \
echo "dan ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Switch to user 'dan' before installing pyenv and Python
USER dan
ENV HOME /home/dan
WORKDIR $HOME
# Install dependencies for pyenv and Python build
RUN sudo zypper --non-interactive install -y git gcc make zlib-devel libbz2-devel libopenssl-devel readline-devel sqlite3-devel tar gzip
# Install pyenv and Python 3.10
RUN git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv && \
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.bashrc && \
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $HOME/.bashrc && \
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\nfi' >> $HOME/.bashrc && \
/bin/bash -c "source $HOME/.bashrc && pyenv install 3.10.0 && pyenv global 3.10.0"
# Set environment variables for GCC to ensure Bazel uses the correct version
ENV CC=/usr/bin/gcc-9
ENV CXX=/usr/bin/g++-9
ENV PYENV_ROOT $HOME/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
As you can see from the file, I have libmumps5
and mumps-devel
installed. I am not sure how to deal with an error in an external BUILD.bazel
file.
git clone https://github.com/hedaniel7/Drake-OpenSUSE-Integration
cd Drake-OpenSUSE-Integration
git checkout f0bc814fd00f07a0a686ccf1509022a4719d484b
docker-compose build --no-cache
(took 560 sec for me on Surfacebook 3, Ubuntu 22.04)docker-compose run drake-opensuse
The mumps repo logic https://github.com/RobotLocomotion/drake/blob/master/tools/workspace/mumps_internal/repository.bzl assumes the headers live in /usr/include (hard coded); it doesn't use pkg-config. If SUSE has a different path for those headers, Drake's repo logic will need to be adjusted for the new path.
Or to skip building IPOPT for now, you could place the line build --define=NO_IPOPT=ON
in the file $HOME/.bazelrc
and it won't try to use MUMPS anymore.
I haven't tried the repro instructions (yet), but that's my first guess.