Issue 1:
I am trying to compile tensorflow from source. I can build it successfully with CPU support only( i.e. not use --config=cuda) .

But when I try to build it with GPU support, I get error:

[chaowei@node07 tensorflow]$ export EXTRA_BAZEL_ARGS='-s --verbose_failures --ignore_unsupported_sandboxing --genrule_strategy=standalone --spawn_strategy=standalone --jobs 8'
[chaowei@node07 tensorflow]$
[chaowei@node07 tensorflow]$ /gpfs/home/chaowei/download/bazel-0.1.5/output/bazel build -c opt --config=cuda --linkopt '-lrt' --copt="-DGPR_BACKWARDS_COMPATIBILITY_MODE" --conlyopt="-std=c99" //tensorflow/tools/pip_package:build_pip_package
...........
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.io/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 1 target...
ERROR: /gpfs/home/chaowei/.cache/bazel/_bazel_chaowei/2ce35f089de902cec16e4a2c6a450834/external/grpc/BUILD:485:1: C++ compilation of rule '@grpc//:grpc_unsecure' failed: gcc failed: error executing command /gpfs/home/chaowei/software/gcc-6.1.0/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 ... (remaining 39 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/grpc/src/core/compression/message_compress.c:41:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>
^
compilation terminated.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 71.894s, Critical Path: 58.77s

I also compile python3 from source in my computer. And when I import zlib, it works fine.

Here is the information of my system:

[chaowei@mgt ~]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago)

[chaowei@node07 gcc-6.1.0]$ gcc -v
built-in specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/gpfs/home/chaowei/software/gcc-6.1.0/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
Target：x86_64-pc-linux-gnu
Configured with：./configure --prefix=/gpfs/home/chaowei/software/gcc-6.1.0
Thread model：posix
gcc version 6.1.0 (GCC)

I wonder why I get zlib.h error when I only build tensorflow with GPU support.

Issue 2:
Environment info

Operating System: Red Hat Enterprise Linux Server release 7.2

Installed version of CUDA and cuDNN: CUDA 7, cuDNN 4

(please attach the output of ls -l /path/to/cuda/lib/libcud*):

-rw-r--r-- 1 root root 179466 Jan 26 22:19 /usr/local/cuda/lib/libcudadevrt.a

lrwxrwxrwx 1 root root 16 Jan 26 22:19 /usr/local/cuda/lib/libcudart.so -> libcudart.so.7.0

lrwxrwxrwx 1 root root 19 Jan 26 22:19 /usr/local/cuda/lib/libcudart.so.7.0 -> libcudart.so.7.0.28

-rwxr-xr-x 1 root root 303052 Jan 26 22:19 /usr/local/cuda/lib/libcudart.so.7.0.28

-rw-r--r-- 1 root root 546514 Jan 26 22:19 /usr/local/cuda/lib/libcudart_static.a

cuDNN is installed for the local user only.

If installed from sources, provide the commit hash:

b289bc7

Steps to reproduce

I have followed the instructions at: https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#requirements

Since I am not root, I had to install everything for the local user, but it seems to have worked.

I get an error at this line:

bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

Saying:

ERROR: [...]/vlad/.cache/bazel/_bazel_vlad/6607a39fc04ec931b523fac975ff3100/external/png_archive/BUILD:23:1: Executing genrule @png_archive//:configure failed: bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.

[...]/vlad/.cache/bazel/_bazel_vlad/6607a39fc04ec931b523fac975ff3100/tensorflow/external/png_archive/libpng-1.2.53 [...]/vlad/.cache/bazel/_bazel_vlad/6607a39fc04ec931b523fac975ff3100/tensorflow

/tmp/tmp.pCUaj9eIKr [...]/vlad/.cache/bazel/_bazel_vlad/6607a39fc04ec931b523fac975ff3100/tensorflow/external/png_archive/libpng-1.2.53 [...]/vlad/.cache/bazel/_bazel_vlad/6607a39fc04ec931b523fac975ff3100/tensorflow

... a bunch more lines until:

checking for pow... no

checking for pow in -lm... yes

checking for zlibVersion in -lz... no

configure: error: zlib not installed

Target //tensorflow/cc:tutorials_example_trainer failed to build

Use --verbose_failures to see the command lines of failed build steps.

INFO: Elapsed time: 57.196s, Critical Path: 22.12s

What have you tried?

I installed zlib, and the following program compiles with g++

#include <cstdio>
#include <zlib.h>

int main()
{
printf("Hello world");
return 0;
}

I have the following in my .bashrc:

export LD_LIBRARY_PATH="$HOME/local/cuda/lib64:$LD_LIBRARY_PATH"

export LD_LIBRARY_PATH="$HOME/bin/zlibdev/lib:$LD_LIBRARY_PATH"

export CPATH="$HOME/local/cuda/include:$CPATH"

export CPATH="$HOME/bin/zlibdev/include:$CPATH"

export LIBRARY_PATH="$HOME/local/cuda/lib64:$LIBRARY_PATH"

export PKG_CONFIG_PATH="$HOME/bin/zlibdev/lib/pkgconfig"

Why can't bazel / tensorflow find zlib.h? It's there and accessible.