matanui159 / ReplaySorcery

An open-source, instant-replay solution for Linux
GNU General Public License v3.0
854 stars 27 forks source link

Having trouble compiling on Ubuntu 20.10 #91

Closed CHJ85 closed 3 years ago

CHJ85 commented 3 years ago

Hi there. Could you please help me figure out what the problem here is? When I run "cmake CMakeLists.txt", it spits out a bunch of errors. Here's my cmake errors log file.

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_99b6f/fast && /usr/bin/gmake -f CMakeFiles/cmTC_99b6f.dir/build.make CMakeFiles/cmTC_99b6f.dir/build
gmake[1]: Entering directory '/home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_99b6f.dir/src.c.o
/usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_99b6f.dir/src.c.o   -c /home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_99b6f
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_99b6f.dir/link.txt --verbose=1
/usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_99b6f.dir/src.c.o  -o cmTC_99b6f 
/usr/bin/ld: CMakeFiles/cmTC_99b6f.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
gmake[1]: *** [CMakeFiles/cmTC_99b6f.dir/build.make:87: cmTC_99b6f] Error 1
gmake[1]: Leaving directory '/home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:121: cmTC_99b6f/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;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_4395a/fast && /usr/bin/gmake -f CMakeFiles/cmTC_4395a.dir/build.make CMakeFiles/cmTC_4395a.dir/build
gmake[1]: Entering directory '/home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_4395a.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_4395a.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_4395a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4395a.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_4395a.dir/CheckFunctionExists.c.o  -o cmTC_4395a  -lpthreads 
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_4395a.dir/build.make:87: cmTC_4395a] Error 1
gmake[1]: Leaving directory '/home/chris/Downloads/ReplaySorcery-master/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:121: cmTC_4395a/fast] Error 2

Thanks in advance.

matanui159 commented 3 years ago

For some reason it can't find pthreads on your system. Can you make sure that they are installed? Maybe try installing build-essential?

CHJ85 commented 3 years ago

@matanui159 Build-essential is already installed. I thought it'd be a missing package. That's why this error didn't make sense to me.

CovERUshKA commented 3 years ago

Solved. Download libbacktrace and place it in dep/libbacktrace folder.

matanui159 commented 3 years ago

Did you run git submodule update --init? That should already do that.

CHJ85 commented 3 years ago

I'll just wait for it to be added to the main repo or a deb or flatpak package. Thanks anyway guys, but this whole compiling thing is a bit scary.

matanui159 commented 3 years ago

I'll close this for now