collabfuzz icon indicating copy to clipboard operation
collabfuzz copied to clipboard

Build failing

Open diewufeihong opened this issue 3 years ago • 3 comments

Follow your instructions to try collabFuzz, but I ran into this error.

DOCKER_BUILDKIT=1 docker build --target=framework-binutils --tag=fuzzer-framework-binutils .
[+] Building 214.4s (39/42)                                                     
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 34B                                           0.0s
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 38B                                        0.0s
 => [internal] load metadata for docker.io/library/golang:1.14             3.1s
 => [internal] load metadata for docker.io/library/fedora:31               3.1s
 => CACHED [internal] helper image for file operations                     0.0s
 => [internal] load build context                                          0.2s
 => => transferring context: 321.97kB                                      0.1s
 => [base 1/1] FROM docker.io/library/fedora:31@sha256:444773966064dcc3c2  0.0s
 => [gllvm 1/2] FROM docker.io/library/golang:1.14@sha256:1a7173b5b9a3af3  0.0s
 => CACHED [gllvm 2/2] RUN go get github.com/SRI-CSL/gllvm/cmd/...         0.0s
 => CACHED [base-builder 1/3] RUN dnf install -y --refresh         cmake   0.0s
 => CACHED [base-builder 2/3] RUN useradd -ms /bin/bash coll && chown -R   0.0s
 => CACHED [base-builder 3/3] RUN llvm-config --version > /work/llvm-vers  0.0s
 => CACHED [framework 1/3] RUN dnf install -y --refresh         cargo      0.0s
 => CACHED [framework 2/3] COPY --chown=coll:coll framework /work/collab-  0.0s
 => CANCELED [framework 3/3] RUN cargo install --root ~/.local --locked  211.0s
 => CACHED [llvm-passes 1/4] RUN dnf install -y --refresh         boost    0.0s
 => CACHED [llvm-passes 2/4] RUN curl --proto '=https' --tlsv1.2 -sSf --o  0.0s
 => CACHED [llvm-passes 3/4] COPY llvm-passes llvm-passes/                 0.0s
 => CACHED [llvm-passes 4/4] RUN rm -f CMakeCache.txt &&     rustup overr  0.0s
 => CACHED [runtime 1/9] RUN dnf install -y --refresh zeromq               0.0s
 => CACHED [runtime 2/9] RUN mkdir /work                                   0.0s
 => CACHED [runtime 3/9] COPY --from=llvm-passes /work/llvm-passes/build/  0.0s
 => CACHED [runtime 4/9] RUN /work/AnalysisPasses-0.1.1-Linux.sh --skip-l  0.0s
 => CACHED [runtime 5/9] RUN useradd -ms /bin/bash coll                    0.0s
 => CACHED [runtime 6/9] RUN mkdir /in                                     0.0s
 => CACHED [runtime 7/9] RUN mkdir /data && chown -R coll:coll /data       0.0s
 => CACHED [runtime 8/9] COPY docker/server/entry.sh /entry.sh             0.0s
 => CACHED [runtime 9/9] RUN mkdir analysis_binaries                       0.0s
 => CACHED [binutils-bc 1/5] COPY --from=gllvm /go/bin/gclang /usr/bin/gc  0.0s
 => CACHED [binutils-bc 2/5] COPY --from=gllvm /go/bin/get-bc /usr/bin/ge  0.0s
 => CACHED [binutils-bc 3/5] RUN dnf install -y --refresh texinfo          0.0s
 => CACHED [binutils-bc 4/5] COPY misc/binutils/build_binutils_bc.sh buil  0.0s
 => CACHED [binutils-bc 5/5] RUN ./build_binutils_bc.sh                    0.0s
 => CACHED [binutils 1/6] COPY --from=llvm-passes /work/llvm-passes/build  0.0s
 => CACHED [binutils 2/6] RUN dnf install -y --refresh         boost-stat  0.0s
 => CACHED [binutils 3/6] RUN /work/AnalysisPasses-0.1.1-Linux.sh --skip-  0.0s
 => CACHED [binutils 4/6] COPY --from=binutils-bc --chown=coll:coll /work  0.0s
 => CACHED [binutils 5/6] COPY misc/binutils/build_binutils_ab.sh build_b  0.0s
 => ERROR [binutils 6/6] RUN ./build_binutils_ab.sh                      210.6s
------
 > [binutils 6/6] RUN ./build_binutils_ab.sh:
#36 88.91 /usr/bin/ld: /usr/lib64/libInstCountWrapperRT.so: undefined reference to `fmaf'
#36 88.91 /usr/bin/ld: /usr/lib64/libInstCountWrapperRT.so: undefined reference to `fma'
#36 88.95 clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
#36 210.4 Completed artifact: addr2line.analysis_binaries/addr2line-static-metrics
#36 210.4 Completed artifact: addr2line.analysis_binaries/addr2line-bb-reach
#36 210.4 Command was: clang -Xclang -load -Xclang /usr/lib64/LLVMIDAssigner.so -Xclang -load -Xclang /usr/lib64/LLVMInstCountWrapper.so -Xclang -load -Xclang /usr/lib64/LLVMInstructionCounter.so addr2line.bc -Wl,--whole-archive /usr/lib64/libInstCountWrapperRT.so -Wl,--no-whole-archive /usr/lib/linux/libclang_rt.icount-x86_64.a -ldl -lpthread -lrt -o addr2line.analysis_binaries/addr2line_instr_counter -mllvm -icount-abilist -mllvm /usr/share/icount_wrapper_abilist.txt -pie -fPIC -mllvm -ignore-default-blacklist -mllvm -icount-abilist -mllvm /usr/share/icount_abilist.txt -ldl
------
executor failed running [/bin/sh -c ./build_binutils_ab.sh]: exit code: 1
Makefile:13: recipe for target 'framework-binutils' failed
make: *** [framework-binutils] Error 1

Have you encountered a similar problem? Could you please give me some suggestions?

diewufeihong avatar Nov 30 '21 03:11 diewufeihong

The Rust standard library recently made some change which requires -lm to be passed in when compiling, that should contain fmaf and fma. Basically, the linking command is probably missing that dependency. You probably need to add it in the wrapper for that specific instrumentation, which should be here: https://github.com/vusec/collabfuzz/blob/8ccab614a05e71dc2dcd4320fb3288807126d992/llvm-passes/wrapper/collab_fuzz_wrapper.in#L67-L74 Give it a try, if it works, please create a PR.

EliaGeretto avatar Nov 30 '21 15:11 EliaGeretto

It works! The framework-binutils can be built successfully, thanks.

diewufeihong avatar Dec 01 '21 02:12 diewufeihong

If you have a working patch, please submit it as a PR. It may not be merged quickly, but at least we will have a working solution.

EliaGeretto avatar Dec 01 '21 10:12 EliaGeretto