CMake build doesn't work on Ubuntu in VM
I'm trying to build Halide from sources. Platform is Ubuntu (XUbuntu) 16.04.2 LTS, in VMware on Mac. llvm and clang are 4.0.1, built from the sources. When building with cmake (version 3.5.1), using
cd Halide; mkdi build_cmake; cd build_cmake cmake -DLLVM_DIR=/path-to-llvm-build/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_VERSION=40 ..
towards the end the compilation fails with
Scanning dependencies of target pipeline_native.exec_generator [ 97%] Executing Generator pipeline.generator with args -o;/home/metadev/Halide/cmake_build/generator_genfiles/pipeline_native;-f;pipeline_native;-e;static_library,h;target=host... /home/metadev/Halide/cmake_build/generator_genfiles/pipeline_c/pipeline_c.cpp: In instantiation of ‘static NativeVector<ElementType_, Lanes_>::NativeVectorType NativeVector<ElementType_, Lanes_>::splat(const ElementType&) [with ElementType_ = int; long unsigned int Lanes_ = 8ul; NativeVector<ElementType_, Lanes_>::NativeVectorType = vector(8) int; NativeVector<ElementType, Lanes>::ElementType = int]’: /home/metadev/Halide/cmake_build/generator_genfiles/pipeline_c/pipeline_c.cpp:2243:45: required from ‘static NativeVector<ElementType_, Lanes_>::Vec NativeVector<ElementType_, Lanes_>::broadcast(const ElementType&) [with ElementType_ = int; long unsigned int Lanes_ = 8ul; NativeVector<ElementType_, Lanes_>::Vec = NativeVector<int, 8ul>; NativeVector<ElementType_, Lanes_>::ElementType = int]’ /home/metadev/Halide/cmake_build/generator_genfiles/pipeline_c/pipeline_c.cpp:3158:34: required from here /home/metadev/Halide/cmake_build/generator_genfiles/pipeline_c/pipeline_c.cpp:2522:36: error: AVX vector return without AVX enabled changes the ABI [-Werror=psabi] inline static NativeVectorType splat(const ElementType &v) { ^ [ 97%] Built target pipeline_cpp_native.exec_generator Scanning dependencies of target camera_pipe.exec_generator [ 97%] Executing Generator camera_pipe.generator with args -o;/home/metadev/Halide/cmake_build/generator_genfiles/camera_pipe;target=host... cc1plus: all warnings being treated as errors apps/c_backend/CMakeFiles/pipeline_c.cpplib.dir/build.make:69: recipe for target 'apps/c_backend/CMakeFiles/pipeline_c.cpplib.dir///generator_genfiles/pipeline_c/pipeline_c.cpp.o' failed make[2]: *** [apps/c_backend/CMakeFiles/pipeline_c.cpplib.dir///generator_genfiles/pipeline_c/pipeline_c.cpp.o] Error 1 CMakeFiles/Makefile2:19854: recipe for target 'apps/c_backend/CMakeFiles/pipeline_c.cpplib.dir/all' failed make[1]: *** [apps/c_backend/CMakeFiles/pipeline_c.cpplib.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 97%] Built target bilateral_grid.exec_generator [ 97%] Built target pipeline_native.exec_generator [ 97%] Built target camera_pipe.exec_generator Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
Building with Makefile works OK.
Looks like one of the apps failed to build in C++-source mode due to a warning related to returning one of the compiler's native vector types without the appropriate flags set. I'm not convinced that using the compiler native vector types is really less of a headache than relying on autovectorization for small fixed-size loops. I'll do some tests.
Well, I'm convinced now. I couldn't persuade gcc 5.3 to vectorize any of those loops. I'll try to just avoid ever returning a native vector type.
Can we consider this fixed?
Closing because this is stale. We don't support LLVM 4 anymore.