Installing libgit2 and pygit2 on Debian Docker - libgit2

I have been trying to install pygit2 and libgit2 using a Debian:Jessie docker file. I was able to compile the package with almost the same packages with ubuntu, but not with debian.
Below is the Dockerfile I used and output error sample
FROM debian:jessie
# Install packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
libssl-dev \
libssh2-1-dev \
libffi-dev \
zlib1g-dev \
python-cffi \
python-dev \
python-pip \
build-essential \
cmake \
gcc \
pkg-config \
git \
libhttp-parser-dev \
python-setuptools
RUN cd /tmp && \
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_1r.tar.gz && \
tar xzf OpenSSL_1_0_1r.tar.gz && \
cd openssl-OpenSSL_1_0_1r && \
./config -fPIC --prefix=/usr/local/ -ldl && \
make && \
make install
RUN cd /tmp && \
wget https://github.com/libgit2/libgit2/archive/v0.20.0.tar.gz && \
tar xzf v0.20.0.tar.gz && \
cd libgit2-0.20.0/
RUN cd /tmp/libgit2-0.20.0 && \
cmake . && \
cmake --build . && \
ldconfig && \
pip install -I pygit2==0.20.3 && \
pip install -I pyOpenSSL==0.15.1
RUN pip install pip==8.1.2 && \
pip install cherrypy==3.2.2 \
tornado==4.3 \
docker-py==1.8.1 \
halite==0.1.17 \
GitPython==0.3.2.RC1 \
# pygit2==0.20.3 \
pyOpenSSL==0.15.1
But when compiling the libgit2 library, am getting the following error
[ 99%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/harder.c.o
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__m':
/tmp/libgit2-0.20.0/tests/blame/harder.c:37:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__c':
/tmp/libgit2-0.20.0/tests/blame/harder.c:45:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__cc':
/tmp/libgit2-0.20.0/tests/blame/harder.c:55:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
/tmp/libgit2-0.20.0/tests/blame/harder.c: In function 'test_blame_harder__ccc':
/tmp/libgit2-0.20.0/tests/blame/harder.c:65:20: warning: variable 'opts' set but not used [-Wunused-but-set-variable]
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
^
[ 99%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/blame_helpers.c.o
[100%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/getters.c.o
Linking C executable libgit2_clar
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x354): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x412): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x484): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x542): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x5a9): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x60d): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x645): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x6d1): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x731): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x792): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
CMakeFiles/libgit2_clar.dir/build.make:9030: recipe for target 'libgit2_clar' failed
make[2]: *** [libgit2_clar] Error 1
make[1]: *** [CMakeFiles/libgit2_clar.dir/all] Error 2
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/libgit2_clar.dir/all' failed
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Can someone please advise if I missed a dependency?
Thanks
Update
I tried updating the libgit2 to version 0.24.1 but still getting the following error
[100%] Building C object CMakeFiles/libgit2_clar.dir/tests/blame/getters.c.o
Linking C executable libgit2_clar
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x11): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x24): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x2f): undefined reference to `dlclose'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x354): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x412): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x484): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x542): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x5a9): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x60d): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x645): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x6d1): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x731): undefined reference to `dlerror'
/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x792): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
CMakeFiles/libgit2_clar.dir/build.make:11874: recipe for target 'libgit2_clar' failed
make[2]: *** [libgit2_clar] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/libgit2_clar.dir/all' failed
Makefile:127: recipe for target 'all' failed
make[1]: *** [CMakeFiles/libgit2_clar.dir/all] Error 2
make: *** [all] Error 2

