bytedance / sonic-cpp

A fast JSON serializing & deserializing library, accelerated by SIMD.
Apache License 2.0
835 stars 101 forks source link

Error when trying to build Fuzz -DBUILD_FUZZ=ON #90

Closed ishuah closed 2 months ago

ishuah commented 2 months ago

I'm trying to build the fuzz code:

cmake -S . -B build -DBUILD_FUZZ=ON

The command fails with the following output:

-- The CXX compiler identification is Clang 18.1.8
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-18 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.22/Modules/ExternalProject.cmake:2806 (message):
  At least one entry of URL is a path (invalid in a list)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/ExternalProject.cmake:3716 (_ep_add_download_command)
  CMakeLists.txt:15 (ExternalProject_Add)

-- Configuring incomplete, errors occurred!
See also "/home/ishuah/workshop/fuzzing-experiment/sonic-cpp/build/_deps/googletest-subbuild/CMakeFiles/CMakeOutput.log".

CMake Error at /usr/share/cmake-3.22/Modules/FetchContent.cmake:1075 (message):
  CMake step for googletest failed: 1
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FetchContent.cmake:1216:EVAL:2 (__FetchContent_directPopulate)
  /usr/share/cmake-3.22/Modules/FetchContent.cmake:1216 (cmake_language)
  /usr/share/cmake-3.22/Modules/FetchContent.cmake:1259 (FetchContent_Populate)
  tests/CMakeLists.txt:22 (FetchContent_MakeAvailable)

-- Configuring incomplete, errors occurred!
See also "/home/ishuah/workshop/fuzzing-experiment/sonic-cpp/build/CMakeFiles/CMakeOutput.log".
ishuah commented 2 months ago

Following this StackOverflow solution - https://stackoverflow.com/a/75007891 - I managed to resolve the issue.

I had to swap the URL declaration and the DOWNLOAD_EXTRACT_TIMESTAMP declaration in tests/CMakeLists.txt. The error happens because DOWNLOAD_EXTRACT_TIMESTAMP is appended to the URL. This swap addresses that issue.

liuq19 commented 2 months ago

Thanks