mirror of https://github.com/google/oss-fuzz.git
Fix TensorFlow build (#3930)
* Remove dga@google.com as he left Google * Use python3 as python2 is deprecated * Need to manually install numpy now as it is used in the toolchain * Use bazelisk instead of the grep configure -> get Bazel version -> curl hack * Remove C++11 constraint as TF now builds and uses C++14 * Handle review * Remove source sed/replace as it is no longer needed
This commit is contained in:
parent
3d5ee75211
commit
b918240b08
|
@ -19,17 +19,20 @@ MAINTAINER mihaimaruseac@google.com
|
|||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
python-dev \
|
||||
python-future \
|
||||
rsync \
|
||||
&& \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN python3 -m pip install numpy
|
||||
|
||||
# Install Bazel from apt-get to ensure dependencies are there
|
||||
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
|
||||
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
|
||||
RUN apt-get update && apt-get install -y bazel
|
||||
RUN curl -Lo /usr/bin/bazel \
|
||||
https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64 \
|
||||
&& \
|
||||
chmod +x /usr/bin/bazel
|
||||
|
||||
RUN git clone --depth 1 https://github.com/tensorflow/tensorflow tensorflow
|
||||
WORKDIR $SRC/tensorflow
|
||||
|
|
|
@ -15,31 +15,6 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
# First, determine the latest Bazel we can support
|
||||
BAZEL_VERSION=$(
|
||||
grep '_TF_MAX_BAZEL_VERSION =' configure.py | \
|
||||
cut -d\' -f2 | tr -d '[:space:]'
|
||||
)
|
||||
if [ -z ${BAZEL_VERSION} ]; then
|
||||
echo "Couldn't find a valid bazel version in configure.py script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Then, install it
|
||||
curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
|
||||
chmod +x ./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
|
||||
./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh
|
||||
|
||||
# Finally, check instalation before proceeding to compile
|
||||
INSTALLED_VERSION=$(
|
||||
bazel version | grep 'Build label' | cut -d: -f2 | tr -d '[:space:]'
|
||||
)
|
||||
if [ ${INSTALLED_VERSION} != ${BAZEL_VERSION} ]; then
|
||||
echo "Couldn't install required Bazel. "
|
||||
echo "Want ${BAZEL_VERSION}. Got ${INSTALLED_VERSION}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate the list of fuzzers we have (only the base/op name).
|
||||
FUZZING_BUILD_FILE="tensorflow/core/kernels/fuzzing/BUILD"
|
||||
declare -r FUZZERS=$(
|
||||
|
@ -50,13 +25,13 @@ declare -r FUZZERS=$(
|
|||
# Note the c++11/libc++ flags to build using the same toolchain as the one used
|
||||
# to build libFuzzingEngine.
|
||||
CFLAGS="${CFLAGS} -fno-sanitize=vptr"
|
||||
CXXFLAGS="${CXXFLAGS} -fno-sanitize=vptr -std=c++11 -stdlib=libc++"
|
||||
CXXFLAGS="${CXXFLAGS} -fno-sanitize=vptr"
|
||||
|
||||
# Force Python3 and install required python deps
|
||||
PYTHON=python3
|
||||
|
||||
# Make sure we run ./configure to detect when we are using a Bazel out of range
|
||||
yes "" | ./configure
|
||||
|
||||
# See https://github.com/bazelbuild/bazel/issues/6697
|
||||
sed '/::kM..SeedBytes/d' -i tensorflow/stream_executor/rng.cc
|
||||
yes "" | ${PYTHON} configure.py
|
||||
|
||||
# Due to statically linking boringssl dependency, we have to define one extra
|
||||
# flag when compiling for memory fuzzing (see the boringssl project).
|
||||
|
|
|
@ -2,7 +2,6 @@ homepage: "https://www.tensorflow.org"
|
|||
language: c++
|
||||
primary_contact: "mihaimaruseac@google.com"
|
||||
auto_ccs:
|
||||
- "dga@google.com"
|
||||
- "frankchn@google.com"
|
||||
fuzzing_engines:
|
||||
- libfuzzer
|
||||
|
|
Loading…
Reference in New Issue