mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.34k stars 852 forks source link

enclosing ‘parallel’ #532

Closed publicsite closed 4 years ago

publicsite commented 4 years ago

Hi, I'm trying to install opensfm by adapting the instructions given at https://github.com/paulinus/opensfm-docker-base/blob/master/Dockerfile.python3 for an ubuntu 19.10 rootfs.

#!/bin/sh

export DEBIAN_FRONTEND=noninteractive

apt-get update \
    && apt-get install -y \
        build-essential \
        cmake \
        git \
        libatlas-base-dev \
        libeigen3-dev \
        libgoogle-glog-dev \
        libopencv-dev \
        libsuitesparse-dev \
        python3-dev \
        python3-numpy \
        python3-opencv \
        python3-pip \
        python3-pyproj \
        python3-scipy \
        python3-yaml \
        curl \
        vim \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

mkdir -p /source && cd /source && \
    curl -L http://ceres-solver.org/ceres-solver-1.14.0.tar.gz | tar xz && \
    cd /source/ceres-solver-1.14.0 && \
    mkdir -p build && cd build && \
    cmake .. -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF && \
    make -j4 install && \
    cd / && rm -rf /source/ceres-solver-1.14.0

    mkdir -p /source && cd /source && \
    git clone https://github.com/paulinus/opengv.git && \
    cd /source/opengv && \
    git submodule update --init --recursive && \
    mkdir -p build && cd build && \
    cmake .. -DBUILD_TESTS=OFF \
             -DBUILD_PYTHON=ON \
             -DPYBIND11_PYTHON_VERSION=3.6 \
             -DPYTHON_INSTALL_DIR=/usr/local/lib/python3.6/dist-packages/ \
             && \
    make install && \
    cd / && rm -rf /source/opengv

    pip3 install exifread==2.1.2 \
                 gpxpy==1.1.2 \
                 networkx==1.11 \
                 numpy \
                 pytest==3.0.7 \
                 python-dateutil==2.6.0 \
                 PyYAML==3.12 \
                 scipy \
                 xmltodict==0.10.2 \
                 loky \
                 repoze.lru

mkdir /source
cd /source
git clone --recursive https://github.com/mapillary/OpenSfM
cd OpenSfM
python3 setup.py build
cd doc
make livehtml

The build gets stuck on OpenSfM, because of problems with parallel in kmeans.c

In file included from /source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.h:21,
                 from /source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:363:
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c: In function ‘_vl_kmeans_quantize_f’:
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/mathop.h:92:37: error: ‘vl_infinity_d’ not specified in enclosing ‘parallel’
   92 | #define VL_INFINITY_D (vl_infinity_d.value)
      |                       ~~~~~~~~~~~~~~^~~~~~~
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:685:34: note: in expansion of macro ‘VL_INFINITY_D’
  685 |       TYPE bestDistance = (TYPE) VL_INFINITY_D ;
      |                                  ^~~~~~~~~~~~~
In file included from /source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:1782:
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:672:9: error: enclosing ‘parallel’
  672 | #pragma omp parallel default(none) \
      |         ^~~
In file included from /source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:1788:
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c: In function ‘_vl_kmeans_quantize_d’:
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:685:27: error: ‘vl_infinity_d’ not specified in enclosing ‘parallel’
  685 |       TYPE bestDistance = (TYPE) VL_INFINITY_D ;
/source/OpenSfM/opensfm/src/third_party/vlfeat/vl/kmeans.c:672:9: error: enclosing ‘parallel’
  672 | #pragma omp parallel default(none) \
      |         ^~~
make[2]: *** [CMakeFiles/vl.dir/build.make:271: CMakeFiles/vl.dir/third_party/vlfeat/vl/kmeans.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:148: CMakeFiles/vl.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
StefanoFrazzetto commented 4 years ago

For anyone who's experiencing the same issue, I managed to fix it by removing all the default(none) in kmeans.c. I'm not sure if this could cause any other issues though.

StefanoFrazzetto commented 4 years ago

Should be fixed by https://github.com/mapillary/OpenSfM/commit/01b5987496e974662a113731cc5bfa8d01ad00ec

paulinus commented 4 years ago

Thanks @StefanoFrazzetto. Fixed now.

majioa commented 4 years ago

For which version of opnemp the option was deprecated?