shao-hua-li / CompDiff

33 stars 2 forks source link

fails to build with XCode 15 #2

Open BenWibking opened 3 months ago

BenWibking commented 3 months ago

With macOS 14 and XCode 15, I get the following compiler errors when attempting to build ./diff-build.sh:

$ CompDiff git:(main) ✗ ./diff-build.sh
[*] Compiling afl++ for OS Darwin on ARCH arm64
[!] Note: skipping x86 compilation checks (AFL_NO_X86 set).
[+] shmat seems to be working.
[-] You seem to need to install the package python3-dev, python2-dev or python-dev (and perhaps python[23]-apt), but it is optional so we continue
[+] Everything seems to be working, ready to compile.
clang -O3 -funroll-loops  -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-fuzz-bitmap.c src/afl-fuzz-cmplog.c src/afl-fuzz-extras.c src/afl-fuzz-init.c src/afl-fuzz-mutators.c src/afl-fuzz-one.c src/afl-fuzz-python.c src/afl-fuzz-queue.c src/afl-fuzz-redqueen.c src/afl-fuzz-run.c src/afl-fuzz-state.c src/afl-fuzz-stats.c src/afl-fuzz-statsd.c src/afl-fuzz.c src/diff-afl-forkserver.c src/diff-afl-fuzz-init.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-fuzz  -L/opt/homebrew/opt/qt@5/lib -lcrypto -lssl -lm
src/afl-fuzz-init.c:2634:19: warning: expression which evaluates to zero treated as a null pointer constant of type 'u8 *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
        laf_loc = '\0';
                  ^~~~
1 warning generated.
src/afl-fuzz-redqueen.c:1563:20: warning: variable 'cons_0' set but not used [-Wunused-but-set-variable]
  u8  cons_ff = 0, cons_0 = 0;
                   ^
1 warning generated.
src/afl-fuzz.c:1534:7: error: call to undeclared function 'pthread_set_qos_class_self_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  if (pthread_set_qos_class_self_np(QOS_CLASS_USER_INTERACTIVE, 0) != 0) {
      ^
1 error generated.
src/diff-afl-forkserver.c:54:10: fatal error: 'openssl/md5.h' file not found
#include <openssl/md5.h>
         ^~~~~~~~~~~~~~~
