Build failure of 8.2.3510 on older Ubuntu system

65 views
Skip to first unread message

Gary Johnson

unread,
Oct 17, 2021, 4:14:26 PM10/17/21
to vim...@googlegroups.com
I have an older Ubuntu 10.04.4 system that I cannot upgrade for
various reasons. It's what I can run on that hardware. A recent
update of Vim failed to build. A git bisect narrowed it down to the
8.2.3510 commit. Here is the gcc command that failed.


gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -g3 -Wno-deprecated-declarations -DFEAT_BROWSE -DFEAT_CONCEAL -DFEAT_MOUSE_SGR -DFEAT_VARTABS -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/fileio.o fileio.c
In file included from vim.h:151,
from fileio.c:14:
feature.h:656:1: warning: "FEAT_BROWSE" redefined
<command-line>: warning: this is the location of the previous definition
fileio.c: In function ‘time_differs’:
fileio.c:3130: error: ‘stat_T’ has no member named ‘st_mtim’
fileio.c: In function ‘buf_store_time’:
fileio.c:4483: error: ‘stat_T’ has no member named ‘st_mtim’
fileio.c: In function ‘vim_opentempdir’:
fileio.c:5033: warning: implicit declaration of function ‘dirfd’
make[2]: *** [objects/fileio.o] Error 1
make[2]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
make[1]: *** [reconfig] Error 2
make[1]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
make: *** [first] Error 2


gcc is (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3.

The only customizations of the configuration or the build are the
setting of these environment variables.

export CONF_OPT_FEAT='--with-features=normal'
export CONF_OPT_CSCOPE='--enable-cscope'
export CONF_OPT_PYTHON='--enable-pythoninterp'
export CFLAGS='-g3 -Wno-deprecated-declarations -DFEAT_BROWSE -DFEAT_CONCEAL -DFEAT_MOUSE_SGR -DFEAT_VARTABS'

Regards,
Gary

Dominique Pellé

unread,
Oct 17, 2021, 4:23:49 PM10/17/21
to vim_dev
Gary Johnson <gary...@spocom.com> wrote:

> I have an older Ubuntu 10.04.4 system that I cannot upgrade for
> various reasons. It's what I can run on that hardware. A recent
> update of Vim failed to build. A git bisect narrowed it down to the
> 8.2.3510 commit. Here is the gcc command that failed.
>
>
> gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -g3 -Wno-deprecated-declarations -DFEAT_BROWSE -DFEAT_CONCEAL -DFEAT_MOUSE_SGR -DFEAT_VARTABS -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/fileio.o fileio.c
> In file included from vim.h:151,
> from fileio.c:14:
> feature.h:656:1: warning: "FEAT_BROWSE" redefined
> <command-line>: warning: this is the location of the previous definition
> fileio.c: In function ‘time_differs’:
> fileio.c:3130: error: ‘stat_T’ has no member named ‘st_mtim’
> fileio.c: In function ‘buf_store_time’:
> fileio.c:4483: error: ‘stat_T’ has no member named ‘st_mtim’
> fileio.c: In function ‘vim_opentempdir’:
> fileio.c:5033: warning: implicit declaration of function ‘dirfd’
> make[2]: *** [objects/fileio.o] Error 1
> make[2]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
> make[1]: *** [reconfig] Error 2
> make[1]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
> make: *** [first] Error 2
>
>
> gcc is (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3.

That compilation error (st_mtim -> st_mtime) is meant to be fixed
by Vim 8.2.215. Consider posting the compilation error (if any) with
the latest vim 8.2.3531.

Regards
Dominique

Gary Johnson

unread,
Oct 17, 2021, 4:32:12 PM10/17/21
to vim_dev
That's when I first noticed it, is when I updated today to 8.2.3531.
Here's the error message from that build.


gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -g3 -Wno-deprecated-declarations -DFEAT_BROWSE -DFEAT_CONCEAL -DFEAT_MOUSE_SGR -DFEAT_VARTABS -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/getchar.o getchar.c
In file included from vim.h:151,
from getchar.c:19:
feature.h:656:1: warning: "FEAT_BROWSE" redefined
<command-line>: warning: this is the location of the previous definition
fileio.c: In function ‘time_differs’:
fileio.c:3126: error: ‘stat_T’ has no member named ‘st_mtim’
fileio.c: In function ‘buf_store_time’:
fileio.c:4484: error: ‘stat_T’ has no member named ‘st_mtim’
fileio.c: In function ‘vim_opentempdir’:
fileio.c:5034: warning: implicit declaration of function ‘dirfd’
make[2]: *** [objects/fileio.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
make[1]: *** [reconfig] Error 2
make[1]: Leaving directory `/mnt/home-common/gary/src/vim-new/vim/src'
make: *** [first] Error 2


Regards,
Gary

Bram Moolenaar

unread,
Oct 17, 2021, 5:18:54 PM10/17/21
to vim...@googlegroups.com, Gary Johnson

Gary Johnson wrote:
This looks like configure defined ST_MTIM_NSEC to st_mtim.tv_nsec even
though it does not work. Please check the output of configure, should
be in src/auto/config.log

--
Wizards had always known that the act of observation changed the thing that
was observed, and sometimes forgot that it also changed the observer too.
Terry Pratchett - Interesting times

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Gary Johnson

unread,
Oct 17, 2021, 5:43:34 PM10/17/21
to vim...@googlegroups.com
I assume that this is the part of config.log you're interested in.


configure:13152: checking for nanoseconds field of struct stat
configure:13180: gcc -std=gnu99 -c -g3 -Wno-deprecated-declarations -DFEAT_BROWSE -DFEAT_CONCEAL -DFEAT_MOUSE_SGR -DFEAT_VARTABS -DST_MTIM_NSEC=st_mtim.tv_nsec conftest.c >&5
configure:13180: $? = 0
configure:13188: result: st_mtim.tv_nsec


I can work around the problem by commenting-out this #define in
vim/src/auto/config.h:

/* Define to nanoseconds field of struct stat */
#define ST_MTIM_NSEC st_mtim.tv_nsec

but I haven't worked with configure recently and don't know
immediately how to fix the root problem.

Regards,
Gary

Bram Moolenaar

unread,
Oct 18, 2021, 5:31:28 AM10/18/21
to vim...@googlegroups.com, Gary Johnson
Find this line in auto/configure:

for ac_val in st_mtim.tv_nsec st_mtim._tv_nsec st_mtim.st__tim.tv_nsec st_mtime_n st_mtimespec.tv_nsec; do

Try changing the order of the entries. I guess it might work better if
st_mtimespec.tv_nsec comes first.

Still, it is weird that the configure test would find st_mtim.tv_nsec
but it is not found when compiling. Perhaps the order of include files
matters.

--
hundred-and-one symptoms of being an internet addict:
183. You move your coffeemaker next to your computer.

Gary Johnson

unread,
Oct 18, 2021, 11:39:02 AM10/18/21
to vim...@googlegroups.com
I read auto/configure more carefully to understand it better. Then
I copied conftest.c for that test to another directory and
successfully compiled it there with

#define ST_MTIM_NSEC st_mtim.tv_nsec

So I should be able to build fileio.c with ST_MTIM_NSEC defined.
I'm thinking now that the problem is in fileio.c or vim.h or in some
other configure test.

I'm out of time this morning, but I'll look at fileio.c, vim.h and
auto/configure later and try to find what stat_T really is.

Regards,
Gary

Gary Johnson

unread,
Oct 24, 2021, 4:46:50 PM10/24/21
to vim...@googlegroups.com
I found cause of the problem.

The problem is that on this system, an i686 running Ubuntu 10.04.4,
vim's stat_T is configured to not include "struct timespec st_mtim",
but that struct is required by patch 8.2.3510, so the build fails.

On this system, stat_T is "struct stat", which is defined in
/usr/include/bits/stat.h. That struct includes "struct timespec
st_mtime" only if __USE_MISC is defined. __USE_MISC is defined in
/usr/include/features.h if either _BSD_SOURCE or _SVID_SOURCE is
defined. Those two macros are defined by default by other rules in
/usr/include/features.h which is why Vim's configure script decides
that "struct stat" contains "struct timespec st_mtime" and sets
ST_MTIM_NSEC accordingly.

The cause of the problem is here in Vim's vim.h:

39 # if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__)
40 // Needed for strptime(). Needs to be done early, since header files can
41 // include other header files and end up including time.h, where these symbols
42 // matter for Vim.
43 // 700 is needed for mkdtemp().
44 # ifndef _XOPEN_SOURCE
45 # define _XOPEN_SOURCE 700
46 # endif
47 # endif

Because /usr/include/features.h sees that _XOPEN_SOURCE is defined,
it defines neither _BSD_SOURCE nor _SVID_SOURCE and consequently
doesn't define __USE_MISC, so "struct stat" does not contain "struct
timespec st_mtime" and the build of fileio.c fails.

On my Ubuntu 20.04.3 x86_64 system, Vim builds fine because stat_T
is "struct stat64", defined in
/usr/include/x86_64-linux-gnu/bits/stat.h, and includes "struct
timespec st_mtime" only if __USE_XOPEN2K8 is defined, which it is
when vim is built as well as when configure is run.

I don't understand all the ins and outs of defining various
_*_SOURCE macros, but this problem could be fixed by having vim.h
define _BSD_SOURCE and _SVID_SOURCE when it defines _XOPEN_SOURCE,
e.g., by changing the above snippet to:

39 # if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__)
40 // Needed for strptime(). Needs to be done early, since header files can
41 // include other header files and end up including time.h, where these symbols
42 // matter for Vim.
43 // 700 is needed for mkdtemp().
44 # ifndef _XOPEN_SOURCE
45 # define _XOPEN_SOURCE 700
46 # define _BSD_SOURCE 1
47 # define _SVID_SOURCE 1
47 # define _DEFAULT_SOURCE 1
48 # endif
47 # endif

The define of _DEFAULT_SOURCE is needed to avoid warnings from the
compiler that _BSD_SOURCE and _SVID_SOURCE are now deprecated.

I realize that only one of _BSD_SOURCE and _SVID_SOURCE need to be
defined, but I didn't see a reason to choose one over the other, so
I defined both.

Regards,
Gary

Bram Moolenaar

unread,
Oct 24, 2021, 5:21:17 PM10/24/21
to vim...@googlegroups.com, Gary Johnson

On 2021-10-18, Gary Johnson wrote:

[...]

> > I read auto/configure more carefully to understand it better. Then
> > I copied conftest.c for that test to another directory and
> > successfully compiled it there with
> >
> > #define ST_MTIM_NSEC st_mtim.tv_nsec
> >
> > So I should be able to build fileio.c with ST_MTIM_NSEC defined.
> > I'm thinking now that the problem is in fileio.c or vim.h or in some
> > other configure test.
> >
> > I'm out of time this morning, but I'll look at fileio.c, vim.h and
> > auto/configure later and try to find what stat_T really is.
>
> I found cause of the problem.
>
> The problem is that on this system, an i686 running Ubuntu 10.04.4,
> vim's stat_T is configured to not include "struct timespec st_mtim",
> but that struct is required by patch 8.2.3510, so the build fails.
>
> On this system, stat_T is "struct stat", which is defined in
> /usr/include/bits/stat.h. That struct includes "struct timespec
> st_mtime" only if __USE_MISC is defined. __USE_MISC is defined in
> /usr/include/features.h if either _BSD_SOURCE or _SVID_SOURCE is
> defined. Those two macros are defined by default by other rules in
> /usr/include/features.h which is why Vim's configure script decides
> that "struct stat" contains "struct timespec st_mtime" and sets
> ST_MTIM_NSEC accordingly.
>
> The cause of the problem is here in Vim's vim.h:
>
> 39 # if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__)
> 40 // Needed for strptime(). Needs to be done early, since header files can
> 41 // include other header files and end up including time.h, where the se symbols
> 42 // matter for Vim.
> 43 // 700 is needed for mkdtemp().
> 44 # ifndef _XOPEN_SOURCE
> 45 # define _XOPEN_SOURCE 700
> 46 # endif
> 47 # endif
>
> Because /usr/include/features.h sees that _XOPEN_SOURCE is defined,
> it defines neither _BSD_SOURCE nor _SVID_SOURCE and consequently
> doesn't define __USE_MISC, so "struct stat" does not contain "struct
> timespec st_mtime" and the build of fileio.c fails.
>
> On my Ubuntu 20.04.3 x86_64 system, Vim builds fine because stat_T
> is "struct stat64", defined in
> /usr/include/x86_64-linux-gnu/bits/stat.h, and includes "struct
> timespec st_mtime" only if __USE_XOPEN2K8 is defined, which it is
> when vim is built as well as when configure is run.
>
> I don't understand all the ins and outs of defining various
> _*_SOURCE macros, but this problem could be fixed by having vim.h
> define _BSD_SOURCE and _SVID_SOURCE when it defines _XOPEN_SOURCE,
> e.g., by changing the above snippet to:
>
> 39 # if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGW=
> IN__)
> 40 // Needed for strptime(). Needs to be done early, since header file=
> s can
> 41 // include other header files and end up including time.h, where the=
> se symbols
> 42 // matter for Vim.
> 43 // 700 is needed for mkdtemp().
> 44 # ifndef _XOPEN_SOURCE
> 45 # define _XOPEN_SOURCE 700
> 46 # define _BSD_SOURCE 1
> 47 # define _SVID_SOURCE 1
> 47 # define _DEFAULT_SOURCE 1
> 48 # endif
> 47 # endif
>
> The define of _DEFAULT_SOURCE is needed to avoid warnings from the
> compiler that _BSD_SOURCE and _SVID_SOURCE are now deprecated.
>
> I realize that only one of _BSD_SOURCE and _SVID_SOURCE need to be
> defined, but I didn't see a reason to choose one over the other, so
> I defined both.

Hmm, complicated. I don't think the extra defines would be a problem,
normally _DEFAULT_SOURCE would be defined already. We can add #ifndef
to avoid any warnings when they are already defined:

# ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 700

// On old systems defining _XOPEN_SOURCE causes _BSD_SOURCE, _SVID_SOURCE
// and/or _DEFAULT_SOURCE not to be defined, so do that here.
# ifndef _BSD_SOURCE
# define _BSD_SOURCE 1
# endif
# ifndef _SVID_SOURCE
# define _SVID_SOURCE 1
# endif
# ifndef _DEFAULT_SOURCE
# define _DEFAULT_SOURCE 1
# endif
# endif


--
hundred-and-one symptoms of being an internet addict:
238. You think faxes are old-fashioned.

Gary Johnson

unread,
Oct 24, 2021, 9:36:18 PM10/24/21
to vim...@googlegroups.com
That works on both my old and new systems.

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages