lavv17 / lftp

sophisticated command line file transfer program (ftp, http, sftp, fish, torrent)
http://lftp.yar.ru
GNU General Public License v3.0
1.11k stars 162 forks source link

Compilation error with cdefs.h #661

Open mruprich opened 2 years ago

mruprich commented 2 years ago

I've hit this issue on ppc64le only but it has something to do with the bundled cdefs.h file. Basically one day, suddenly lftp stopped building in Fedora Rawhide with bunch of errors:

/bin/sh ../libtool --silent  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.     -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -Wall -c -o regex.lo regex.c
In file included from /usr/include/stdlib.h:1032,
                 from ./stdlib.h:36,
                 from mktime.c:49:
/usr/include/bits/stdlib-ldbl.h: In function '__LDBL_REDIR1_DECL':
/usr/include/bits/stdlib-ldbl.h:35:1: error: expected declaration specifiers before '__LDBL_REDIR1_DECL'
   35 | __LDBL_REDIR1_DECL (strtold_l, __strtoieee128_l)
      | ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/libintl.h:103,
                 from ./gettext.h:26,
                 from ./config.h:2429,
                 from ./libc-config.h:33,
                 from mktime.c:34:
./stdlib.h:832:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
  832 | _GL_CXXALIASWARN (malloc);
      | ^~~~~~~~~~~~~~~~
./stdlib.h:857:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
  857 | _GL_CXXALIAS_SYS (mbtowc, int,
      | ^~~~~~~~~~~~~~~~
./stdlib.h:857:1: error: redefinition of parameter '_gl_cxxalias_dummy'
./stdlib.h:832:1: note: previous definition of '_gl_cxxalias_dummy' with type 'int'
  832 | _GL_CXXALIASWARN (malloc);
      | ^~~~~~~~~~~~~~~~
./stdlib.h:861:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
  861 | _GL_CXXALIASWARN (mbtowc);
      | ^~~~~~~~~~~~~~~~
./stdlib.h:861:1: error: redefinition of parameter '_gl_cxxalias_dummy'
./stdlib.h:857:1: note: previous definition of '_gl_cxxalias_dummy' with type 'int'
  857 | _GL_CXXALIAS_SYS (mbtowc, int,
      | ^~~~~~~~~~~~~~~~
./stdlib.h:1481:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
 1481 | _GL_CXXALIAS_SYS (setenv, int,
      | ^~~~~~~~~~~~~~~~
./stdlib.h:1481:1: error: redefinition of parameter '_gl_cxxalias_dummy'
./stdlib.h:861:1: note: previous definition of '_gl_cxxalias_dummy' with type 'int'
  861 | _GL_CXXALIASWARN (mbtowc);
      | ^~~~~~~~~~~~~~~~
./stdlib.h:1485:1: error: storage class specified for parameter '_gl_cxxalias_dummy'
 1485 | _GL_CXXALIASWARN (setenv);
      | ^~~~~~~~~~~~~~~~
...
In file included from /usr/include/stdio.h:899,
                 from ./stdio.h:43,
                 from regex_internal.h:24,
                 from regex.c:70:
/usr/include/bits/stdio-ldbl.h: In function '__LDBL_REDIR1_DECL':
/usr/include/bits/stdio-ldbl.h:36:1: error: expected declaration specifiers before '__LDBL_REDIR1_DECL'
   36 | __LDBL_REDIR1_DECL (scanf, __isoc99_scanfieee128)
      | ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:490,
                 from /usr/include/libintl.h:23,
                 from ./gettext.h:26,
                 from ./config.h:2429,
                 from ./libc-config.h:33,
                 from regex.c:23:
/usr/include/bits/stdio-ldbl.h:86:1: error: storage class specified for parameter '__sprintf_chk'
   86 | __LDBL_REDIR2_DECL (sprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:87:1: error: storage class specified for parameter '__vsprintf_chk'
   87 | __LDBL_REDIR2_DECL (vsprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:89:1: error: storage class specified for parameter '__snprintf_chk'
   89 | __LDBL_REDIR2_DECL (snprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:90:1: error: storage class specified for parameter '__vsnprintf_chk'
   90 | __LDBL_REDIR2_DECL (vsnprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:93:1: error: storage class specified for parameter '__fprintf_chk'
   93 | __LDBL_REDIR2_DECL (fprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:94:1: error: storage class specified for parameter '__printf_chk'
   94 | __LDBL_REDIR2_DECL (printf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:95:1: error: storage class specified for parameter '__vfprintf_chk'
   95 | __LDBL_REDIR2_DECL (vfprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:96:1: error: storage class specified for parameter '__vprintf_chk'
   96 | __LDBL_REDIR2_DECL (vprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:98:1: error: storage class specified for parameter '__dprintf_chk'
   98 | __LDBL_REDIR2_DECL (dprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:99:1: error: storage class specified for parameter '__vdprintf_chk'
   99 | __LDBL_REDIR2_DECL (vdprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:102:1: error: storage class specified for parameter '__asprintf_chk'
  102 | __LDBL_REDIR2_DECL (asprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:103:1: error: storage class specified for parameter '__vasprintf_chk'
  103 | __LDBL_REDIR2_DECL (vasprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:104:1: error: storage class specified for parameter '__obstack_printf_chk'
  104 | __LDBL_REDIR2_DECL (obstack_printf_chk)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/bits/stdio-ldbl.h:105:1: error: storage class specified for parameter '__obstack_vprintf_chk'
  105 | __LDBL_REDIR2_DECL (obstack_vprintf_chk)
      | ^~~~~~~~~~~~~~~~~~
...

The list goes on but it is actually a result of lftp not being built with the system cdefs.h. This is the latest cdefs.h file: https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/cdefs.h;h=44d3826bca9f6f84f862acf1035408a587fac71d;hb=HEAD

I was trying to figure out why the system cdefs.h is not used even though the configure script checks for it. But in the end every build has a resulting Makefile that has the HAVE_SYS_CDEFS_H set to an empty string(Not 1 or 0 but actually empty). Not sure if this is intentional but lftp should either actually use the system cdefs.h or at least the bundled file could be updated to the latest version.

Regards, Michal Ruprich

jiegec commented 9 months ago

A patch for this issue can be found at https://src.fedoraproject.org/rpms/lftp/blob/rawhide/f/lftp-4.9.2-cdefs.patch