Samsung / UTopia

UT based automated fuzz driver generation
Apache License 2.0
159 stars 25 forks source link

cmake error on building UTopia #14

Closed frokaikan closed 1 year ago

frokaikan commented 1 year ago

I'm glad to use your significant framework. However, when build the project with mkdir build; cd build; cmake .. -GNinja cmake report like the following:

CMake Error in external/spdlog/CMakeLists.txt:
  Found relative path while evaluating include directories of "spdlog":

    "STATIC_INCLUDES-NOTFOUND"

CMake Error in lib/target_analysis/CMakeLists.txt:
  Found relative path while evaluating include directories of
  "ftgTargetAnalysis":

    "STATIC_INCLUDES-NOTFOUND"
...

What should I do to fix the problem? Thanks a lot.

sole2 commented 1 year ago

Hello @frokaikan. Thanks for using UTopia! Your problem seems that cmake can not find clang properly. Does clang installed? If this answer does not solve the problem, please share full output of cmake command and information of your environment for further investigation.

frokaikan commented 1 year ago

These days I tried to re-install LLVM & clang and recompile the project, but I still can not compile it... Here are the reports.

$ clang --version
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ export CC=clang
$ export CXX=clang++
$ mkdir build; cd build; cmake .. -GNinja
-- The CXX compiler identification is Clang 10.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- !!!NOT DEFINED LLVM_DIR, USE DEFAULT VALUE
-- !!!LLVM_DIR: /usr
-- Found LLVM 10.0.0
-- Using LLVMConfig.cmake in: /usr/lib/llvm-10/cmake
-- Linker detection: unknown
LLVM STATUS:
  Definitions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
  Includes    /usr/lib/llvm-10/include
              STATIC_INCLUDES-NOTFOUND;DYNAMIC_INCLUDES-NOTFOUND
  Libraries   /usr/lib/llvm-10/lib
  LLVM_CMAKE_DIR: /usr/lib/llvm-10/lib/cmake/llvm
  AddLLVM: 
-- Build spdlog: 1.10.0
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Build type: Release
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so (found version "3.6.1") 
-- The C compiler identification is Clang 10.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find Boost: missing: unit_test_framework (found /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0"))
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DYNAMIC_INCLUDES
...
STATIC_INCLUDES
...
CMake Error in external/spdlog/CMakeLists.txt:
  Found relative path while evaluating include directories of "spdlog":

    "STATIC_INCLUDES-NOTFOUND"

CMake Error in lib/target_analysis/CMakeLists.txt:
  Found relative path while evaluating include directories of
  "ftgTargetAnalysis":

    "STATIC_INCLUDES-NOTFOUND"

...
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
yuweol commented 1 year ago

Hello, Thanks for your interest.

We will investigate this issue. Anyway, how about using docker image to use UTopia? It would be easy way and you can find the usage here (https://github.com/Samsung/UTopia#docker).

frokaikan commented 1 year ago

Ok, I'll try the docker image these days. Thanks again.

sole2 commented 1 year ago

Found the cause is that cmake can not find clang headers. Please try installing clang develop package with apt install libclang-dev. Anyway using docker image will be the easiest way as @yuweol suggested.