Cmake 无法解析 VILLASframework 的依赖关系

问题描述 投票:0回答:1

我尝试在 Ubuntu 20.04 LTS 上安装以下应用程序: https://villas.fein-aachen.org/doc/node-installation.html.

所有必需的软件包似乎已安装并更新为最新版本。 不幸的是,当我运行

cmake ..
时,它返回以下错误:

```-- The C compiler identification is GNU 9.3.0 
   -- The CXX compiler identification is GNU 9.3.0
   -- Detecting C compiler ABI info
   -- Detecting C compiler ABI info - done
   -- Check for working C compiler: /usr/bin/cc - skipped
   -- Detecting C compile features
   -- Detecting C compile features - done
   -- Detecting CXX compiler ABI info
   -- Detecting CXX compiler ABI info - done
   -- Check for working CXX compiler: /usr/bin/c++ - skipped
   -- Detecting CXX compile features
   -- Detecting CXX compile features - done
   -- Looking for pthread.h
   -- Looking for pthread.h - found
   -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
   -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
   -- Looking for pthread_create in pthreads
   -- Looking for pthread_create in pthreads - not found
   -- Looking for pthread_create in thread
   -- Looking for pthread_create in pthread - found
   -- Found Threads: TRUE  
   -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
   -- Looking for sys/eventfd.h
   -- Looking for sys/eventfd.h - found
   -- Looking for semaphore.h
   -- Looking for semaphore.h - found
   -- Looking for sys/mman.h
   -- Looking for sys/mman.h - found
   -- Found OpenMP_C: -fopenmp (found version "4.5") 
   -- Found OpenMP_CXX: -fopenmp (found version "4.5") 
   -- Found OpenMP: TRUE (found version "4.5")  
   -- Could NOT find Opal (missing: OPAL_LIBRARY OPAL_LIBRARY_UTILS OPAL_LIBRARY_CORE OPAL_LIBRARY_IRC OPAL_INCLUDE_DIR) 
  -- Found IBVerbs: /usr/lib/x86_64-linux-gnu/libibverbs.so  
  -- Found RDMACM: /usr/lib/x86_64-linux-gnu/librdmacm.so  
  -- Found Etherlab: /usr/local/lib/libethercat.so  
  -- Found Lua: /usr/lib/x86_64-linux-gnu/liblua5.3.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "5.3.3") 
  -- Checking for module 'jansson>=2.9'
  -- Found jansson, version 2.12
  -- Checking for module 'libwebsockets>=2.3.0'
  -- Found libwebsockets, version 4.0.22
  -- Checking for module 'protobuf>=2.6.0'
  -- Found protobuf, version 3.6.1
  -- Checking for module 'libprotobuf-c>=1.1.0'
  -- Found libprotobuf-c, version 1.3.3
  -- Checking for module 'criterion>=2.3.1'
  -- Found criterion, version 2.3.3
  -- Checking for module 'libnl-route-3.0>=3.2.27'
  -- Found libnl-route-3.0, version 3.4.0
  -- Checking for module 'libiec61850>=1.3.1'
  -- Found libiec61850, version 1.4.3
  -- Checking for module 'libconfig>=1.4.9'
  -- Found libconfig, version 1.5
  -- Checking for module 'libmosquitto>=1.6.9'
  -- Found libmosquitto, version 1.6.9
  -- Checking for module 'rdkafka>=1.5.0'
  -- Found rdkafka, version 1.6.0
  -- Checking for module 'hiredis>=1.0.0'
  -- Found hiredis, version 1.0.0
  -- Checking for module 'redis++>=1.2.0'
  -- Found redis++, version 1.2.3
  -- Checking for module 'librabbitmq>=0.8.0'
  -- Found librabbitmq, version 0.10.0
  -- Checking for module 'comedilib>=0.11.0'
  -- Found comedilib, version 0.11.0
  -- Checking for module 'libzmq>=2.2.0'
  -- Found libzmq, version 4.3.2
  -- Checking for module 'libuldaq>=1.0.0'
  -- Found libuldaq, version 1.2.0
  -- Checking for module 'uuid>=2.23'
  -- Found uuid, version 2.34.0
  -- Checking for module 'libcgraph>=2.30'
  -- Found libcgraph, version 2.49.0
  -- Checking for module 'libgvc>=2.30'
  -- Found libgvc, version 2.49.0
  -- Checking for module 'libusb-1.0>=1.0.23'
  -- Found libusb-1.0, version 1.0.23
  -- Checking for module 'libxil'
  -- Found libxil, version 1.0.0
  -- Checking for module 'nanomsg'
  -- Found nanomsg, version 1.1.5
  -- Checking for module 're>=0.5.6'
  -- No package 're' found
  -- Checking for module 'libre>=0.5.6'
  -- Found libre, version 0.6.0
  -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "1.1.1f", minimum required is "1.0.0")  
  -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found suitable version "7.68.0", minimum required is "7.29")  
  -- Could NOT find Criterion (missing: CRITERION_LIBRARY) 
  -- Checking for module 'jansson>=2.7'
  -- Found jansson, version 2.12
  CMake Error at CMakeLists.txt:225 (add_subdirectory):
  The source directory

   /home/lab/VILLASnode/fpga

   does not contain a CMakeLists.txt file.
   ```

不幸的是,此后我无法完成安装。日志文件返回给我:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/lab/VILLASnode/build/CMakeFiles/CMakeTmp

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

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

如何解决这个问题? (pthread和libc6已正确安装)

提前感谢您的任何建议!

linux cmake package pthreads
1个回答
0
投票

/home/lab/VILLASnode/fpga

不包含 CMakeLists.txt 文件

sudo apt install gcc g++ pkg-config make cmake ninja-build protobuf-compiler protobuf-c-compiler autoconf libtool texinfo git mercurial curl flex bison xmlto doxygen dia graphviz libssl-dev libprotobuf-dev libprotobuf-c-dev uuid-dev libconfig-dev libnl-3-dev libnl-route-3-dev libcurl4-openssl-dev  libjansson-dev libzmq3-dev libnanomsg-dev  librabbitmq-dev libmosquitto-dev libcomedi-dev libibverbs-dev librdmacm-dev libre-dev libspdlog-dev libfmt-dev libusb-1.0-0-dev liblua5.3-dev librdkafka-dev

https://villas.fein-aachen.org/doc/node-installation.html并不完美。

git clone https://git.rwth-aachen.de/acs/public/villas/node.git VILLASnode
cd VILLASnode/                
git submodule update --init --recursive   
   # will provide {fpga/, common/ files} with some Ubuntu 20.04 OS

   ## When missing, then clone fpga and common
git submodule update --init common         
git submodule update --init fpga        # OK
    
sudo bash packaging/deps.sh

cd build/ && cmake ..
make
[100%] Linking CXX executable unit-tests
[100%] Built target unit-tests
© www.soinside.com 2019 - 2024. All rights reserved.