[OpenWrt-Devel] autoconf getting inconsistent results

Philip Prindeville philipp_subx at redfish-solutions.com
Thu Jan 19 21:14:49 EST 2017


I’m looking at a configure.ac which is trying to detect if the platform has snprintf() or not, and it’s generating the wrong results.  Ditto for strip().  In configure.ac:

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw snprintf)


but config.log tells a different story:

configure:6281: checking for snprintf
configure:6281: x86_64-openwrt-linux-musl-gcc -o conftest -Wall -Os -pipe -march=westmere -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap /home/philipp/bertram/bmu-philip/openwrt/build_dir/target-x86_64_westmere_musl-1.1.16_powercode-bmu/lcdproc-0.5.8:lcdproc-0.5.8 -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Wall -Werror  -Wno-unused-function -I/home/philipp/bertram/bmu-philip/openwrt/staging_dir/target-x86_64_westmere_musl-1.1.16_powercode-bmu/usr/include -I/home/philipp/bertram/bmu-philip/openwrt/staging_dir/target-x86_64_westmere_musl-1.1.16_powercode-bmu/include -I/home/philipp/bertram/bmu-philip/openwrt/staging_dir/toolchain-x86_64_westmere_gcc-5.3.0_musl-1.1.16/usr/include -I/home/philipp/bertram/bmu-philip/openwrt/staging_dir/toolchain-x86_64_westmere_gcc-5.3.0_musl-1.1.16/include/fortify -I/home/philipp/bertram/bmu-philip/openwrt/staging_dir/toolchain-x86_64_westmere_gcc-5.3.0_musl-1.1.16/include  -L/home/philipp/bertram/bmu-philip/openwrt/staging_dir/target-x86_64_westmere_musl-1.1.16_powercode-bmu/usr/lib -L/home/philipp/bertram/bmu-philip/openwrt/staging_dir/target-x86_64_westmere_musl-1.1.16_powercode-bmu/lib -L/home/philipp/bertram/bmu-philip/openwrt/staging_dir/toolchain-x86_64_westmere_gcc-5.3.0_musl-1.1.16/usr/lib -L/home/philipp/bertram/bmu-philip/openwrt/staging_dir/toolchain-x86_64_westmere_gcc-5.3.0_musl-1.1.16/lib -znow -zrelro  conftest.c  >&5
conftest.c:81:6: error: conflicting types for built-in function 'snprintf' [-Werror]
 char snprintf ();
      ^
cc1: all warnings being treated as errors
configure:6281: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "lcdproc"
| #define PACKAGE_TARNAME "lcdproc"
| #define PACKAGE_VERSION "0.5.8"
| #define PACKAGE_STRING "lcdproc 0.5.8"
| #define PACKAGE_BUGREPORT "https://github.com/lcdproc/lcdproc/issues/"
| #define PACKAGE_URL ""
| #define PACKAGE "lcdproc"
| #define VERSION "0.5.8"
| #define LINUX 1
| #define SYSTEM_HOST Linux
| #define HAVE_GETLOADAVG 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_PROCFS_H 1
| #define HAVE_UTMPX_H 1
| #define HAVE_SCHED_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYSV_IPC 1
| #define HAVE_SCHED_SETSCHEDULER 1
| #define HAVE_SCHED_SETSCHEDULER 1
| #define HAVE_IOPL 1
| #define HAVE_IOPERM 1
| #define HAVE_SYS_IO_H 1
| #define HAVE_LINUX_I2C_DEV_H 1
| #define HAVE_I2C 1
| #define HAVE_LINUX_SPI_SPIDEV_H 1
| #define HAVE_SPI 1
| #define HAVE_DIRENT_H 1
| #define STDC_HEADERS 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_IO_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_STDBOOL_H 1
| #define HAVE_SA_RESTART 1
| #define TIME_WITH_SYS_TIME 1
| #define RETSIGTYPE void
| #define HAVE_SELECT 1
| #define HAVE_SOCKET 1
| #define HAVE_STRERROR 1
| #define HAVE_STRTOL 1
| #define HAVE_UNAME 1
| #define HAVE_CFMAKERAW 1
| /* end confdefs.h.  */
| /* Define snprintf to an innocuous variant, in case <limits.h> declares snprintf.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define snprintf innocuous_snprintf
| 
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char snprintf (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
| 
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| 
| #undef snprintf
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char snprintf ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_snprintf || defined __stub___snprintf
| choke me
| #endif
| 
| int
| main ()
| {
| return snprintf ();
|   ;
|   return 0;
| }
configure:6281: result: no



Is this a MUSLism (no pun intended), and if so, what’s the workaround?

It’s doing the same thing for strdup(), declaring it as:

char strdup();

which of course is wrong too.

-Philip
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list