[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mkstemp test sets wrong variable when cross-compiling
From: |
Pierre Labastie |
Subject: |
mkstemp test sets wrong variable when cross-compiling |
Date: |
Tue, 23 Feb 2010 19:57:16 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090706) |
Hi everybody,
Let me introduce myself. I am a French professor (of physics) at the
university of Toulouse, and as a hobby, I build gnu/linux systems from
scratch. May seem weird. Well, some repair old cars. I build systems...
Right now, I am trying to build a whole system by faking cross
compilation, in order to insulate the new system executables and
(specially) libraries from the old. That is how I found the following
bug in ncurses:
When cross-compiling, the variable ac_cv_func_mkstemp is set to yes or
no depending on whether mkstemp can be linked or not, while in a native
build, it is the variable cf_cv_func_mkstemp which is used. This results
in HAVE_MKSTEMP not being set in the case of cross-compiling, even if
mkstemp can be linked. I do not know if it is on purpose. However the
logic is clearly wrong...
Here is a patch:
----------------------------
--- ncurses-5.7.old/aclocal.m4 2010-02-23 12:33:35.000000000 +0100
+++ ncurses-5.7/aclocal.m4 2010-02-23 12:18:53.000000000 +0100
@@ -3721,6 +3721,7 @@
],[cf_cv_func_mkstemp=yes
],[cf_cv_func_mkstemp=no
],[AC_CHECK_FUNC(mkstemp)
+cf_cv_func_mkstemp=$ac_cv_func_mkstemp
])
])
if test "$cf_cv_func_mkstemp" = yes ; then
----------------------------------------------
The reason for the variable mismatch is that AC_CHECK_FUNC only works
with ac_cv_... variables.
And now the bug (may be to detailed). I have applied all the patches (up
to 20100220) to the release version of ncurses-5.7, and managed to
regenerate configure with autoconf-2.52.20081225 as checked out from
ftp://invisible-island.net
----------------------------------------------------
What I do
----------------------------------------------------
I have a config.site file which contains (I think only the first line is
useful for what comes next):
test "$prefix" = NONE && prefix=/usr
test "$mandir" = '${prefix}/man' && mandir='${prefix}/share/man'
test "$infodir" = '${prefix}/info' && infodir='${prefix}/share/info'
test -z "$CFLAGS" && CFLAGS="-O2 -pipe"
test -z "$CXXFLAGS" && CXXFLAGS=${CFLAGS}
then the command is:
./configure \
--build=$(./config.guess) \
--host=i686-lfs-linux-gnu \
--with-build-cppflags=-D_GNU_SOURCE \
--with-shared \
--without-debug \
--enable-widec \
--enable-big-core \
--with-install-prefix=$HOME/diybuild/root
Some flags need explanation:
the --with-build-cppflags=-D_GNU_SOURCE is necessary because there are
no test with BUILD-CC, and this define is necessary to have wint_t
(would you be interested in my adding a test for this flag in
configure.in?). Without the flag, tinfo/make_hash.c does not compile.
the --enable-big-core is there because otherwise 'configure' assumes a
small memory in case of cross-compilation. Maybe this behavior should be
obsoleted. Even embedded devices have more than 4Mb RAM now.
------------------------------------------
What I see in config.log
------------------------------------------
[snip]
configure:14215: checking for working mkstemp
configure:14223: checking for mkstemp
configure:14260: i686-lfs-linux-gnu-gcc -o conftest -O2 -pipe --param
max-inline-insns-single=1200 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-DNDEBUG conftest.c >&5
configure:14263: $? = 0
configure:14266: test -s conftest
configure:14269: $? = 0
configure:14279: result: yes
configure:14345: result:
[snip]
## ----------------------- ##
## Running config.status. ##
## ----------------------- ##
This file was extended by config.status 2.52.20081225, executed with
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
> ./config.status
on vieuxboli
config.status:18820: creating include/MKterm.h.awk
config.status:18820: creating include/curses.head
config.status:18820: creating include/ncurses_dll.h
config.status:18820: creating include/termcap.h
config.status:18820: creating include/unctrl.h
config.status:18820: creating man/Makefile
config.status:18820: creating include/Makefile
config.status:18820: creating ncurses/Makefile
config.status:18820: creating progs/Makefile
config.status:18820: creating panel/Makefile
config.status:18820: creating menu/Makefile
config.status:18820: creating form/Makefile
config.status:18820: creating test/Makefile
config.status:18820: creating misc/Makefile
config.status:18820: creating c++/Makefile
config.status:18820: creating Ada95/gen/adacursesw-config
config.status:18820: creating misc/run_tic.sh
config.status:18820: creating misc/ncurses-config
config.status:18820: creating Makefile
config.status:18917: creating include/ncurses_cfg.h
## ----------------- ##
## Cache variables. ##
## ----------------- ##
---------------------------
from there, I give you a diff with config.log coming from a run of
configure with the command:
./configure \
--with-shared \
--without-debug \
--enable-widec \
--with-install-prefix=$HOME/diybuild/root
---------------
--- config.log.cross 2010-02-23 19:27:53.000000000 +0100
+++ config.log.nativ 2010-02-23 19:27:10.000000000 +0100
@@ -4,7 +4,7 @@
It was created by configure, which was
generated by GNU Autoconf 2.52.20081225. Invocation command line was
- $ ./configure --build=i686-pc-linux-gnu --host=i686-lfs-linux-gnu
--with-build-cppflags=-D_GNU_SOURCE --with-shared --without-debug
--enable-widec --enable-big-core
-with-install-prefix=/home/pierre/diybuild/root
+ $ ./configure --with-shared --without-debug --enable-widec
--with-install-prefix=/home/pierre/diybuild/root
[snip: a lot of diffs due to the different names of executables]
@@ -1609,10 +1624,10 @@
ac_cv_env_CXX_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
-ac_cv_env_build_alias_set='set'
-ac_cv_env_build_alias_value='i686-pc-linux-gnu'
-ac_cv_env_host_alias_set='set'
-ac_cv_env_host_alias_value='i686-lfs-linux-gnu'
+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_func_btowc='yes'
@@ -1633,7 +1648,6
@@
ac_cv_func_mbstowcs='yes'
ac_cv_func_mbtowc='yes'
ac_cv_func_memmove='yes'
-ac_cv_func_mkstemp='yes'
ac_cv_func_poll='yes'
ac_cv_func_putwc='yes'
ac_cv_func_remove='yes'
@@ -1641,6 +1655,7
@@
ac_cv_func_setbuf='yes'
ac_cv_func_setbuffer='yes'
ac_cv_func_setvbuf='yes'
+ac_cv_func_setvbuf_reversed='no'
ac_cv_func_sigaction='yes'
ac_cv_func_sigvec='yes'
ac_cv_func_strdup='yes'
@@ -1688,24 +1703,25
@@
ac_cv_header_unistd_h='yes'
ac_cv_header_vfork_h='no'
ac_cv_header_wctype_h='yes'
-ac_cv_host='i686-lfs-linux-gnu'
-ac_cv_host_alias='i686-lfs-linux-gnu'
+ac_cv_host='i686-pc-linux-gnu'
+ac_cv_host_alias='i686-pc-linux-gnu'
ac_cv_lib_dir_opendir='no'
ac_cv_lib_util_openpty='yes'
ac_cv_objext='o'
+ac_cv_path_CXX='/usr/bin/g++'
+ac_cv_path_LDCONFIG='/sbin/ldconfig'
ac_cv_path_PKG_CONFIG='/usr/bin/pkg-config'
ac_cv_path_install='/usr/bin/install -c'
-ac_cv_prog_AR='i686-lfs-linux-gnu-ar'
ac_cv_prog_AWK='mawk'
-ac_cv_prog_BUILD_CC='gcc'
-ac_cv_prog_CC='i686-lfs-linux-gnu-gcc'
-ac_cv_prog_CPP='i686-lfs-linux-gnu-gcc
-E'
-ac_cv_prog_CXX='i686-lfs-linux-gnu-g++'
-ac_cv_prog_CXXCPP='i686-lfs-linux-gnu-g++
-E'
-ac_cv_prog_LD='i686-lfs-linux-gnu-ld'
+ac_cv_prog_CPP='gcc
-E'
+ac_cv_prog_CXXCPP='/usr/bin/g++
-E'
ac_cv_prog_MAKE_LOWER_TAGS='yes'
ac_cv_prog_MAKE_UPPER_TAGS='yes'
-ac_cv_prog_RANLIB='i686-lfs-linux-gnu-ranlib'
+ac_cv_prog_ac_ct_AR='ar'
+ac_cv_prog_ac_ct_CC='gcc'
+ac_cv_prog_ac_ct_CXX='g++'
+ac_cv_prog_ac_ct_LD='ld'
+ac_cv_prog_ac_ct_RANLIB='ranlib'
ac_cv_prog_cc_g='yes'
ac_cv_prog_cc_stdc=''
ac_cv_prog_cxx_g='yes'
@@ -1719,8
+1735,8@@
ac_cv_sys_largefile_CC='no'
ac_cv_sys_largefile_source='no'
ac_cv_sys_long_file_names='yes'
-ac_cv_target='i686-lfs-linux-gnu'
-ac_cv_target_alias='i686-lfs-linux-gnu'
+ac_cv_target='i686-pc-linux-gnu'
+ac_cv_target_alias='i686-pc-linux-gnu'
ac_cv_type_pid_t='yes'
ac_cv_type_signal='void'
ac_cv_type_signed_char='yes'
@@ -1731,7 +1747,7
@@
cf_cv_ar_flags='-curv'
cf_cv_builtin_bool='1'
cf_cv_cc_bool_type='0'
-cf_cv_cpp_param_init='unknown'
+cf_cv_cpp_param_init='no'
cf_cv_cpp_static_cast='yes'
cf_cv_dcl_errno='yes'
cf_cv_define_sigwinch='yes'
@@ -1740,7 +1756,8
@@
cf_cv_enable_lp64='0'
cf_cv_enable_opaque='NCURSES_OPAQUE'
cf_cv_enable_reentrant='0'
-cf_cv_func_nanosleep='unknown'+cf_cv_func_mkstemp='yes'
+cf_cv_func_nanosleep='yes'
cf_cv_func_openpty='pty.h'
cf_cv_func_vsscanf='vsscanf'
cf_cv_gcc_inline='yes'
@@ -1752,7 +1769,8
@@
cf_cv_ld_rpath='no'
cf_cv_lib_util='yes'
cf_cv_libstdcpp='no'
-cf_cv_link_dataonly='unknown'
+cf_cv_link_dataonly='yes'
+cf_cv_link_funcs=' link
symlink'
cf_cv_makeflags=''
cf_cv_mbstate_t='yes'
cf_cv_mixedcase='yes'
@@ -1771,8 +1789,8
@@
cf_cv_struct_dirent64='no'
cf_cv_sys_time_select='yes'
cf_cv_system_name='linux-gnu'
-cf_cv_timestamp='Tue Feb 23 19:27:34 CET
2010'
-cf_cv_type_of_bool='unsigned'
+cf_cv_timestamp='Tue Feb 23 19:26:44 CET
2010'
+cf_cv_type_of_bool='unsigned
char'cf_cv_type_sigaction='no'
cf_cv_typeof_chtype='long'
cf_cv_typeof_mmask_t='long'
@@ -1780,7 +1798,7
@@
cf_cv_wchar_t='no'
cf_cv_weak_symbols='no'
cf_cv_wint_t='yes'
-cf_cv_working_poll='unknown'
+cf_cv_working_poll='yes'
## ------------ ##
## confdefs.h. ##
@@ -1894,13 +1912,16 @@
#define HAVE_TIMES 1
#define HAVE_VSNPRINTF 1
#define HAVE_ISASCII 1
+#define HAVE_NANOSLEEP 1
#define HAVE_TERMIO_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_TCGETATTR 1
#define HAVE_VSSCANF 1
+#define HAVE_MKSTEMP 1
#define RETSIGTYPE void
#define HAVE_SIZECHANGE 1
+#define HAVE_WORKING_POLL 1
#define HAVE_UNISTD_H 1
#define HAVE_FORK 1
#define HAVE_VFORK 1
----------------------------------
NB: the HAVE_NANOSLEEP and HAVE_WORKING_POLL differences come from
pessimistic assumptions about the target host, which cannot be avoided.
Hope it helps
Pierre
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- mkstemp test sets wrong variable when cross-compiling,
Pierre Labastie <=