google / libprotobuf-mutator

Library for structured fuzzing with protobuffers
Apache License 2.0
566 stars 110 forks source link

error: use of undeclared identifier 'absl' #247

Open Microsvuln opened 1 month ago

Microsvuln commented 1 month ago

Following the installation I have the problem with absl :

[4/16] Performing configure step for 'external.googletest'
loading initial cache file /home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/build/external.googletest/tmp/external.googletest-cache-Debug.cmake
-- The C compiler identification is Clang 14.0.0
-- The CXX compiler identification is Clang 14.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
-- 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
-- Found Python3: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/build/external.googletest/src/external.googletest-build
[5/16] Building CXX object src/CMakeFiles/protobuf-mutator.dir/mutator.cc.o
FAILED: src/CMakeFiles/protobuf-mutator.dir/mutator.cc.o 
/usr/bin/clang++  -I/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator -I/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/build -I/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/build/external.googletest/include -fno-exceptions -Werror -Wall -Wstring-conversion -g -std=c++14  -fsanitize-coverage=0 -MD -MT src/CMakeFiles/protobuf-mutator.dir/mutator.cc.o -MF src/CMakeFiles/protobuf-mutator.dir/mutator.cc.o.d -o src/CMakeFiles/protobuf-mutator.dir/mutator.cc.o -c /home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/mutator.cc
In file included from /home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/mutator.cc:27:
/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/field_instance.h:193:50: error: no member named 'requires_utf8_validation' in 'google::protobuf::FieldDescriptor'
  bool EnforceUtf8() const { return descriptor_->requires_utf8_validation(); }
                                    ~~~~~~~~~~~  ^
/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/field_instance.h:198:21: error: use of undeclared identifier 'absl'
    std::string s = absl::StrCat(*descriptor_);
                    ^
/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/field_instance.h:199:29: error: use of undeclared identifier 'absl'
    if (is_repeated()) s += absl::StrCat("[", index_, "]");
                            ^
/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/field_instance.h:200:26: error: use of undeclared identifier 'absl'
    return s + " of\n" + absl::StrCat(*message_);
                         ^
/home/user/test/libwebp-new/proto-fuzzing/libprotobuf-mutator/src/mutator.cc:804:37: error: use of undeclared identifier 'absl'
  std::cerr << "Uninitialized: " << absl::StrCat(message) << "\n";
                                    ^
5 errors generated.
[6/16] Performing build step for 'external.googletest'
[1/8] Building CXX object googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[2/8] Building CXX object googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[3/8] Building CXX object googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[4/8] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[5/8] Linking CXX static library lib/libgtest.a
[6/8] Linking CXX static library lib/libgtest_main.a
[7/8] Linking CXX static library lib/libgmock.a
[8/8] Linking CXX static library lib/libgmock_main.a
ninja: build stopped: subcommand failed.

Any ideas how to solve this ?

hawkinsw commented 1 month ago

See my comment in the other thread! I think that the fix will help you!

hawkinsw commented 1 month ago

If you are using the library as an external project in CMake, here is how I integrated it:

ExternalProject_Add(protobuf 
  SOURCE_DIR "${CMAKE_SOURCE_DIR}/libprotobuf-mutator" 
  INSTALL_DIR ${CMAKE_BINARY_DIR} 
  CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_PREFIX}"
  CMAKE_CACHE_ARGS "-DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF:STRING=On")