Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TensorFlow build #3930

Merged
merged 7 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions projects/tensorflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ MAINTAINER [email protected]

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
Expand Down
35 changes: 5 additions & 30 deletions projects/tensorflow/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$(
Expand All @@ -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).
Expand Down
1 change: 0 additions & 1 deletion projects/tensorflow/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ homepage: "https://www.tensorflow.org"
language: c++
primary_contact: "[email protected]"
auto_ccs:
- "[email protected]"
- "[email protected]"
fuzzing_engines:
- libfuzzer
Expand Down