I added the following after your 'install packages'
RUN apt-get update
RUN apt-get install -y wget
RUN wget https://github.com/libgit2/libgit2/archive/v0.24.0.tar.gz && \
tar xzf v0.24.0.tar.gz && \
cd libgit2-0.24.0/ && \
cmake . && \
make && \
make install
RUN ldconfig
RUN pip install pygit2
For me this seems to work. You have to run ldconfig to create the necessary link to libgit2
A part of the output:
l/include -I/usr/include/python2.7 -c src/commit.c -o build/temp.linux-x86_64-2.7/src/commit.o
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/include -I/usr/include/python2.7 -c src/error.c -o build/temp.linux-x86_64-2.7/src/error.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/diff.o build/temp.linux-x86_64-2.7/src/options.o build/temp.linux-x86_64-2.7/src/utils.o build/temp.linux-x86_64-2.7/src/tag.o build/temp.linux-x86_64-2.7/src/object.o build/temp.linux-x86_64-2.7/src/signature.o build/temp.linux-x86_64-2.7/src/reference.o build/temp.linux-x86_64-2.7/src/blob.o build/temp.linux-x86_64-2.7/src/pygit2.o build/temp.linux-x86_64-2.7/src/note.o build/temp.linux-x86_64-2.7/src/repository.o build/temp.linux-x86_64-2.7/src/oid.o build/temp.linux-x86_64-2.7/src/walker.o build/temp.linux-x86_64-2.7/src/patch.o build/temp.linux-x86_64-2.7/src/treebuilder.o build/temp.linux-x86_64-2.7/src/branch.o build/temp.linux-x86_64-2.7/src/tree.o build/temp.linux-x86_64-2.7/src/commit.o build/temp.linux-x86_64-2.7/src/error.o -L/usr/local/lib -lgit2 -o build/lib.linux-x86_64-2.7/_pygit2.so
building '_cffi__x50f7320ax7286955d' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/local/include -I/usr/include/python2.7 -c __pycache__/_cffi__x50f7320ax7286955d.c -o build/temp.linux-x86_64-2.7/__pycache__/_cffi__x50f7320ax7286955d.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/__pycache__/_cffi__x50f7320ax7286955d.o -L/usr/local/lib -lgit2 -o build/lib.linux-x86_64-2.7/_cffi__x50f7320ax7286955d.so
Successfully installed pygit2
EDIT:
Here is the full dockerfile. Now I had to update the libgit2 version to let it work. Here is the full dockerfile:
FROM debian:jessie
# Install packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yqq \
libssl-dev \
libssh2-1-dev \
libffi-dev \
zlib1g-dev \
python-cffi \
python-dev \
python-pip \
build-essential \
cmake \
gcc \
pkg-config \
git \
libhttp-parser-dev \
python-setuptools \
wget
RUN wget https://github.com/libgit2/libgit2/archive/v0.25.0.tar.gz && \
tar xzf v0.25.0.tar.gz && \
cd libgit2-0.25.0/ && \
cmake . && \
make && \
make install
RUN ldconfig
RUN pip install pygit2

Mike Chernev's solution from here worked for me:
FROM python
MAINTAINER Mike Chernev <mike#mikechernev.com>
ENV LIBGIT_VERSION 1.1.0
# Cmake is a dependency for building libgit2
RUN apt-get update && apt-get install -y cmake \
# Downloading and building libgit2
&& wget https://github.com/libgit2/libgit2/archive/v${LIBGIT_VERSION}.tar.gz \
&& tar xzf v${LIBGIT_VERSION}.tar.gz \
&& cd libgit2-${LIBGIT_VERSION} \
&& cmake . \
&& make \
&& make install \
# The python wrapper for libgit2
&& pip install pygit2 \
# Required for updating the libs
&& ldconfig
In addition, you will have to remove pygit2 from your requirements.txt file.
You can find the latest version of libgit2 here.

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])

Error while installing numpy in alpine image

