Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Build fails from AUR "wlroots-git" #2273

Closed
joachimneu opened this issue Jun 11, 2020 · 8 comments · Fixed by #2274
Closed

Build fails from AUR "wlroots-git" #2273

joachimneu opened this issue Jun 11, 2020 · 8 comments · Fixed by #2274

Comments

@joachimneu
Copy link

When trying to install "wlroots-git" from AUR, the build fails with:

Build targets in project: 116

wlroots 0.10.0

        systemd: 1
        elogind: 0
       xwayland: 1
    x11_backend: 1
      xcb-icccm: 1
     xcb-errors: 1

Found ninja-1.10.0 at /usr/bin/ninja
ninja: Entering directory `build'
[296/326] Compiling C object 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o'
FAILED: examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o 
cc -Iexamples/c590b3c@@screencopy-dmabuf@exe -Iexamples -I../examples -Iprotocol -I/usr/lib/libffi-3.2.1/include -I/usr/include/libpng16 -I/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -DWLR_USE_UNSTABLE -Wundef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wstrict-prototypes -Wimplicit-fallthrough=2 -Wendif-labels -Wstrict-aliasing=2 -Woverflow -Wmissing-prototypes -Wno-missing-braces -Wno-missing-field-initializers -Wno-unused-parameter -fmacro-prefix-map=../= -DLIBINPUT_MAJOR=1 -DLIBINPUT_MINOR=15 -DLIBINPUT_PATCH=4 '-DICONDIR="/usr/share/icons"' -march=x86-64 -mtune=generic -O2 -fno-plt -g -fvar-tracking-assignments -fdebug-prefix-map=/home/joachim/.cache/yay/wlroots-git/src=/usr/src/debug -D_FORTIFY_SOURCE=2 -MD -MQ 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o' -MF 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o.d' -o 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o' -c ../examples/screencopy-dmabuf.c
In file included from /usr/include/string.h:495,
                 from ../examples/screencopy-dmabuf.c:33:
In function ‘strncpy’,
    inlined from ‘find_render_node’ at ../examples/screencopy-dmabuf.c:90:3,
    inlined from ‘main’ at ../examples/screencopy-dmabuf.c:291:7:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
[304/326] Generating symbol file 'wlroots@sha/libwlroots.so.5.symbols'
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...
Error making: wlroots-git
@jtheoof
Copy link

jtheoof commented Jun 11, 2020

Hi @emersion @any1 it looks like commit: e0d4f7517: examples: Add screencopy-dmabuf example is now causing compiling errors on Arch systems.

ninja: Entering directory `build'
[20/21] Compiling C object 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o'
FAILED: examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o
ccache cc -Iexamples/c590b3c@@screencopy-dmabuf@exe -Iexamples -I../examples -Iprotocol -I/usr/include/libpng16 -I/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -DWLR_USE_UNSTABLE -Wundef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wstrict-prototypes -Wimplicit-fallthrough=2 -Wendif-labels -Wstrict-aliasing=2 -Woverflow -Wmissing-prototypes -Wno-missing-braces -Wno-missing-field-initializers -Wno-unused-parameter -fmacro-prefix-map=../= -DLIBINPUT_MAJOR=1 -DLIBINPUT_MINOR=15 -DLIBINPUT_PATCH=5 '-DICONDIR="/usr/share/icons"' -march=x86-64 -mtune=generic -O2 -fno-plt -g -fvar-tracking-assignments -fdebug-prefix-map=/home/jattali/.cache/yay/wlroots-git/src=/usr/src/debug -D_FORTIFY_SOURCE=2 -MD -MQ 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o' -MF 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o.d' -o 'examples/c590b3c@@screencopy-dmabuf@exe/screencopy-dmabuf.c.o' -c ../examples/screencopy-dmabuf.c
In file included from /usr/include/string.h:495,
                 from ../examples/screencopy-dmabuf.c:33:
In function ‘strncpy’,
    inlined from ‘find_render_node’ at ../examples/screencopy-dmabuf.c:90:3,
    inlined from ‘main’ at ../examples/screencopy-dmabuf.c:291:7:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

However it's only happening when building straight for AUR. If I try the same build parameters as the PKGBUILD suggests, I cannot reproduce this issue. I am a bit puzzled.

See #2133

@emersion
Copy link
Member

Does this patch fix the issue?

diff --git a/examples/screencopy-dmabuf.c b/examples/screencopy-dmabuf.c
index ea6b9f50a73f..ebc6ea759bae 100644
--- a/examples/screencopy-dmabuf.c
+++ b/examples/screencopy-dmabuf.c
@@ -87,7 +87,7 @@ static bool find_render_node(char *node, size_t maxlen) {
                        continue;
                }
 
-               strncpy(node, dev->nodes[DRM_NODE_RENDER], maxlen);
+               strncpy(node, dev->nodes[DRM_NODE_RENDER], maxlen - 1);
                node[maxlen - 1] = '\0';
                r = true;
                break;

@any1
Copy link
Contributor

any1 commented Jun 11, 2020

Yeah, that warning is rather annoying, and quite pointless in this case. Would people be opposed to adding strlcpy to the project?
cc @ddevault

@emersion
Copy link
Member

We can't use strlcpy because it's non-standard.

@any1
Copy link
Contributor

any1 commented Jun 11, 2020

Many projects include an implementation of strlcpy for compatibility.

@ddevault
Copy link
Contributor

Meh. Looks like gcc covers our ass anyway.

@jtheoof
Copy link

jtheoof commented Jun 11, 2020

@emersion your patch fixes the issue. Thanks.

emersion added a commit to emersion/wlroots that referenced this issue Jun 11, 2020
The original code wasn't wrong since we were manually writing a null
byte anyway, but this makes GCC happy.

Closes: swaywm#2273
ddevault pushed a commit that referenced this issue Jun 11, 2020
The original code wasn't wrong since we were manually writing a null
byte anyway, but this makes GCC happy.

Closes: #2273
@joachimneu
Copy link
Author

Great, thanks! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

5 participants