AntelopeIO/cdt

Error in building CDT 4.0.0

Closed this issue · 7 comments

I am trying to build tag 4.0.0. it throws an error as below. Can anyone help?

And here is the error in log file

cat CMakeError.log
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /tmp/cdt/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_8a13e/fast && /usr/bin/make -f CMakeFiles/cmTC_8a13e.dir/build.make CMakeFiles/cmTC_8a13e.dir/build
make[1]: Entering directory '/tmp/cdt/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_8a13e.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_8a13e.dir/src.c.o   -c /tmp/cdt/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_8a13e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8a13e.dir/link.txt --verbose=1
/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    CMakeFiles/cmTC_8a13e.dir/src.c.o  -o cmTC_8a13e 
/usr/bin/ld: CMakeFiles/cmTC_8a13e.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_8a13e.dir/build.make:87: cmTC_8a13e] Error 1
make[1]: Leaving directory '/tmp/cdt/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_8a13e/fast] Error 2


Source file was:
#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

it's working without leap blockchain. The error only happens when I've built with the build of leap blockchain to enable integration tests.

It looks like cmake is checking that the compiler can build a pthreads program, and finds that the default compiler cc can't.
What machine/os/compiler are you running this on?

@quocle108 can you ensure that build types match for both leap and cdt? if it still reproduces, please provide cmake command you use for both.
Here is what I use for debug:
leap: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 .. && make -j $(nproc)
cdt: cmake -DCMAKE_BUILD_TYPE=Debug -DTOOLS_BUILD_TYPE=Debug -DLIBS_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. && make -j $(nproc)

release:
leap: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/llvm-11 .. && make -j $(nproc)
cdt: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTOOLS_BUILD_TYPE=RelWithDebInfo -DLIBS_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. && make -j $(nproc)

you can safely use Release or RelWithDebInfo with each other but Debug only with Debug.

@greg7mdp @dimas1185

I am trying to build leap cdt-leap-v4.0.0 with wax-leap-v4.0.1wax01 in ubuntu 20.04 at this repo
Certainly! Here are the three scenarios:

Scenario 1:
When attempting to compile wax-leap with the following scripts:

    scripts/install_deps.sh     && 
    scripts/pinned_build.sh deps build $(nproc)

It throws an error related boost version, the script requires boost_1_70_0

Scenario 2:
To address the above issue, Boost_1_79_0 was replaced with Boost_1_70_0

However, with Boost_1_70_0, the new error occurs when the build integration test is enabled with leap_DIR as in my previous report. The error does not appear when leap_DIR is disabled. The build script responsible for this can be found here.

Scenario 3:
Currently, Boost_1_79_0 is being used again, but this time without the build scripts. Instead, the following build command is used in wax-leap:

    mkdir build &&                                                                                         \
    cd build &&                                                                                            \
    cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8                                              \
        -DCMAKE_PREFIX_PATH="$HOME/boost1.79;/usr/lib/llvm-7/"  -DCMAKE_BUILD_TYPE=Release .. &&           \
    make -j $(nproc) package

the build succeeds when using Boost_1_79_0 without build scripts.

So I see the issue comes from build scripts, which seem to be sticking to the Boost_1_70_0 version instead of using Boost_1_79_0.

Hi, are you trying to run CDT Integration tests with a pinned build of leap? That is not supported.

Hi, are you trying to run CDT Integration tests with a pinned build of leap? That is not supported.
Yea, i am. I see.

ok, the CDT integration tests can be run with a non-pinned version of leap. That is the supported path for testing.