flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.35k stars 415 forks source link

FCL Unable to Compile with gcc 13.2.0 #613

Closed nikoprotic closed 6 months ago

nikoprotic commented 6 months ago

I am trying to compile FCL with octomap in a debian bookworm docker container, running on an M1 macbook pro.

My docker container is set up to compile dependencies and FCL as follows:

ARG TARGET_PLATFORM=amd64
FROM --platform=${TARGET_PLATFORM} gcc:bookworm as base
ARG CMAKE_VERSION=3.26.4
ARG LIBCCD_COMMIT_HASH=7931e764a19ef6b21b443376c699bbc9c6d4fba8
ARG OCTOMAP_VERSION=1.9.6
ARG FCL_COMMIT_HASH=b03987c495b75b5d873f932b1ff3fc27c1494c87

RUN apt update
RUN apt install -y wget

# Install CMake from source to ensure correct version
WORKDIR /home/cmake
RUN curl -OL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-SHA-256.txt && \
    curl -OL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
    sha256sum -c --ignore-missing cmake-${CMAKE_VERSION}-SHA-256.txt

RUN tar -xf cmake-${CMAKE_VERSION}.tar.gz && \
    cd cmake-${CMAKE_VERSION} && \
    ./bootstrap --parallel=8 --system-curl && \
    gmake -j8 && \
    gmake -j8 install

WORKDIR /src
RUN rm -rf /home/cmake

# Install dependencies
RUN apt update
RUN apt install -y \
    libeigen3-dev \

# Install libccd, which is a dependency of FCL
# FCL repo mentions that libccd should be compiled from the head of the master branch rather than from the release
# archive, because there is a bugfix in the master branch that is not in the release archive.
WORKDIR /home/libccd
RUN git clone https://github.com/danfis/libccd.git
WORKDIR /home/libccd/libccd
RUN git checkout ${LIBCCD_COMMIT_HASH}
RUN mkdir /home/libccd/libccd/build
WORKDIR /home/libccd/libccd/build
RUN cmake .. \
    -G "Unix Makefiles" \
    -DENABLE_DOUBLE_PRECISION=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DCMAKE_INSTALL_PREFIX=/usr
RUN make -j8
RUN make -j8 install
WORKDIR /src
RUN rm -rf /home/libccd

# Install Octomap, which is a dependency of FCL
WORKDIR /home/octomap
RUN wget https://github.com/OctoMap/octomap/archive/refs/tags/v${OCTOMAP_VERSION}.tar.gz
RUN tar zxvf v${OCTOMAP_VERSION}.tar.gz
# debug: Compiling both octomap and octovis to see if that resolves build issues.
RUN mkdir /home/octomap/octomap-${OCTOMAP_VERSION}/build
WORKDIR /home/octomap/octomap-${OCTOMAP_VERSION}/build
RUN cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    # Need to specify build type for fcl to compile properly downstream.
    -DCMAKE_BUILD_TYPE=Release
RUN make -j8
RUN make -j8 install
WORKDIR /src
RUN rm -rf /home/octomap

# Now we can install FCL
WORKDIR /home/fcl
RUN git clone https://github.com/flexible-collision-library/fcl.git
WORKDIR /home/fcl/fcl
RUN git checkout ${FCL_COMMIT_HASH}
RUN mkdir /home/fcl/fcl/build
WORKDIR /home/fcl/fcl/build
RUN cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr\
RUN make -j8
RUN make -j8 install
WORKDIR /src
RUN rm -rf /home/fcl

I run the build with docker build . --build-arg TARGET_PLATFORM=arm64 --tag my_project:latest --target dev.

FCL compilation fails with a lot of [-Wmaybe-initialized] and [-Warray-bounds=] errors.

I tried applying the -Wno-maybe-initialized and -Wno-array-bounds= flags to my compilation to quiet gcc, but that didn't work, and also seems like I am opening myself up to security vulnerabilities if that's what it takes to compile FCL.