Powerpc64le build failure, GCC=4.8.5, Python=4.8.5, cmake=3.19.2, make=3.82

I attempted to install multiple tagged versions of opencv with the goal of having a Python3 module for my project. Every version which I have tried fails to build with the same error.

I’m considering filing a bug report, but figured I should reach out here first in case I’ve got something wrong.

system info:
OS=Linux RHEL 7.6
Arch=powerpc64le - IBM Power9
GCC=4.8.5
Python=4.8.5
cmake=3.19.2
make=3.82

I’m on a system where I do not have admin rights, and system software can not be upgraded. I can install some software locally, and have a local version of Python3 and cmake.

When I build, I get a compile error.
To reproduce:

git clone https://github.com/opencv/opencv.git
cd opencv
git checkout tags/4.5.1    #I have tried many versions all the way back to 2.4, all similar results
mkdir build
cd build
cmake \
-DBUILD_opencv_python=ON \
-DBUILD_NEW_PYTHON_SUPPORT=ON \
-DBUILD_opencv_python3=ON \
-DHAVE_opencv_python3=ON \
-DCMAKE_INSTALL_PREFIX=/ccs/home/dsysko/summit/opencv_3 \
-DWITH_JPEG=ON \
-DWITH_OPENCL=ON \
-DWITH_OPENMP=ON \
-DWITH_PTHREADS_PF=OFF \
-DCMAKE_C_FLAGS="-mcpu=powerpc64le \
-mtune=powerpc64le" \
-DCMAKE_CXX_FLAGS="-mcpu=powerpc64le \
-mtune=powerpc64le" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_C_COMPILER=$(which gcc) \
-DCMAKE_CXX_COMPILER=$(which g++) \
-DPYTHON_DEFAULT_EXECUTABLE=$(which python3) \
-DPYTHON3_EXECUTABLE=$(which python3) \
-DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON3_LIBRARY=$(python3 -c "from distutils.sysconfig import get_config_var;from os.path import dirname,join ; print(join(dirname(get_config_var('LIBPC')),get_config_var('LDLIBRARY')))") \
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(python3 -c "import numpy; print(numpy.get_include())") \
-DPYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..

The error:

[  3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o
cd /ccs/home/dsysko/git_projects/opencv/build/modules/core && /usr/bin/g++     -DCVAPI_EXPORTS -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int -DOPENCV_WITH_ITT=1 -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/ccs/home/dsysko/git_projects/opencv/build -I/ccs/home/dsysko/git_projects/opencv/modules/core/include -I/ccs/home/dsysko/git_projects/opencv/build/modules/core -I/ccs/home/dsysko/git_projects/opencv/3rdparty/include/opencl/1.2 -I/ccs/home/dsysko/git_projects/opencv/3rdparty/ittnotify/include -mcpu=powerpc64le -mtune=powerpc64le   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-comment -Wno-missing-field-initializers -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mcpu=power8 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG  -DNDEBUG -fPIC -std=c++11 -o CMakeFiles/opencv_core.dir/src/algorithm.cpp.o -c /ccs/home/dsysko/git_projects/opencv/modules/core/src/algorithm.cpp
            In file included from /ccs/home/dsysko/git_projects/opencv/modules/core/include/opencv2/core/hal/intrin.hpp:221:0,
                             from /ccs/home/dsysko/git_projects/opencv/modules/core/src/precomp.hpp:85,
                             from /ccs/home/dsysko/git_projects/opencv/modules/core/src/algorithm.cpp:43:
            /ccs/home/dsysko/git_projects/opencv/modules/core/include/opencv2/core/hal/intrin_vsx.hpp: In function 'cv::hal_baseline::v_int32x4 cv::hal_baseline::v_lut(const int*, const cv::hal_baseline::v_int32x4&)':
            /ccs/home/dsysko/git_projects/opencv/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:1239:34: sorry, unimplemented: unexpected AST of kind compound_literal_expr
                     vec_extract(idxvec.val, 0),
                                              ^
            /ccs/home/dsysko/git_projects/opencv/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:1239: confused by earlier errors, bailing out

congrats, your compiler can’t handle the code. what version of GCC do you have? OpenCV requires C++11 or C++14 or something along those lines.

edit: nevermind, you stated 4.8.5. that’s way too old. you’ll have to get/build a newer GCC.

I do doubt that you have python 4.8.5 :smiley:

Whoops, right. Python 3.9.1

Bummer about the GCC version.
I’ll see if the admins have another option.

you can “install” GCC per-user as far as I know. if you have to, you can even build GCC.

this might help you judge what version might be good enough… I think GCC 5 might be enough but maybe not
https://gcc.gnu.org/projects/cxx-status.html

I also found this, which matches your error message: