tarantool / memcached

Memcached protocol 'wrapper' for tarantool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake target 'libmemcached' is broken

ligurio opened this issue · comments

sergeyb@pony:~/sources/MRG/memcached$ make libmemcached
...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
make[3]: *** [CMakeFiles/libmemcached_cfg.dir/build.make:77: CMakeFiles/libmemcached_cfg] Error 1
make[2]: *** [CMakeFiles/Makefile2:274: CMakeFiles/libmemcached_cfg.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1066: test/CMakeFiles/test-memcached-capable.dir/rule] Error 2
make: *** [Makefile:586: test-memcached-capable] Error 2

Version: 617478d
OS: Ubuntu 20.04 x86_64

configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

autoconf uses auxiliary build tools (e.g., install-sh, config.sub, config.guess, etc.), see description of AC_CONFIG_AUX_DIR in documentation. Directory for these tools could be specified with AC_CONFIG_AUX_DIR in configure.ac and it is there:

AC_CONFIG_AUX_DIR([build-aux])

However, for unknown reasons ./bootstrap.sh autoreconf (it is recommended way to generate configure script by libmemcached developers, see file README.FIRST) generates code in configure script that cannot use this directory (build-aux):

sergeyb@pony:~/sources/MRG/memcached/third_party/libmemcached$ ./bootstrap.sh autoreconf
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.         <---------------------
libtoolize: copying file 'build-aux/config.guess'
libtoolize: copying file 'build-aux/config.sub'
libtoolize: copying file 'build-aux/install-sh'                                <---------------------
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:17: installing 'build-aux/compile'
configure.ac:27: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
sergeyb@pony:~/sources/MRG/memcached/third_party/libmemcached$ ./configure 
checking for cc... cc
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... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
$ 

Part of configure script that find aux tools:

ac_aux_dir=                                                                      
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do                         
  if test -f "$ac_dir/install-sh"; then                                          
    ac_aux_dir=$ac_dir                                                           
    ac_install_sh="$ac_aux_dir/install-sh -c"                                    
    break                                                                        
  elif test -f "$ac_dir/install.sh"; then                                        
    ac_aux_dir=$ac_dir                                                           
    ac_install_sh="$ac_aux_dir/install.sh -c"                                    
    break                                                                        
  elif test -f "$ac_dir/shtool"; then                                            
    ac_aux_dir=$ac_dir                                                           
    ac_install_sh="$ac_aux_dir/shtool install -c"                                
    break                                                                        
  fi                                                                             
done                                                                             
if test -z "$ac_aux_dir"; then                                                   
  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi   

The problem can be easily fixes in autogenerated configure script with patch below:

--- configure   2021-12-02 11:17:19.717927742 +0300
+++ configure_  2021-12-02 11:20:27.180894829 +0300
@@ -3456,7 +3456,7 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.." "$srcdir/build-aux"; do
   if test -f "$ac_dir/install-sh"; then
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install-sh -c"

It is a question why autoconf haven't use directory passed in AC_CONFIG_AUX_DIR for searching auxiliary tools in autogenerated script.

Cannot reproduce on the latest version of libmemcached (https://code.launchpad.net/libmemcached)

It cannot be reproduced on upstream because AC_CONFIG_AUX_DIR moved to top level:

sergeyb@pony:~/sources/MRG/memcached/third_party/libmemcached$ diff -u configure.ac ~/sources/libmemcached/configure.ac 
--- configure.ac        2021-12-02 11:48:13.015706435 +0300
+++ /home/sergeyb/sources/libmemcached/configure.ac     2021-12-02 11:38:32.615768432 +0300
@@ -13,11 +13,12 @@
 AC_PREREQ([2.61])
 AC_INIT([libmemcached],VERSION_NUMBER,[http://libmemcached.org/])
 
+AC_CONFIG_AUX_DIR([build-aux])
+
 # Setup the compilers early on
 AC_PROG_CC([cc gcc clang])
 AC_PROG_CXX([c++ g++ clang++])
 
-AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
 AC_CANONICAL_HOST