avast/retdec

yaracpp build fails with "configure: error: cannot run C compiled programs"

jasonboggess opened this issue · 6 comments

Steps to reproduce:

  1. Followed instructions in README.MD
  2. Fixed issues with Bison (see avast/yaramod#11)
  3. Run make

Build fails with Error 2 on step yaracpp-project

yaracpp-project-build-err.log:

configure.ac:15: installing './compile'
configure.ac:5: installing './missing'
Makefile.am: installing './depcomp'
configure: error: in `/Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make[5]: *** [deps/yara/src/yara-stamp/yara-configure-linux] Error 1
make[4]: *** [deps/CMakeFiles/yara.dir/all] Error 2
make[3]: *** [all] Error 2

Hi. Could you please attach /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/config.log? It will contain the reason why the configure step failed.

Also, could you please try building the upstream version of YARA by performing the following steps?

git clone https://github.com/VirusTotal/yara
cd yara
./build.sh

If the build fails, please attach config.log.

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 yara configure 3.6.3, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --prefix= --disable-shared --without-crypto CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc

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

hostname = Jasons-MacBook-Air.local
uname -m = x86_64
uname -r = 18.0.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64

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

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
	 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 409 tasks, 1782 threads, 4 processors
Load average: 3.00, Mach factor: 1.21
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/opt/flex/bin
PATH: /usr/local/opt/bison/bin
PATH: /usr/local/opt/flex/bin
PATH: /usr/local/opt/bison/bin
PATH: /Users/me/.fastlane/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/X11/bin
PATH: /Library/Frameworks/Mono.framework/Versions/Current/Commands
PATH: /usr/local/git/bin
PATH: /usr/local/Cellar/postgresql/9.6.1/bin
PATH: /Users/me/dev/play-2.2.1
PATH: /Users/me/Library/Android/sdk/platform-tools


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

configure:2313: checking for a BSD-compatible install
configure:2381: result: /usr/bin/install -c
configure:2392: checking whether build environment is sane
configure:2447: result: yes
configure:2598: checking for a thread-safe mkdir -p
configure:2637: result: ./install-sh -c -d
configure:2644: checking for gawk
configure:2674: result: no
configure:2644: checking for mawk
configure:2674: result: no
configure:2644: checking for nawk
configure:2674: result: no
configure:2644: checking for awk
configure:2660: found /usr/bin/awk
configure:2671: result: awk
configure:2682: checking whether make sets $(MAKE)
configure:2704: result: yes
configure:2733: checking whether make supports nested variables
configure:2750: result: yes
configure:2889: checking whether make supports the include directive
configure:2904: make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:2907: $? = 0
configure:2926: result: yes (GNU style)
configure:2996: checking for gcc
configure:3023: result: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
configure:3252: checking for C compiler version
configure:3261: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc --version >&5
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3272: $? = 0
configure:3261: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -v >&5
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3272: $? = 0
configure:3261: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3272: $? = 1
configure:3261: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:3272: $? = 1
configure:3292: checking whether the C compiler works
configure:3314: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc    conftest.c  >&5
configure:3318: $? = 0
configure:3366: result: yes
configure:3369: checking for C compiler default output file name
configure:3371: result: a.out
configure:3377: checking for suffix of executables
configure:3384: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -o conftest    conftest.c  >&5
configure:3388: $? = 0
configure:3410: result: 
configure:3432: checking whether we are cross compiling
configure:3440: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -o conftest    conftest.c  >&5
conftest.c:11:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
configure:3444: $? = 1
configure:3451: ./conftest
./configure: line 3453: ./conftest: No such file or directory
configure:3455: $? = 127
configure:3462: error: in `/Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara':
configure:3464: 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_CC_set=set
ac_cv_env_CC_value=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
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_YACC_set=
ac_cv_env_YACC_value=
ac_cv_env_YFLAGS_set=
ac_cv_env_YFLAGS_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_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_ac_ct_CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

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

ACLOCAL='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/missing aclocal-1.16'
ADDRESS_SANITIZER_FALSE=''
ADDRESS_SANITIZER_TRUE=''
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AUTOCONF='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/missing autoconf'
AUTOHEADER='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/missing autoheader'
AUTOMAKE='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/missing automake-1.16'
AWK='awk'
CC='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc'
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CUCKOO_MODULE_FALSE=''
CUCKOO_MODULE_TRUE=''
CYGPATH_W='echo'
DEBUG_FALSE=''
DEBUG_TRUE=''
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DOTNET_MODULE_FALSE=''
DOTNET_MODULE_TRUE=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GCC_FALSE=''
GCC_TRUE=''
GREP=''
HASH_MODULE_FALSE=''
HASH_MODULE_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LEX=''
LEXLIB=''
LEX_OUTPUT_ROOT=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAGIC_MODULE_FALSE=''
MAGIC_MODULE_TRUE=''
MAKEINFO='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='./install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OPTIMIZATION_FALSE=''
OPTIMIZATION_TRUE=''
OTOOL64=''
OTOOL=''
PACKAGE='yara'
PACKAGE_BUGREPORT='vmalvarez@virustotal.com'
PACKAGE_NAME='yara'
PACKAGE_STRING='yara 3.6.3'
PACKAGE_TARNAME='yara'
PACKAGE_URL=''
PACKAGE_VERSION='3.6.3'
PATH_SEPARATOR=':'
PTHREAD_CC=''
PTHREAD_CFLAGS=''
PTHREAD_LIBS=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='3.6.3'
YACC=''
YFLAGS=''
ac_ct_AR=''
ac_ct_CC='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc'
ac_ct_DUMPBIN=''
acx_pthread_config=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__nodep='_no'
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /Users/me/dev/retdec/build/external/src/yaracpp-project-build/deps/yara/src/yara/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix=''
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 "yara"
#define PACKAGE_TARNAME "yara"
#define PACKAGE_VERSION "3.6.3"
#define PACKAGE_STRING "yara 3.6.3"
#define PACKAGE_BUGREPORT "vmalvarez@virustotal.com"
#define PACKAGE_URL ""
#define PACKAGE "yara"
#define VERSION "3.6.3"

configure: exit 1

it looks like ./build.sh succeeded

Could you please try installing Xcode’s command-line tools as suggested in frida/frida#338 (comment), cleaning the build directory of RetDec and re-trying the build?

That seems to have fixed it. thanks

Great 👍