Cant compile ZMQ PHP-bindings on Colibri iMX7

Hi there,

I want to try compile the zmq-php-bindings following the lead of this page: http://zeromq.org/bindings:php
But when I try to compile I got the following error:

root@colibri-imx7-emmc:~/php-zmq# phpize && ./configure
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... no
configure: error: in `/home/root/php-zmq':
configure: error: C compiler cannot create executables
See `config.log' for more details
root@colibri-imx7-emmc:~/php-zmq# 

Here are the config.log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = colibri-imx7-emmc
uname -m = armv7l
uname -r = 4.9.84-2.8.3+gb2a7f2f
uname -s = Linux
uname -v = #1 SMP Sat Jun 9 16:15:05 UTC 2018

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/local/sbin
PATH: /usr/sbin
PATH: /sbin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2137: checking for grep that handles long lines and -e
configure:2195: result: /bin/grep
configure:2200: checking for egrep
configure:2262: result: /bin/grep -E
configure:2267: checking for a sed that does not truncate output
configure:2331: result: /bin/sed
configure:2470: checking for cc
configure:2486: found /usr/bin/cc
configure:2497: result: cc
configure:2528: checking for C compiler version
configure:2537: cc --version >&5
cc (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2548: $? = 0
configure:2537: cc -v >&5
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-angstrom-linux-gnueabi/7.2.0/lto-wrapper
Target: arm-angstrom-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/configure --build=x86_64-linux --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-float=hard --with-sysroot=/ --with-build-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gxx-include-dir=/usr/include/c++/7.2.0 --without-long-double-128 --enable-nls --enable-initfini-array --with-arch=armv7-a
Thread model: posix
gcc version 7.2.0 (GCC) 
configure:2548: $? = 0
configure:2537: cc -V >&5
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
compilation terminated.
configure:2548: $? = 1
configure:2537: cc -qversion >&5
cc: error: unrecognized command line option '-qversion'; did you mean '--version'?
cc: fatal error: no input files
compilation terminated.
configure:2548: $? = 1
configure:2568: checking whether the C compiler works
configure:2590: cc    conftest.c  >&5
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot open crtbegin.o: No such file or directory
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot open crtend.o: No such file or directory
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot find -lgcc
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot find -lgcc
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot find -lgcc
/usr/lib/gcc/arm-angstrom-linux-gnueabi/7.2.0/../../../../arm-angstrom-linux-gnueabi/bin/ld: error: cannot find -lgcc
collect2: error: ld returned 1 exit status
configure:2594: $? = 1
configure:2632: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2637: error: in `/home/root/php-zmq':
configure:2639: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP=/bin/grep
ac_cv_path_SED=/bin/sed
ac_cv_prog_ac_ct_CC=cc

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
AWK=''
CC='cc'
CFLAGS=''
CONFIGURE_COMMAND=' '\''./configure'\'' '
CONFIGURE_OPTIONS=''
CPP=''
CPPFLAGS=''
DEFS=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
FGREP=''
GREP='/bin/grep'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MANIFEST_TOOL=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
RANLIB=''
RE2C=''
SED='/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME=''
SHLIB_SUFFIX_NAME=''
STRIP=''
ac_ct_AR=''
ac_ct_CC='cc'
ac_ct_DUMPBIN=''
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77

These are actually installed on my Colibri:

root@colibri-imx7-emmc:~# opkg list-installed | grep php
php - 7.1.9-r0.0
php-cgi - 7.1.9-r0.0
php-cli - 7.1.9-r0.0
php-dev - 7.1.9-r0.0
root@colibri-imx7-emmc:~# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-angstrom-linux-gnueabi/7.2.0/lto-wrapper
Target: arm-angstrom-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/configure --build=x86_64-linux --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-float=hard --with-sysroot=/ --with-build-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gxx-include-dir=/usr/include/c++/7.2.0 --without-long-double-128 --enable-nls --enable-initfini-array --with-arch=armv7-a
Thread model: posix
gcc version 7.2.0 (GCC) 
root@colibri-imx7-emmc:~# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-angstrom-linux-gnueabi/7.2.0/lto-wrapper
Target: arm-angstrom-linux-gnueabi
Configured with: ../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/configure --build=x86_64-linux --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --without-local-prefix --enable-lto --enable-libssp --enable-libitm --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --without-isl --with-float=hard --with-sysroot=/ --with-build-sysroot=/build/jenkins/v2017.12/compile/machine/colibri-vf/build/tmp-angstrom-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gcc/7.2.0-r0/recipe-sysroot --with-gxx-include-dir=/usr/include/c++/7.2.0 --without-long-double-128 --enable-nls --enable-initfini-array --with-arch=armv7-a
Thread model: posix
gcc version 7.2.0 (GCC) 
root@colibri-imx7-emmc:~# ld -v
GNU gold (GNU Binutils 2.29.0.20170912) 1.14
root@colibri-imx7-emmc:~# 

I trying to fix this according some entries in stackoverflow and other forums, but nothing helps at the moment.

Got anyone a clue or a hint for me in which direction I have to look for solve this problem ?

Thanks in advance.

Hi @david_korm

Welcome to the Toradex Community!!!

Could you provide the version of the hardware and software of your module?

I think, this issue is linked to gcc compiler version 7.2 and above. Please, have a look to this community post.

Best regards, Jaski

Thank you for your reply.

I hope these are the the information you need:

root@colibri-imx7-emmc:/proc# cat modules
bluetooth 330937 2 - Live 0x7f04b000 (O)
compat 21161 1 bluetooth, Live 0x7f040000 (O)
usb_f_rndis 15714 2 - Live 0x7f037000
u_ether 12516 1 usb_f_rndis, Live 0x7f02f000
mcp251x 10221 0 - Live 0x7f028000
can_dev 12326 1 mcp251x, Live 0x7f020000
libcomposite 44125 10 usb_f_rndis, Live 0x7f00e000
configfs 30966 3 usb_f_rndis,libcomposite, Live 0x7f000000
root@colibri-imx7-emmc:/proc# cat version
Linux version 4.9.84-2.8.3+gb2a7f2f (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #1 SMP Sat Jun 9 16:15:05 UTC 2018
root@colibri-imx7-emmc:/proc# cat cpuinfo 
processor	: 0
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 16.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

processor	: 1
model name	: ARMv7 Processor rev 5 (v7l)
BogoMIPS	: 16.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 5

Hardware	: Freescale i.MX7 Dual (Device Tree)
Revision	: 0000
Serial		: 03084296
root@colibri-imx7-emmc:/proc# 

Please ask for more informations if you need other ones.

Thanks for these information. As stated in this community post, you need either to compile an image with GCC preinstalled or do the cross-compilation instead of native compilation on the module.