Error :
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-2u_c2pqi/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-gfsn5nsl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-2u_c2pqi/numpy/
This is the error I am getting in my travis build of my dockerfile.
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
24 && apk --no-cache --update-cache add postgresql-dev musl-dev linux-headers g++ gfortran py-pip build-base bash libpng-dev openblas-dev w get freetype-dev gcc \
25 && ln -s /usr/include/locale.h /usr/include/xlocale.h \
26 && pip3 install setuptools wheel \
27 && pip3 install numpy pyyaml`
I am installing numpy using the above commands
Some issues have been found in your Dockerfile:
python3-dev and py3-pip packages should be installed to install numpy.
g++ already has gcc and musl-dev in dependencies, so we can simplify a package list.
The final Dockerfile is:
FROM alpine:latest
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk --no-cache --update-cache add postgresql-dev g++ linux-headers gfortran build-base bash libpng-dev openblas-dev wget freetype-dev python3-dev py3-pip \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& pip3 install setuptools wheel \
&& pip3 install numpy pyyaml

Cmake: How to include dependecies properly

In the old Makefile there is an include part:
SHELL=/bin/sh
CORE_SRC=\
./Core/allocator.cpp \
./Core/etc... \
CORE_OBJS=$(CORE_SRC:.cpp=.o)
INCLUDE=\
`pkg-config --cflags glib-2.0 libpng` \
`sdl-config --cflags` \
`freetype-config --cflags` \
`./python-config-linux.sh --cflags` \
-I./TopLayer -I./etc...
CC=g++-4.4
CFLAGS=-O3 -pipe -Wall -fPIC -D__STDC_CONSTANT_MACROS
CORE_LFLAGS=\
-fPIC \
-Wl,-rpath,./libs
CORE_LDLIBS=\
`pkg-config --libs glib-2.0 libpng` \
`sdl-config --libs` -lz -ljpeg \
`freetype-config --libs` \
`curl-config --libs` \
-L./$(LIBSDIR) \
-letc...
GAME_LFLAGS=\
-shared -pthread -fPIC \
-Wl,-rpath,../libs
GAME_LDLIBS=\
-lm \
`python-config-linux.sh --libs`
target_name: $(CORE_OBJS) $(CORE_NAME)
target_name: override CFLAGS += -DAV_OUTPUT
$(CORE_NAME): $(CORE_OBJS)
$(CC) $(CORE_LFLAGS) $(CORE_OBJS) $(CORE_LDLIBS) -o $#
.c.o:
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $*.o
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $#
The execution of those configs is:
$pkg-config --cflags glib-2.0 libpng
-> -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/libpng12
$sdl-config --cflags
-> -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
$freetype-config --cflags
-> -I/usr/include/freetype2
$./python-config-linux.sh --cflags
-> -I/python-2.7.10/include/python2.7 -I/python-2.7.10/include/python2.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
I don't understand and a bit confused about Cmake - should I use target_include_dirictories() or find_packages()?
Should target_include_dirictories() be used also with --cflags and libs like glib-2.0 libpng for pkg-config?
*Updated makefile. Removed unnecessary targets etc.
You will need both find_package() and target_link_libraries().
target_include_directories() is almost always obsolete when using libraries found through find_package. Docs.
Example
Example tested on macOS HighSierra with CMake 3.12.
project(Example)
cmake_minimum_required(VERSION 3.10)
find_package(PNG REQUIRED)
add_executable(prog main.c) # main.c from: http://zarb.org/~gc/html/libpng.html
target_link_libraries(prog PNG)
# On Ubuntu 14.04 + CMake 3.2 use the older syntax (FindPNG.cmake is too old) from the next line:
# target_link_libraries(prog ${PNG_LIBRARIES})

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

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

Gcc error while compiling option -fPIC

I'm reading a book but I get one error while compiling with this code.
$ rm -f injection.dylib
$ export PLATFORM=/Developer/Platforms/iPhoneOS.platform
$ $PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC
$ $PLATFORM/Developer/usr/bin/ld \ -dylib -lsystem -lobjc \
-o injection.dylib injection.o \
-syslibroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk/
I've some trouble especially in this line:
$PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC
This is the error
arm-apple-darwin10-llvm-gcc-4.2: -fPIC: No such file or directory
how can I solve... what does it means?
It means you mistyped the command line:
stieber#gatekeeper:~$ gcc \ -fPIC
gcc: error: -fPIC: No such file or directory
gcc: fatal error: no input files
compilation terminated.
Seems the \ in the middle of the line makes gcc (and probably the llvm-gcc as well) stop considering arguments as options and always treats them as filenames.
stieber#gatekeeper:~$ gcc -fPIC
gcc: fatal error: no input files
compilation terminated.
gives the expected result.