aboutsummaryrefslogtreecommitdiff
path: root/projects/tensorflow
diff options
context:
space:
mode:
authorMihai Maruseac <mihaimaruseac@google.com>2020-06-03 22:42:49 +0000
committerGitHub <noreply@github.com>2020-06-03 15:42:49 -0700
commitb918240b083d47203a3efc0974ae99c3be03bf75 (patch)
tree4dd010a6e1e1cb3d3d1530b6e8d2520c582a4e2a /projects/tensorflow
parent3d5ee75211126a4055a17664c3beec9ee9a7c8d1 (diff)
downloadoss-fuzz-b918240b083d47203a3efc0974ae99c3be03bf75.tar.gz
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
Diffstat (limited to 'projects/tensorflow')
-rw-r--r--projects/tensorflow/Dockerfile7
-rwxr-xr-xprojects/tensorflow/build.sh35
-rw-r--r--projects/tensorflow/project.yaml1
3 files changed, 10 insertions, 33 deletions
diff --git a/projects/tensorflow/Dockerfile b/projects/tensorflow/Dockerfile
index 64100cf25..ab4bae1e3 100644
--- a/projects/tensorflow/Dockerfile
+++ b/projects/tensorflow/Dockerfile
@@ -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
diff --git a/projects/tensorflow/build.sh b/projects/tensorflow/build.sh
index b1589e0e8..777821ecd 100755
--- a/projects/tensorflow/build.sh
+++ b/projects/tensorflow/build.sh
@@ -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"
-# Make sure we run ./configure to detect when we are using a Bazel out of range
-yes "" | ./configure
+# Force Python3 and install required python deps
+PYTHON=python3
-# See https://github.com/bazelbuild/bazel/issues/6697
-sed '/::kM..SeedBytes/d' -i tensorflow/stream_executor/rng.cc
+# Make sure we run ./configure to detect when we are using a Bazel out of range
+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).
diff --git a/projects/tensorflow/project.yaml b/projects/tensorflow/project.yaml
index dfdd60953..57ff1aeaf 100644
--- a/projects/tensorflow/project.yaml
+++ b/projects/tensorflow/project.yaml
@@ -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