configure: error: cannot run C compiled programs

I am trying to compline a program on FreeBSD 11, I am getting this error,

Thanks,
Code:
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/root/ntopng':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details


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

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

  $ ./configure

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

hostname = pfSense.localdomain
uname -m = amd64
uname -r = 11.3-STABLE
uname -s = FreeBSD
uname -v = FreeBSD 11.3-STABLE #236 21cbb70bbd1(RELENG_2_4_5): Tue Mar 24 15:26:53 EDT 2020     root@buildbot1-nyi.netgate.com:/build/ce-crossbuild-245/obj/amd64/YNx4Qq3j/build/ce-crossbuild-245/sources/FreeBSD-src/sys/pfSense

/usr/bin/uname -p = amd64
/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: /sbin
PATH: /bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /root/bin


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

configure:2272: checking for gcc
configure:2288: found /usr/local/bin/gcc
configure:2299: result: gcc
configure:2528: checking for C compiler version
configure:2537: gcc --version >&5
gcc (FreeBSD Ports Collection) 9.3.0
Copyright (C) 2019 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: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0/lto-wrapper
Target: x86_64-portbld-freebsd11.3
Configured with: /wrkdirs/usr/ports/lang/gcc9/work/gcc-9.3.0/configure --enable-multilib --enable-plugin --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc9 --libexecdir=/usr/local/libexec/gcc9 --program-suffix=9 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc9/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --enable-languages=c,c++,objc,fortran --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/share/info/gcc9 --build=x86_64-portbld-freebsd11.3
Thread model: posix
gcc version 9.3.0 (FreeBSD Ports Collection)
configure:2548: $? = 0
configure:2537: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2548: $? = 1
configure:2537: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2548: $? = 1
configure:2568: checking whether the C compiler works
configure:2590: gcc    conftest.c  >&5
configure:2594: $? = 0
configure:2642: result: yes
configure:2645: checking for C compiler default output file name
configure:2647: result: a.out
configure:2653: checking for suffix of executables
configure:2660: gcc -o conftest    conftest.c  >&5
configure:2664: $? = 0
configure:2686: result:
configure:2708: checking whether we are cross compiling
configure:2716: gcc -o conftest    conftest.c  >&5
conftest.c:9:10: fatal error: stdio.h: No such file or directory
    9 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.
configure:2720: $? = 1
configure:2727: ./conftest
eval: ./conftest: not found
configure:2731: $? = 127
configure:2738: error: in `/root/ntopng':
configure:2742: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

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

ac_cv_env_CCC_set=''
ac_cv_env_CCC_value=''
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_CXXFLAGS_set=''
ac_cv_env_CXXFLAGS_value=''
ac_cv_env_CXX_set=''
ac_cv_env_CXX_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_NDPI_CFLAGS_set=''
ac_cv_env_NDPI_CFLAGS_value=''
ac_cv_env_NDPI_LIBS_set=''
ac_cv_env_NDPI_LIBS_value=''
ac_cv_env_PKG_CONFIG_LIBDIR_set=''
ac_cv_env_PKG_CONFIG_LIBDIR_value=''
ac_cv_env_PKG_CONFIG_PATH_set=''
ac_cv_env_PKG_CONFIG_PATH_value=''
ac_cv_env_PKG_CONFIG_set=''
ac_cv_env_PKG_CONFIG_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_prog_ac_ct_CC=gcc

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

APP=''
CC='gcc'
CENTOS_N2N_DEP=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CXX=''
CXXFLAGS=''
DATE=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
EXTN=''
GIT_DATE=''
GIT_INDEX=''
GIT_RELEASE=''
GMAKE=''
GPP=''
GREP=''
HIREDIS_INC=''
HIREDIS_LIB=''
INSTALL_DIR=''
JSON_INC=''
JSON_LIB=''
KERNEL=''
LDFLAGS=''
LIBOBJS=''
LIBRRD_LD_FLAGS=''
LIBS=''
LINK_OPTS=''
LTLIBOBJS=''
MACHINE=''
MAN_DIR=''
MARIADB=''
MAXMINDDB_LIB=''
MYSQL=''
MYSQL_DEP=''
MYSQL_INC=''
MYSQL_LIB=''
NDPI_CFLAGS=''
NDPI_HOME=''
NDPI_INC=''
NDPI_LIB=''
NDPI_LIBS=''
NDPI_LIB_DEP=''
NEDGE=''
NTOPNG_SHORT_VERSION=''
NTOPNG_VERSION=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME='ntopng'
PACKAGE_STRING='ntopng 4.1.200409'
PACKAGE_TARNAME='ntopng'
PACKAGE_URL=''
PACKAGE_VERSION='4.1.200409'
PATH_SEPARATOR=':'
PFRING_GIT_RELEASE=''
PFRING_VERSION=''
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
PRO_HEADERS=''
PRO_INCS=''
PRO_LIBS=''
PRO_MAKEFILE_INC=''
PRO_OBJECTS=''
PWD='/root/ntopng'
RADCLI_LIB=''
REVISION=''
RPM_SIGN_CMD=''
SERVICE_AFTER=''
SERVICE_ALIAS=''
SERVICE_REQUIRES=''
SERVICE_WANTS=''
SHELL='/bin/sh'
SQLITE_LIB=''
SSL_INC=''
SSL_LIB=''
STABLE_SUFFIX=''
SYSTEM=''
UGLIFYJS_MAJOR_VERSION=''
ac_ct_CC='gcc'
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host_alias=''
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_alias=''

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

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

configure: exit 1
 
Seems there's more broken:
  • The gcc used here is the one from lang/gcc9. This should find stdio.h when called without any further flags. Of course, problems might arise later for missing rpath trickery.
  • Where does /usr/local/bin/gcc come from? I don't think the gcc9 port installs it.
And then, the hostname suggests this is not a vanilla FreeBSD system ...

General advice:
  • Never compile something with gcc unless it's really required. According to the port of ntopng, this isn't the case here
  • If you need to compile with gcc and there isn't a port, create one and use USE_GCC= yes -- this will handle necessary trickery automatically.
 
Back
Top