O2 build failing on Ubuntu 16.04

Dear experts,

I have currently problems to build o2 on Ubuntu 16.04. In fact the build of o2 at the end fails with

CMake Error at cmake/modules/CheckCXX14Features.cmake:93 (message):
Checking C++14 support for “make_unique”: not supported
Call Stack (most recent call first):
cmake/modules/CheckCXX14Features.cmake:99 (cxx14_check_feature)
CMakeLists.txt:154 (include)

alidist and O2 are up to date.
Any help would be highly appreciated
Thanks & best,
Andi

Which compiler do you have there? What’s aliDoctor report?

Dear Giulio,
thanks for you reply.

The report by aliDoctor looks OK to me

==> The following packages will be picked up from the system:

- Python-modules
- lzma
- FreeType
- libxml2
- zlib
- OpenSSL
- yaml-cpp
- nanomsg
- libpng
- autotools
- GSL

If this is not you want, you have to uninstall / unload them.

==> The following packages will be built by aliBuild because they couldn’t be picked up from the system:

- Vc
- CMake
- protobuf
- SWIG
- flatbuffers
- GCC-Toolchain
- msgpack
- ZeroMQ
- boost

Hence, the compiler should be built by aliBuild itself, right? In that case it’s GCC-Toolchain@v7.3.0-alice1
Thanks & best,
Andi

Indeed aliDoctor looks fine. Can you get hold of the command which actually fails from the logs? GCC 7.3.0 should be more than ok to compile O2. I wonder if the tests are not actually (mistakenly) using the system compiler. Does any of the CMake feature tests actually work?

Looking at the CMakeError.log, it looks like the failing command is

/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/cc -fPIC -g -O2 -o CMakeFiles/cmTC_1497f.dir/CheckSymbolExists.c.o -c /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp/CheckSymbolExists.c

Looking at the CMakeOutput.log, I find e.g. something like this, which to me indicates that some of the CMake feature tests did indeed work

Run Build Command:"/usr/bin/make" "cmTC_aa56e/fast"
/usr/bin/make -f CMakeFiles/cmTC_aa56e.dir/build.make CMakeFiles/cmTC_aa56e.dir/build
make[1]: Entering directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_aa56e.dir/src.cxx.o
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/c++    -fPIC -g -O2 -std=c++11 -Dcheck_cxx_compiler_flag__Wabi   -Wabi -o CMakeFiles/cmTC_aa56e.dir/src.cxx.o -c /home/\
amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTC_aa56e
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/CMake/v3.11.0-1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_aa56e.dir/link.txt --verbose=1
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/c++  -fPIC -g -O2 -std=c++11 -Dcheck_cxx_compiler_flag__Wabi    -rdynamic CMakeFiles/cmTC_aa56e.dir/src.cxx.o  -o cmTC_\
aa56e
make[1]: Leaving directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'

Source file was:
#include <cstdio>
      int main() { return 0; }
Performing C++ SOURCE FILE Test check_cxx_compiler_flag__fabi_version_0 succeeded with the following output:
Change Dir: /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp

Unfortunately I cannot make much sense of the full CMakeError, but to me it looks like GCC 7.3.0 is actually used for the compilation. Please find below the full content of the CMakeError.log

Determining if the pthread_create exist failed with the following output:
Change Dir: /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_1497f/fast"
/usr/bin/make -f CMakeFiles/cmTC_1497f.dir/build.make CMakeFiles/cmTC_1497f.dir/build
make[1]: Entering directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_1497f.dir/CheckSymbolExists.c.o
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/cc   -fPIC -g -O2    -o CMakeFiles/cmTC_1497f.dir/CheckSymbolExists.c.o   -c /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_1497f
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/CMake/v3.11.0-1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1497f.dir/link.txt --verbose=1
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/cc -fPIC -g -O2     -rdynamic CMakeFiles/cmTC_1497f.dir/CheckSymbolExists.c.o  -o cmTC_1497f 
CMakeFiles/cmTC_1497f.dir/CheckSymbolExists.c.o: In function `main':
/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8: undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_1497f.dir/build.make:86: recipe for target 'cmTC_1497f' failed
make[1]: *** [cmTC_1497f] Error 1
make[1]: Leaving directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_1497f/fast' failed
make: *** [cmTC_1497f/fast] Error 2

File /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_745ee/fast"
/usr/bin/make -f CMakeFiles/cmTC_745ee.dir/build.make CMakeFiles/cmTC_745ee.dir/build
make[1]: Entering directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_745ee.dir/CheckFunctionExists.c.o
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/cc   -fPIC -g -O2 -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_745ee.dir/CheckFunctionExists.c.o   -c /home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/CMake/v3.11.0-1/share/cmake-3.11/Modules/CheckFunctionExists.c
Linking C executable cmTC_745ee
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/CMake/v3.11.0-1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_745ee.dir/link.txt --verbose=1
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/cc -fPIC -g -O2 -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_745ee.dir/CheckFunctionExists.c.o  -o cmTC_745ee -lpthreads 
/home/amathis/Software/ALICE/sw/ubuntu1604_x86-64/GCC-Toolchain/v7.3.0-alice1-1/bin/../lib/gcc/x86_64-unknown-linux-gnu/7.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_745ee.dir/build.make:86: recipe for target 'cmTC_745ee' failed
make[1]: *** [cmTC_745ee] Error 1
make[1]: Leaving directory '/home/amathis/Software/ALICE/sw/BUILD/7496174b9f2ca770d835d633add5d69d9b656ff7/O2/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_745ee/fast' failed
make: *** [cmTC_745ee/fast] Error 2

Thanks again!

Looks like you are missing the build-essential package?

Can you try (as root):

apt-get install build-essential

and try again? Alternatively can you put the whole log somewhere and give me the link?

Unfortunately that did also not help,
build-essential is already the newest version (12.1ubuntu2).

I put all the logs here - please let me know in case you need further information
https://cernbox.cern.ch/index.php/s/JuwI0OOMhH7ZeOU

Many thanks!

Mmmm… and a dump of what env tells you as well, please.

I uploaded the file to cernbox

are you at CERN? If yes, can we meet tomorrow to debug this on your laptop?

Unfortunuately no, I am not based at CERN.
Do you have any idea what else to try?

Dear Giulio, I removed the sw folder and started the installation from scratch and now it worked.
Thanks for your help!