• Home
  • Raw
  • Download

Lines Matching +full:build +full:- +full:kotlin +full:- +full:linux

1 ---
4 title: Build Integration
7 permalink: /clusterfuzzlite/build-integration/
8 ---
9 # Build integration
12 - TOC
14 ---
18 [libFuzzer targets]({{ site.baseurl }}/reference/glossary/#fuzz-target) on
19 Linux.
21 We re-use the [OSS-Fuzz](https://github.com/google/oss-fuzz) toolchain to make
25 copies in the source code directly during `docker build`.
28 - [Integrate]({{ site.baseurl }}/advanced-topics/ideal-integration/) one or more [fuzz targets]({{ …
30 - [Install Docker](https://docs.docker.com/engine/installation)
31 [Why Docker?]({{ site.baseurl }}/faq/#why-do-you-use-docker)
34 …docker group](https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-grou…
37 [docker-cleanup](https://gist.github.com/mikea/d23a839cba68778d94e0302e8a2c200f)
38 periodically to garbage-collect unused images.
40 - Clone the OSS-Fuzz repo: `git clone https://github.com/google/oss-fuzz.git`
42 ## Generating an empty build integration
44 Build integrations consist of three configuration files:
45 * [./clusterfuzzlite/project.yaml](#projectyaml) - provides metadata about the project.
46 * [./clusterfuzzlite/Dockerfile](#dockerfile) - defines the container environment with information
47 on dependencies needed to build the project and its [fuzz targets]({{ site.baseurl }}/reference/glo…
48 * [./clusterfuzzlite/build.sh](#buildsh) - defines the build script that executes inside the Docker…
49 generates the project build.
57 $ cd /path/to/oss-fuzz
59 $ python infra/helper.py generate $PATH_TO_PROJECT --external
70 - [language](#language)
78 * [`go`]({{ site.baseurl }}//getting-started/new-project-guide/go-lang/)
79 * [`rust`]({{ site.baseurl }}//getting-started/new-project-guide/rust-lang/)
80 * [`python`]({{ site.baseurl }}//getting-started/new-project-guide/python-lang/)
81 * [`jvm` (Java, Kotlin, Scala and other JVM-based languages)]({{ site.baseurl }}//getting-started/n…
86 Your [build.sh](#buildsh) script will be executed in inside the container you
90 FROM gcr.io/oss-fuzz-base/base-builder # base image with clang toolchain
91 RUN apt-get update && apt-get install -y ... # install required packages to build your project
92 COPY . $SRC/<project_name> # checkout all sources needed to build your project
93 WORKDIR $SRC/<project_name> # current directory for the build script
94 COPY ./clusterfuzzlite/build.sh fuzzer.cc $SRC/ # copy build script into src dir
98 ## build.sh {#buildsh}
100 This file defines how to build binaries for [fuzz targets]({{ site.baseurl }}/reference/glossary/#f…
105 - Build the project using your build system with OSS-Fuzz's compiler.
106 - Provide OSS-Fuzz's compiler flags (defined as [environment variables](#Requirements)) to the buil…
107 - Build your [fuzz targets]({{ site.baseurl }}/reference/glossary/#fuzz-target)
108 and link your project's build with `$LIB_FUZZING_ENGINE` (libFuzzer).
113 ([source](https://github.com/google/oss-fuzz/blob/master/projects/expat/build.sh)):
116 #!/bin/bash -eu
123 make -j$(nproc) all
125 $CXX $CXXFLAGS -std=c++11 -Ilib/ \
126 $SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \
132 …ut the [Integrating a Go project]({{ site.baseurl }}//getting-started/new-project-guide/go-lang/) …
135 …nary names for your [fuzz targets]({{ site.baseurl }}/reference/glossary/#fuzz-target) contain only
136 alphanumeric characters, underscore(_) or dash(-). Otherwise, they won't run.
142 …t every 3rd party library or tool that supports the build target. Use the following snippet to bui…
152 # build commands here that should not result in instrumented code.
161 ### build.sh script environment
163 When your build.sh script is executed, the following locations are available within the image:
166 |---------| ------------ | ---------- |
167 | `/out/` | `$OUT` | Directory to store build artifacts (fuzz targets, dictionaries, option…
177 …aProvider]: https://github.com/google/fuzzing/blob/master/docs/split-inputs.md#fuzzed-data-provider
179 ### build.sh requirements {#Requirements}
183 You *must* use the special compiler flags needed to build your project and fuzz targets.
187 | ------------- | --------
194 Most well-crafted build scripts will automatically use these variables. If not,
195 pass them manually to the build tool.
197 …ables](https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/README.md#pro…
198 `base-builder` image documentation for more details.
203 …/glossary/#fuzz-target) run in, and the assumptions you can make, see the [fuzzer environment]({{ …
207 You can build your docker image and fuzz targets locally, so you can test them
209 …structure, this time using it to build your docker image and [fuzz targets]({{ site.baseurl }}/ref…
212 $ cd /path/to/oss-fuzz
213 $ python infra/helper.py build_image $PATH_TO_PROJECT --external
214 … python infra/helper.py build_fuzzers $PATH_TO_PROJECT --sanitizer <address/undefined/coverage> --
217 The built binaries appear in the `/path/to/oss-fuzz/build/out/$PROJECT_NAME`
222 **Note:** You *must* run your fuzz target binaries inside the base-runner docker
228 $ python infra/helper.py check_build $PATH_TO_PROJECT --external
234 …$ python infra/helper.py run_fuzzer --external --corpus-dir=<path-to-temp-corpus-dir> $PATH_TO_PRO…
242 $ python infra/helper.py build_fuzzers --sanitizer coverage $PATH_TO_PROJECT
243 …infra/helper.py coverage $PATH_TO_PROJECT --fuzz-target=<fuzz_target> --corpus-dir=<path-to-temp-c…
248 [code coverage]({{ site.baseurl }}/advanced-topics/code-coverage/) for detailed
254 of the supported build configurations with the above commands (build_fuzzers -> run_fuzzer -> cover…
257 …ience failures, review your [dependencies]({{site.baseurl }}/further-reading/fuzzer-environment/#d…
261 …s, the [Debugging page]({{ site.baseurl }}/advanced-topics/debugging/) lists ways to debug your bu…
262 [fuzz targets]({{ site.baseurl }}/reference/glossary/#fuzz-target).
267 {{ site.baseurl }}/getting-started/new-project-guide/#efficient-fuzzing).
269 TODO(metzman): We probably want a TOC for lang-specific guides (which we still need to add).