Hi, after having worked around the "apparent CFLAGS mismatch" problem, I hitanother cross-compilation error while trying to build cyrus-sasl in buildroot:
$ make cyrus-sasl-dirclean $ make cyrus-sasl 2>&1 | tee cyrus-sasl.log [...]/home/murray/devel/buildroot/output/host/usr/bin/ccache /home/murray/devel/buildroot/output/host/usr/bin/arm-linux-gcc -Wall -W -Os -pipe -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o makemd5 makemd5.o -lresolv
rm -f md5global.h ./makemd5 md5global.h /bin/bash: ./makemd5: cannot execute binary file make[3]: *** [md5global.h] Error 126 [...]The problem here is pretty clear: makemd5, which is meant to run on the host,
has been cross-compiled instead: $ file output/build/cyrus-sasl-2.1.24rc1/include/makemd5output/build/cyrus-sasl-2.1.24rc1/include/makemd5: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, not stripped
Attached is my patch to allow makemd5 to correctly (non-cross) compiled. Basically, it consists in replacing $(CC) with $(HOSTCC) in cyrus-sasl's include/Makefile.in. Note that I'm not the first that faced this problem. My patch has been inspired by: http://tech.dir.groups.yahoo.com/group/nslu2-linux/message/4044?var=0 The build log is attached too. Luca
Attachment:
cyrus-sasl-makemd5.log.gz
Description: GNU Zip compressed data
Fix HOSTCC and related variables. Patch inspired by: http://tech.dir.groups.yahoo.com/group/nslu2-linux/message/4044?var=0 diff -r -u cyrus-sasl-2.1.24rc1-orig//include/Makefile.in cyrus-sasl-2.1.24rc1/include/Makefile.in --- cyrus-sasl-2.1.24rc1-orig/include/Makefile.in 2009-05-07 16:24:46.000000000 +0200 +++ cyrus-sasl-2.1.24rc1/include/Makefile.in 2011-05-05 12:29:38.036844027 +0200 @@ -266,12 +266,12 @@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/makemd5.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +COMPILE = $(HOSTCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(HOSTCFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(HOSTCC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(HOSTCFLAGS) +CCLD = $(HOSTCC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(HOSTCFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(makemd5_SOURCES) DATA = $(frameheader_DATA)