Building Tensorflow with Bazel: Executing genrule #png_archive//:configure failed - tensorflow

I've been trying to understand why I can't build Tensorflow with Bazel.
I've been following the install instructions from the Tensorflow webpage here.
Here's my output when I build with the command bazel build -c opt --config=cuda --verbose_failures //tensorflow/cc:tutorials_example_trainer
[mcochrane#Matt-PC-Fedora tensorflow]$ bazel build -c opt --config=cuda --verbose_failures //tensorflow/cc:tutorials_example_trainer
INFO: Found 1 target...
INFO: From Executing genrule #png_archive//:configure:
/home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow/external/png_archive/libpng-1.2.53 /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow
/tmp/tmp.52xPGPoCo8 /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow/external/png_archive/libpng-1.2.53 /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/tmp.52xPGPoCo8':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/external/png_archive/BUILD:23:1: Executing genrule #png_archive//:configure failed: bash failed: error executing command
(cd /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow && \
exec env - \
PATH=/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/home/mcochrane/.local/bin:/home/mcochrane/bin \
/bin/bash -c 'source tools/genrule/genrule-setup.sh; pushd external/png_archive/libpng-1.2.53; workdir=$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $workdir; pushd $workdir; ./configure --enable-shared=no --with-pic=no; popd; popd; cp $workdir/config.h bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53; rm -rf $workdir;'): bash failed: error executing command
(cd /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow && \
exec env - \
PATH=/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/home/mcochrane/.local/bin:/home/mcochrane/bin \
/bin/bash -c 'source tools/genrule/genrule-setup.sh; pushd external/png_archive/libpng-1.2.53; workdir=$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $workdir; pushd $workdir; ./configure --enable-shared=no --with-pic=no; popd; popd; cp $workdir/config.h bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53; rm -rf $workdir;').
Target //tensorflow/cc:tutorials_example_trainer failed to build
INFO: Elapsed time: 2.229s, Critical Path: 0.71s
It's a bit cryptic. Bash just fails with the following message which doesn't really provide a whole lot of insight.
bash failed: error executing command
(cd /home/mcochrane/.cache/bazel/_bazel_mcochrane/fd0e4dd3891f9c98b9d8308260aad0f3/tensorflow && \
exec env - \
PATH=/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/home/mcochrane/.local/bin:/home/mcochrane/bin \
/bin/bash -c 'source tools/genrule/genrule-setup.sh; pushd external/png_archive/libpng-1.2.53; workdir=$(mktemp -d -t tmp.XXXXXXXXXX); cp -a * $workdir; pushd $workdir; ./configure --enable-shared=no --with-pic=no; popd; popd; cp $workdir/config.h bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53; rm -rf $workdir;').
Has anyone else come across this error when compiling with bazel?
EDIT: extra info
OS is Fedora23 (kernel 4.2.6-300.fc23)
gcc version is 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
[mcochrane#Matt-PC-Fedora tensorflow]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
ldd version is: (GNU libc) 2.22

Related

CPPFLAGS set from configure.ac are ignored in Makefile.am

I am trying to build TerraGear with self-made AutoTools files (configure script). TerraGear is split into several subprojects. For each, I create a different set of configure.ac and Makefile.am files, but they are all almost the same.
Consider the following two files:
configure.ac
AC_PREREQ([2.69])
AC_INIT([TerraGear libterragear], [2.1.0], [])
AC_CONFIG_SRCDIR([airport.cxx])
AC_CONFIG_FILES([Makefile])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CXX
PKG_CHECK_MODULES([ZLIB], [zlib])
PKG_CHECK_MODULES([GDAL], [gdal])
AC_ARG_WITH([simgear-dir], [AS_HELP_STRING(
[--with-simgear-dir=prefix],
[installation prefix of SimGear])],
[
SIMGEAR_CPPFLAGS="-I${withval}/include"
SIMGEAR_LIBRARY="-L${withval}/lib"
]
)
AC_MSG_NOTICE([simgear cppflags : ${SIMGEAR_CPPFLAGS}])
AC_OUTPUT
Makefile.am
bin_PROGRAMS = genapts850
genapts850_SOURCES = airport.cxx \
apt_math.cxx \
closedpoly.cxx \
debug.cxx \
elevations.cxx \
helipad.cxx \
lights.cxx \
linearfeature.cxx \
linked_objects.cxx \
main.cxx \
object.cxx \
output.cxx \
parser.cxx \
runway.cxx \
rwy_simple.cxx \
rwy_gen.cxx \
scheduler.cxx \
taxiway.cxx
genapts850_LDADD = -L$(top_srcdir)/../../Lib/terragear \
$(SIMGEAR_LIBRARY) \
-lSimGearCore \
-lSimGearScene \
-lterragear \
$(ZLIB_LIBRARY) \
$(GDAL_LIBRARY)
genapts850_CXXFLAGS = -I$(top_srcdir)/../../Lib \
-I$(top_srcdir)/../../Lib/terragear \
$(SIMGEAR_CPPFLAGS) \
$(ZLIB_CFLAGS) \
$(GDAL_CFLAGS)/gdal
I run autoreconf:
autoreconf -vfi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `.'
then run the configure script:
./configure --with-simgear-dir=/path/to/simgear/installation/prefix
[...]
configure: simgear cppflags : -I/path/to/simgear/installation/prefix/include
[...]
then I run make:
make
g++ -DPACKAGE_NAME=\"TerraGear\ libterragear\" -DPACKAGE_TARNAME=\"terragear-libterragear\" -DPACKAGE_VERSION=\"2.1.0\" -DPACKAGE_STRING=\"TerraGear\ libterragear\ 2.1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"terragear-libterragear\" -DVERSION=\"2.1.0\" -I. -I./../../Lib -I./../../Lib/terragear -Ig++ -DPACKAGE_NAME=\"TerraGear\ libterragear\" -DPACKAGE_TARNAME=\"terragear-libterragear\" -DPACKAGE_VERSION=\"2.1.0\" -DPACKAGE_STRING=\"TerraGear\ libterragear\ 2.1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"terragear-libterragear\" -DVERSION=\"2.1.0\" -I. -I./../../Lib -I./../../Lib/terragear -I/path/to/simgear/installation/prefix/include/gdal -g -O2 -MT genapts850-airport.o -MD -MP -MF .deps/genapts850-airport.Tpo -c -o genapts850-airport.o `test -f 'airport.cxx' || echo './'`airport.cxx
airport.cxx:6:10: fatal error: simgear/compiler.h: Datei oder Verzeichnis nicht gefunden
6 | #include <simgear/compiler.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:471: genapts850-airport.o] Fehler 1
(simgear/compiler.h resides inside /path/to/simgear/installation/prefix/include)
What am I doing wrong ? I'm banging my head into the screen for three hours now without being able to figure out the problem. Please help …
Not all shell variables defined in configure are forwarded to output files. Generally speaking, you need to use AC_SUBST() to tell Autoconf that a shell variable should be an output variable:
AC_SUBST([SIMGEAR_CPPFLAGS])
AC_SUBST([SIMGEAR_LIBRARY])

How to compile apache2 own module in dockerfile?

I want to compile my own Apache module when building my image, so i wrote the following Dockerfile.
FROM httpd:2.4.25
COPY conf/httpd.conf /usr/local/apache2/conf/httpd.conf
COPY modules/mod_example.c /usr/local/apache2/modules/mod_example.c
RUN apxs -i -a -c modules/mod_example.c
EXPOSE 80
But i get an error :
/usr/share/apr-1.0/build/libtool --silent --mode=compile x86_64-linux-gnu-gcc -std=gnu99 -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache2/include -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -c -o mod_example.lo mod_example.c && touch mod_example.slo
/usr/share/apr-1.0/build/libtool: line 1114: x86_64-linux-gnu-gcc: command not found
apxs:Error: Command failed with rc=65536
I tried apt-get install gcc or libtool it say it's unable to locate the package.
My goal is to compile the ".c" file in a ".so" file.
Installing gcc, or the build-deps of say libapr1, is all that's needed. You probably just have a problem with your unspecified attempt at adding the compiler from your dockerfile.
For referene, here's how the httpd layer adds the compiler:
https://github.com/docker-library/httpd/blob/master/2.4/Dockerfile
I needed to do an apt-get update then :
apt-get install build-essential libtool
Since the docker image is a prod image, it doesn't contain dev tools.

Can I build my PC file (Oracle Pro*c) conditionally inside of my application's make file?

I'm attempting to combine my makefiles so I can simply build once and it will precompile the pc file completely before continuing to build the application. This should be possible but for the life of me I cannot figure it out. Here is my makefile (for redhat 7).
COMPILEDATE = $(shell date)
COMPILE=g++ -std=c++11 -Wall -Wuninitialized -g
OSTYPE = $(shell uname)
LIBDIR=../../lib/
INC=../../include/
FILES=myProcess
OBJS= myProcess.o \
sqlStuff.o
O8P=$(ORACLE_HOME)
O8P=/u01/app/oracle/11.2.0/client_1
ORACLE_HOME=/u01/app/oracle/11.2.0/client_1
PROC_LINES=proc lines=yes code=ANSI_C iname=sqlStuff.pc parse=partial iname=sqlStuff include=. include=$(ORACLE_HOME)/precomp/public include=$(ORACLE_HOME)/rdbms/public include=$(ORACLE_HOME)/rdbms/demo include=$(ORACLE_HOME)/plsql/public include=$(ORACLE_HOME)/network/public
all: $(FILES)
compileInfo.o : FORCE
$(COMPILE) -c compileInfo.cpp -o $# -I$(INC) -DCDATE="\"$(COMPILEDATE)\"" -DBUILD="\"$(LSWBUILD)\""
FORCE :
%.o : %.cpp $(INC)myProcess.h
$(COMPILE) -c $< -o $# -I$(INC) -DCDATE="\"$(COMPILEDATE)\""
sqlStuff.o : sqlStuff.c
gcc -g -Wall -O -c -lclntsh -I. -I$(ORACLE_HOME)/precomp/public -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/plsql/lib -I$(ORACLE_HOME)/network/lib
sqlStuff.c : sqlStuff.pc
$(PROC_LINES)
myProcess: $(OBJS) $(LIBDIR)libbase.a $(INC)myProcess.h sqlStuff.o
$(COMPILE) -o myProcess$(OBJS) -L$(LIBDIR) -lbase
clean:
rm -f $(FILES)
rm -f sqlStuff
rm -f sqlStuff.c
rm -f sqlStuff.lis
rm -f $(OBJS)
rm -f core
rm -f *.out
rm -f *.log
rm -f *.err
My fault, I didn't explain what the issue was:
I'm compiling in netbeans using this build command: ${MAKE} -f Makefile. The error is PCC-S-02015, unable to open include file on my object that is not being precompiled, sqlStuff.o
Looking at the gcc command under sqlStuff.o : sqlStuff.c, it looks to me that there should be a -o sqlStuff.o flag to tell gcc that the output should be written to sqlStuff.o instead of the default, which is a.out.
Best of luck.

Error when installing Apache on Tomcat7: "file...has no symbols"

I tried to install apache [APR][1] on Tomcat7.
What I did was:
tar xvf apache-tomcat/bin/tomcat-native.tar.gz
./configure --with-apr=/usr/local/apr --without-ssl
make install
APR was not installed correctly I get the output:
make[1]: Nothing to be done for `local-all'.
/usr/local/apr/build-1/mkdir.sh /usr/local/apr/include/apr-1 /usr/local/apr/lib/pkgconfig \
/usr/local/apr/lib /usr/local/apr/bin
/usr/bin/install -c -m 644 tcnative.pc /usr/local/apr/lib/pkgconfig/tcnative-1.pc
list=''; for i in $list; do \
( cd $i ; make DESTDIR= install ); \
done
/bin/sh /usr/local/apr/build-1/libtool --mode=install /usr/bin/install -c -m 755 libtcnative-1.la /usr/local/apr/lib
libtool: install: /usr/bin/install -c -m 755 .libs/libtcnative-1.0.dylib /usr/local/apr/lib/libtcnative-1.0.dylib
libtool: install: (cd /usr/local/apr/lib && { ln -s -f libtcnative-1.0.dylib libtcnative-1.dylib || { rm -f libtcnative-1.dylib && ln -s libtcnative-1.0.dylib libtcnative-1.dylib; }; })
libtool: install: /usr/bin/install -c -m 755 .libs/libtcnative-1.lai /usr/local/apr/lib/libtcnative-1.la
libtool: install: /usr/bin/install -c -m 755 .libs/libtcnative-1.a /usr/local/apr/lib/libtcnative-1.a
libtool: install: chmod 644 /usr/local/apr/lib/libtcnative-1.a
libtool: install: ranlib /usr/local/apr/lib/libtcnative-1.a
ranlib: file: /usr/local/apr/lib/libtcnative-1.a(sslutils.o) has no symbols
What is wrong here?
When running Tomcat I get the following output:
Aug 07, 2013 2:16:14 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:

using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration

using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration
$ apxs -i -c -Wc,"-arch x86_64" -Wl,"-arch x86_64 " mod_uwsgi.c
/usr/share/apr-1/build-1/libtool --silent --mode=compile cc -prefer-pic -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/Cellar/httpd24/2.4.3/include/apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch x86_64 -c -o mod_uwsgi.lo mod_uwsgi.c && touch mod_uwsgi.slo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
apxs:Error: Command failed with rc=65536
.
What environment must I export to have libtool not complain about tag?
after digging through the source I found that if LTFLAGS is set to --tag=cc things work.
$ LTFLAGS=--tag=cc apxs -i -c mod_uwsgi.c