1 error generated.
src/diff-afl-fuzz-init.c:54:31: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
  for (int idx_com=0; idx_com < afl->diff_num; idx_com++) {
                      ~~~~~~~ ^ ~~~~~~~~~~~~~
src/diff-afl-fuzz-init.c:66:31: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
  for (int idx_com=0; idx_com < afl->diff_num; idx_com++) {
                      ~~~~~~~ ^ ~~~~~~~~~~~~~
2 warnings generated.
make: *** [afl-fuzz] Error 1
shao-hua-li commented 3 months ago

From the error message, it is an error occurring when compiling AFL++. I believe it is due to the clang version being too new, which treats previous warnings as errors.

Could you try to compile AFL++(https://github.com/AFLplusplus/AFLplusplus) directly on your setup and see if that works?

BenWibking commented 3 months ago

It partially builds:

(base) ➜  AFLplusplus git:(stable) gmake
[*] Compiling AFL++ for OS Darwin on ARCH arm64
[!] Note: skipping x86 compilation checks (AFL_NO_X86 set).
[+] shmat seems to be working.
[-] You seem to need to install the package python3-dev or python-dev (and perhaps python[3]-apt), but it is optional so we continue
[+] Everything seems to be working, ready to compile. (Apple clang version 15.0.0 (clang-1500.1.0.2.5))
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-common.c -o src/afl-common.o
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-sharedmem.c -o src/afl-sharedmem.o
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-forkserver.c -o src/afl-forkserver.o
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -Iinclude -c src/afl-performance.c -o src/afl-performance.o
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-fuzz-bitmap.c src/afl-fuzz-cmplog.c src/afl-fuzz-extras.c src/afl-fuzz-init.c src/afl-fuzz-mutators.c src/afl-fuzz-one.c src/afl-fuzz-python.c src/afl-fuzz-queue.c src/afl-fuzz-redqueen.c src/afl-fuzz-run.c src/afl-fuzz-skipdet.c src/afl-fuzz-state.c src/afl-fuzz-stats.c src/afl-fuzz-statsd.c src/afl-fuzz.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-fuzz  -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lm
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-showmap.c src/afl-fuzz-mutators.c src/afl-fuzz-python.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-showmap  -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-tmin.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-tmin -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-gotcpu.c src/afl-common.o -o afl-gotcpu -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-analyze.c src/afl-common.o src/afl-sharedmem.o src/afl-performance.o src/afl-forkserver.o -o afl-analyze -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
cc -O2   -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wno-pointer-arith -fPIC -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" src/afl-as.c -o afl-as -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
gmake -j -f GNUmakefile.llvm
gmake[1]: Entering directory '/Users/benwibking/AFLplusplus'
GNUmakefile.llvm:62: [!] llvm_mode needs llvm-config, which was not found. Set LLVM_CONFIG to its path and retry.
[+] llvm_mode detected llvm < 12, afl-lto LTO will not be build.
GNUmakefile.llvm:107: llvm_mode will not compile with Xcode clang...
GNUmakefile.llvm:127: we have trouble finding clang - llvm-config is not helping us
GNUmakefile.llvm:142: we have trouble finding clang++ - llvm-config is not helping us
gmake[1]: llvm-config: No such file or directory
clang -O3 -funroll-loops -fPIC -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DLLVM_BINDIR=\"\" -DVERSION=\"++4.10c\" -DLLVM_LIBDIR=\"\" -DLLVM_VERSION=\"\" -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"\" -DAFL_CLANG_LDPATH=\"\" -DAFL_CLANG_FUSELD=\"\" -DCLANG_BIN=\"clang\" -DCLANGPP_BIN=\"clang++\" -DUSE_BINDIR=0 -Wno-unused-function -fdebug-prefix-map="/Users/benwibking/AFLplusplus=llvm_mode" -Wno-deprecated -I/opt/homebrew/opt/qt@5/include -c src/afl-common.c -o instrumentation/afl-common.o -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
gmake[1]: llvm-config: No such file or directory
[+] shmat seems to be working.
clang -I -I./../include -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DLLVM_BINDIR=\"\" -DVERSION=\"++4.10c\" -DLLVM_LIBDIR=\"\" -DLLVM_VERSION=\"\" -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"\" -DAFL_CLANG_LDPATH=\"\" -DAFL_CLANG_FUSELD=\"\" -DCLANG_BIN=\"clang\" -DCLANGPP_BIN=\"clang++\" -DUSE_BINDIR=0 -Wno-unused-function -fdebug-prefix-map="/Users/benwibking/AFLplusplus=llvm_mode" -Wno-deprecated -I/opt/homebrew/opt/qt@5/include -O3 -Wno-unused-result -fPIC -c instrumentation/afl-compiler-rt.o.c -o afl-compiler-rt.o
gmake[1]: llvm-config: No such file or directory
gmake[1]: llvm-config: No such file or directory
[*] Building 32-bit variant of the runtime (-m32)... [*] Building 64-bit variant of the runtime (-m64)... clang: warning: argument unused during compilation: '-L/opt/homebrew/opt/qt@5/lib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib' [-Wunused-command-line-argument]
failed (that's fine)
gmake[1]: llvm-config: No such file or directory
clang -I -I./../include -O3 -funroll-loops -fPIC -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DLLVM_BINDIR=\"\" -DVERSION=\"++4.10c\" -DLLVM_LIBDIR=\"\" -DLLVM_VERSION=\"\" -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"\" -DAFL_CLANG_LDPATH=\"\" -DAFL_CLANG_FUSELD=\"\" -DCLANG_BIN=\"clang\" -DCLANGPP_BIN=\"clang++\" -DUSE_BINDIR=0 -Wno-unused-function -fdebug-prefix-map="/Users/benwibking/AFLplusplus=llvm_mode" -Wno-deprecated -I/opt/homebrew/opt/qt@5/include src/afl-cc.c instrumentation/afl-common.o -o afl-cc -DLLVM_MINOR= -DLLVM_MAJOR= -L/opt/homebrew/opt/qt@5/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -DCFLAGS_OPT=\"\" -lm
success!
gmake[1]: Leaving directory '/Users/benwibking/AFLplusplus'
[!] Note: skipping build tests (you may need to use LLVM or QEMU mode).
[+] Main compiler 'afl-cc' successfully built!
[-] LLVM mode for 'afl-cc'  failed to build, likely you either don't have llvm installed, or you need to set LLVM_CONFIG, to point to e.g. llvm-config-11. See instrumentation/README.llvm.md how to do this. Highly recommended!
[-] LLVM LTO mode for 'afl-cc'  failed to build, this would need LLVM 11+, see instrumentation/README.lto.md how to build it
[-] gcc_plugin for 'afl-cc'  failed to build, unless you really need it that is fine - or read instrumentation/README.gcc_plugin.md how to build it
[+] All done! Be sure to review the README.md - it's pretty short and useful.

WARNING: Fuzzing on MacOS X is slow because of the unusually high overhead of
fork() on this OS. Consider using Linux or *BSD for fuzzing software not
specifically for MacOS.

NOTE: If you can read this, your terminal probably uses white background.
This will make the UI hard to read. See docs/status_screen.md for advice.
gmake -C utils/aflpp_driver
gmake[1]: Entering directory '/Users/benwibking/AFLplusplus/utils/aflpp_driver'
cc -I. -I../../include -O3 -funroll-loops -g -fPIC -c aflpp_driver.c
aflpp_driver.c:235:22: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
    ssize_t length = syscall(SYS_read, fd, buf, MAX_FILE);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:748:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.
'libAFLDriver.a' -> '../../libAFLDriver.a'
cc -O3 -funroll-loops -g -fPIC -O0 -funroll-loops -c aflpp_qemu_driver.c
'libAFLQemuDriver.a' -> '../../libAFLQemuDriver.a'
Note: Optional aflpp_qemu_driver_hook.o not built.
Note: Optional aflpp_qemu_driver_hook.so not built.
gmake[1]: Leaving directory '/Users/benwibking/AFLplusplus/utils/aflpp_driver'

Build Summary:
[+] afl-fuzz and supporting tools successfully built
[-] LLVM mode could not be built, please install at least llvm-11 and clang-11 or newer, see docs/INSTALL.md
[-] LLVM mode could not be built, please install at least llvm-13 and clang-13 or newer, see docs/INSTALL.md
[-] LLVM LTO mode could not be built, it is optional, if you want it, please install LLVM and LLD 11+. More information at instrumentation/README.lto.md on how to build it
shao-hua-li commented 3 months ago

Could you try to install openssl on your machine with brew install openssl and rebuild CompDiff?

BenWibking commented 3 months ago

It's already installed:

$ AFLplusplus git:(dev) brew install openssl
Warning: openssl@3 3.2.1 is already installed and up-to-date.
To reinstall 3.2.1, run:
  brew reinstall openssl@3
shao-hua-li commented 3 months ago

It's already installed:

$ AFLplusplus git:(dev) brew install openssl
Warning: openssl@3 3.2.1 is already installed and up-to-date.
To reinstall 3.2.1, run:
  brew reinstall openssl@3

Then the error "fatal error: 'openssl/md5.h' file not found" should not be there. I only tested the tool on Linux distributions. Maybe you can try using a docker for that?

BenWibking commented 3 months ago

I can avoid the openssl error by adding the openssl include path to CFLAGS, but it still fails to compile due to the other error above:

CompDiff git:(main) ✗ env CFLAGS="-isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include" ./diff-build.sh
[*] Compiling afl++ for OS Darwin on ARCH arm64
[!] Note: skipping x86 compilation checks (AFL_NO_X86 set).
[+] shmat seems to be working.
[-] You seem to need to install the package python3-dev, python2-dev or python-dev (and perhaps python[23]-apt), but it is optional so we continue
[+] Everything seems to be working, ready to compile.
clang -isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-common.c -o src/afl-common.o
clang -isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-sharedmem.c -o src/afl-sharedmem.o
clang -isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -flto=full -c src/afl-forkserver.c -o src/afl-forkserver.o
clang -isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\" -Iinclude  -O3 -fno-unroll-loops -c src/afl-performance.c -o src/afl-performance.o
clang -isystem /opt/homebrew/Cellar/openssl@3/3.2.1/include -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/usr/local/lib/afl\" -DBIN_PATH=\"/usr/local/bin\" -DDOC_PATH=\"/usr/local/share/doc/afl\"  -flto=full src/afl-fuzz-bitmap.c src/afl-fuzz-cmplog.c src/afl-fuzz-extras.c src/afl-fuzz-init.c src/afl-fuzz-mutators.c src/afl-fuzz-one.c src/afl-fuzz-python.c src/afl-fuzz-queue.c src/afl-fuzz-redqueen.c src/afl-fuzz-run.c src/afl-fuzz-state.c src/afl-fuzz-stats.c src/afl-fuzz-statsd.c src/afl-fuzz.c src/diff-afl-forkserver.c src/diff-afl-fuzz-init.c src/afl-common.o src/afl-sharedmem.o src/afl-forkserver.o src/afl-performance.o -o afl-fuzz  -L/opt/homebrew/opt/qt@5/lib -lcrypto -lssl -lm
src/afl-fuzz-init.c:2634:19: warning: expression which evaluates to zero treated as a null pointer constant of type 'u8 *' (aka 'unsigned char *') [-Wnon-literal-null-conversion]
 2634 |         laf_loc = '\0';
      |                   ^~~~
1 warning generated.
src/afl-fuzz-redqueen.c:1563:20: warning: variable 'cons_0' set but not used [-Wunused-but-set-variable]
 1563 |   u8  cons_ff = 0, cons_0 = 0;
      |                    ^
1 warning generated.
src/afl-fuzz.c:1534:7: error: call to undeclared function 'pthread_set_qos_class_self_np'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 1534 |   if (pthread_set_qos_class_self_np(QOS_CLASS_USER_INTERACTIVE, 0) != 0) {
      |       ^
1 error generated.
src/diff-afl-forkserver.c:883:3: warning: 'MD5_Init' is deprecated [-Wdeprecated-declarations]
  883 |   MD5_Init (&first_mdContext);
      |   ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:49:1: note: 'MD5_Init' has been explicitly marked deprecated here
   49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:885:5: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
  885 |     MD5_Update(&first_mdContext, data, bytes);
      |     ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:50:1: note: 'MD5_Update' has been explicitly marked deprecated here
   50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:888:5: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
  888 |     MD5_Update(&first_mdContext, data, bytes);
      |     ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:50:1: note: 'MD5_Update' has been explicitly marked deprecated here
   50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:890:3: warning: 'MD5_Final' is deprecated [-Wdeprecated-declarations]
  890 |   MD5_Final(first_cksum_out, &first_mdContext);
      |   ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:51:1: note: 'MD5_Final' has been explicitly marked deprecated here
   51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:903:5: warning: 'MD5_Init' is deprecated [-Wdeprecated-declarations]
  903 |     MD5_Init (&mdContext);
      |     ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:49:1: note: 'MD5_Init' has been explicitly marked deprecated here
   49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:905:7: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
  905 |       MD5_Update(&mdContext, data, bytes);
      |       ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:50:1: note: 'MD5_Update' has been explicitly marked deprecated here
   50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:908:7: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
  908 |       MD5_Update(&mdContext, data, bytes);
      |       ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:50:1: note: 'MD5_Update' has been explicitly marked deprecated here
   50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:910:5: warning: 'MD5_Final' is deprecated [-Wdeprecated-declarations]
  910 |     MD5_Final(cksum_out, &mdContext);
      |     ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/md5.h:51:1: note: 'MD5_Final' has been explicitly marked deprecated here
   51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
      | ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:194:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
  194 | #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
      |                                                 ^
/opt/homebrew/Cellar/openssl@3/3.2.1/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
   62 | #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
      |                                                    ^
src/diff-afl-forkserver.c:857:27: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
  857 |     for (int idx = 0; idx < afl->diff_num; idx++) {
      |                       ~~~ ^ ~~~~~~~~~~~~~
src/diff-afl-forkserver.c:863:25: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
  863 |   for (int idx = 0; idx < afl->diff_num; idx++) {
      |                     ~~~ ^ ~~~~~~~~~~~~~
src/diff-afl-forkserver.c:893:25: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
  893 |   for (int idx = 1; idx < afl->diff_num; idx++) {
      |                     ~~~ ^ ~~~~~~~~~~~~~
11 warnings generated.
src/diff-afl-fuzz-init.c:54:31: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
   54 |   for (int idx_com=0; idx_com < afl->diff_num; idx_com++) {
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
src/diff-afl-fuzz-init.c:66:31: warning: comparison of integers of different signs: 'int' and 'u32' (aka 'unsigned int') [-Wsign-compare]
   66 |   for (int idx_com=0; idx_com < afl->diff_num; idx_com++) {
      |                       ~~~~~~~ ^ ~~~~~~~~~~~~~
2 warnings generated.
make: *** [afl-fuzz] Error 1

Perhaps you can update the version of AFL++ used in CompDiff?

shao-hua-li commented 3 months ago

Could you try the following script

#!/bin/bash
set -e

if [ "$1" = "clean" ]; then
    cd "./aflpp"
    CC=clang make clean
    cd ../compilers
    make clean
    exit 0
fi

cd "./aflpp"
CC=clang gmake
CC=clang make -C utils/aflpp_driver
cd ..

cd "./compilers"
source build.sh
cd ..
BenWibking commented 3 months ago

That does help, but is not sufficient to fix it on its own. The underlying problem is due to the use of an old version of AFL++ in CompDiff that Clang can't build.

If I both replace the aflpp directory with the latest AFL++ from https://github.com/AFLplusplus/AFLplusplus, and use this new build script, then it compiles successfully.