New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to build on glibc >= 2.28 due to statx #84

Closed
maxice8 opened this Issue Oct 17, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@maxice8
Copy link
Contributor

maxice8 commented Oct 17, 2018

[11/344] Compiling C object 'src/basic/src@basic@@basic@sta/alloc-util.c.o'.
FAILED: src/basic/src@basic@@basic@sta/alloc-util.c.o 
cc -Isrc/basic/src@basic@@basic@sta -Isrc/basic -I../src/basic -Isrc/shared -I../src/shared -Isrc/systemd -I../src/systemd -Isrc/login -I../src/login -Isrc/core -I../src/core -I../src/libelogind/sd-bus -I../src/libelogind/sd-id128 -Isrc/sleep -I../src/sleep -Isrc/update-utmp -I../src/update-utmp -I. -I../ -flto -fdiagnostics-color=always -DNDEBUG -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wextra -Werror=undef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=format=2 -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Werror=shift-count-overflow -Werror=shift-overflow=2 -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -fPIE -ffunction-sections -fdata-sections -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Wno-error=nonnull -Werror=shadow -include config.h -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -fPIC -pthread -fvisibility=default  -MD -MQ 'src/basic/src@basic@@basic@sta/alloc-util.c.o' -MF 'src/basic/src@basic@@basic@sta/alloc-util.c.o.d' -o 'src/basic/src@basic@@basic@sta/alloc-util.c.o' -c ../src/basic/alloc-util.c
In file included from ../src/basic/util.h:28,
                 from ../src/basic/alloc-util.c:8:
../src/basic/missing.h:1375:8: error: redefinition of 'struct statx_timestamp'
 struct statx_timestamp {
        ^~~~~~~~~~~~~~~
In file included from /usr/include/sys/stat.h:446,
                 from ../src/basic/util.h:19,
                 from ../src/basic/alloc-util.c:8:
/usr/include/bits/statx.h:25:8: note: originally defined here
 struct statx_timestamp
        ^~~~~~~~~~~~~~~
In file included from ../src/basic/util.h:28,
                 from ../src/basic/alloc-util.c:8:
../src/basic/missing.h:1380:8: error: redefinition of 'struct statx'
 struct statx {
        ^~~~~
In file included from /usr/include/sys/stat.h:446,
                 from ../src/basic/util.h:19,
                 from ../src/basic/alloc-util.c:8:
/usr/include/bits/statx.h:36:8: note: originally defined here
 struct statx
        ^~~~~
[12/344] Compiling C object 'src/basic/src@basic@@basic@sta/audit-util.c.o'.
ninja: build stopped: subcommand failed.

There is a patch on https://github.com/void-linux/void-packages/blob/222eb183af9a03635bb3e4552c125417e72d74ae/srcpkgs/elogind/patches/fix-glibc-statx.patch

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Oct 18, 2018

How can this be? This ought to have been dealt with in #74 already.

The patch linked does not cut it. First, there is an error not removing the original "have = " line in meson.build. Second, statx is already checked for at that very place. And finally the block checks again with including linux/stat.h, which is already in decl_headers.

Honestly I am completely at sea here why it doesn't work for you as it is right now. But I will update to glibc-2.28 soon, and then test for myself.

If it helps to uncover something like this earlier, I have started tweeting about current delays and upcoming releases using #elogind with my twitter account @Yamakuzure.
Maybe we can fix such issues in the future before a new release comes out.

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Oct 18, 2018

@maxice8 : Just out of curiosity: Could it be that glibc is built without -D_GNU_SOURCE?

@perfect7gentleman

This comment has been minimized.

Copy link

perfect7gentleman commented Oct 18, 2018

$ qlist -Iv glibc
sys-libs/glibc-2.28
$ qlist -Iv elogind
sys-auth/elogind-239.9999

no problems

@maxice8

This comment has been minimized.

Copy link
Contributor Author

maxice8 commented Oct 18, 2018

@maxice8 : Just out of curiosity: Could it be that glibc is built without -D_GNU_SOURCE?

adding CFLAGS="-D_GNU_SOURCE" to the environment fixes it, seems like meson.build is expecting it to be set.

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Oct 18, 2018

@maxice8 : Just out of curiosity: Could it be that glibc is built without -D_GNU_SOURCE?

adding CFLAGS="-D_GNU_SOURCE" to the environment fixes it, seems like meson.build is expecting it to be set.

No, not really.
Here it is set for the build:

conf.set('_GNU_SOURCE', true)

Here it is set when checking for statx:
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Oct 22, 2018

I have upgraded to glibc-2.28 and rebuilt elogind-239.1. No failures. Build, tests and install work as expected.

However, I think I have a possible solution. Could you please try out this patch?

--- a/meson.build     2018-10-22 09:16:57.134301263 +0200
+++ b/meson.build 2018-10-22 09:17:17.559300777 +0200
@@ -494,6 +494,7 @@
 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
 
 decl_headers = '''
+#define _GNU_SOURCE 1
 #include <uchar.h>
 #include <linux/ethtool.h>
 #include <linux/fib_rules.h>

If I am putting together 1 and 1 correctly, this should be enough.

@Yamakuzure

This comment has been minimized.

Copy link
Collaborator

Yamakuzure commented Oct 23, 2018

Just thought I note this here:

https://bugs.gentoo.org/show_bug.cgi?id=662776 😁

Yamakuzure added a commit that referenced this issue Nov 8, 2018

Prep v240: Fix struct statx detection when _GNU_SOURCE is not in ENV
Bug: #84
Closes: #84
Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment