Skip to content

llvm lto mode fails to compile on alpine #1800

@fuzzah

Description

@fuzzah

The error during AFL++ build on Alpine:

clang -O3 -funroll-loops -fPIC -D_FORTIFY_SOURCE=1 -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=\"/usr/lib/llvm15/bin\" -DVERSION=\"++4.08a\" -DLLVM_LIBDIR=\"/usr/lib/llvm15/lib\" -DLLVM_VERSION=\"15.0.7\" -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"/usr/bin/ld.lld\" -DAFL_CLANG_LDPATH=\"1\" -DAFL_CLANG_FUSELD=\"1\" -DCLANG_BIN=\"clang\" -DCLANGPP_BIN=\"clang++\" -DUSE_BINDIR=0 -Wno-unused-function -fdebug-prefix-map="/AFLplusplus=llvm_mode" -Wno-deprecated  src/afl-ld-lto.c -o afl-ld-lto
src/afl-ld-lto.c:261:15: error: use of undeclared identifier 'PATH_MAX'
  char thecwd[PATH_MAX];
              ^
1 error generated.
make[1]: *** [GNUmakefile.llvm:438: afl-ld-lto] Error 1

The issue is similar to #705, but happens on Alpine Linux.
The fix is also similar: include limits.h (#706).
Though I can't find the relevant macro definition to detect whether we're building on alpine.

Tested this on current dev (6e5ca0c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions