~scoopta/wlrobs#27: 
Building failure at "ninja -C build"

I'm trying to build it and got this error: https://i.imgur.com/NW75L9q.png

What should I do to fix it?

Status
RESOLVED FIXED
Submitter
~shiro
Assigned to
No-one
Submitted
4 months ago
Updated
a month ago
Labels
No labels applied.

~scoopta 4 months ago

What distro are you on? Screenshot makes me guess mint but what version? I ask because while I can pretty easily fix this error I'm slightly worried about the fact that your build scripts seem to be generated with -Werror which will make any warning fail to compile and is not what meson should output by default according to their documentation. As far as a quick fix goes you should be able disable it by doing meson setup build -Dwerror=false after deleting your build folder.

~lilydjwg a month ago

The -Werror is introduced by libobs.pc shipped by obs-studio. meson setup build -Dwerror=false won't work. It's not easy to find out.

~trinitronx a month ago

Also affects Arch Linux and the wlrobs-hg AUR package. It's probably a simple fix, as it's warning of unused result: -Werror=unused-result. We are seeing this error due to -Werror from libobs.pc as of today:

$ yay -Syu --sudoloop
==> Making package: wlrobs-hg r72.958a52be0f0f-1 (Fri 20 Dec 2024 07:28:29 AM MST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Starting build()...
The Meson build system
Version: 1.6.0
Source dir: /home/exampleuser/.cache/yay/wlrobs-hg/src/wlrobs
Build dir: /home/exampleuser/.cache/yay/wlrobs-hg/src/wlrobs/build
Build type: native build
Project name: wlrobs
Project version: undefined
C compiler for the host machine: cc (gcc 14.2.1 "cc (GCC) 14.2.1 20240910")
C linker for the host machine: cc ld.bfd 2.43.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/bin/pkg-config) 2.3.0
Run-time dependency wayland-client found: YES 1.23.1
Run-time dependency libobs found: YES 31.0.0
Library dl found: YES
Library rt found: YES
Build targets in project: 1

wlrobs undefined

  User defined options
    werror: false

Found ninja-1.12.1 at /usr/bin/ninja
ninja: Entering directory `build'                                                                             
[6/7] Compiling C object libwlrobs.so.p/src_scpy_source.c.o
FAILED: libwlrobs.so.p/src_scpy_source.c.o 
cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/src_scpy_source.c.o -MF libwlrobs.so.p/src_scpy_source.c.o.d -o libwlrobs.so.p/src_scpy_source.c.o -c ../src/scpy_source.c
../src/scpy_source.c: In function ‘buffer’:
../src/scpy_source.c:241:9: error: ignoring return value of ‘ftruncate’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  241 |         ftruncate(this->frame->fd, stride * height);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: wlrobs-hg-exit status 4

The -Werror flag appears to be introduced to the meson build by libobs.pc via pkg-config:

$ pkg-config --cflags libobs
-std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror
$ cat /usr/lib/pkgconfig/libobs.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libobs
Description: OBS Studio core compositor library
Version: 31.0.0

Requires:
Libs: -L${libdir} -lobs
Libs.private: -pthread -lm
Cflags: -I${includedir} -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror

~scoopta a month ago

Try building this commit, this should silence the warning c5b3be83bfcc. What really confuses me though is that on debian sid with glibc 2.40 this doesn't even trigger a warning as ftruncate() doesn't seem to be declared with warn_unused_result

~trinitronx a month ago

Try building this commit, this should silence the warning c5b3be83bfcc

Unfortunately, it looks like gcc is still throwing the error in this case:

$ makepkg --cleanbuild --sign -f
==> Making package: wlrobs-hg r73.c5b3be83bfcc-1 (Mon 23 Dec 2024 01:43:55 PM MST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating wlrobs hg repo...
pulling from https://hg.sr.ht/~scoopta/wlrobs
searching for changes
no changes found
==> Validating source files with md5sums...
    wlrobs ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of wlrobs hg repo...
updating to branch default
18 files updated, 0 files merged, 0 files removed, 0 files unresolved
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
[...SNIP...]
ninja: Entering directory `build'
[1/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o -c ../proto/xdg-output-unstable-v1-protocol.c
[2/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o -c ../proto/wlr-screencopy-unstable-v1-protocol.c
[3/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o -c ../proto/wlr-export-dmabuf-unstable-v1-protocol.c
[4/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/src_main.c.o -MF libwlrobs.so.p/src_main.c.o.d -o libwlrobs.so.p/src_main.c.o -c ../src/main.c
[5/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/src_scpy_source.c.o -MF libwlrobs.so.p/src_scpy_source.c.o.d -o libwlrobs.so.p/src_scpy_source.c.o -c ../src/scpy_source.c
FAILED: libwlrobs.so.p/src_scpy_source.c.o 
cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/src_scpy_source.c.o -MF libwlrobs.so.p/src_scpy_source.c.o.d -o libwlrobs.so.p/src_scpy_source.c.o -c ../src/scpy_source.c
../src/scpy_source.c: In function ‘buffer’:
../src/scpy_source.c:241:16: error: ignoring return value of ‘ftruncate’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  241 |         (void) ftruncate(this->frame->fd, stride * height);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
[6/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=3 -O2 -fPIC -std=gnu17 -fPIC -fvisibility=hidden -fopenmp-simd -Werror -MD -MQ libwlrobs.so.p/src_dmabuf_source.c.o -MF libwlrobs.so.p/src_dmabuf_source.c.o.d -o libwlrobs.so.p/src_dmabuf_source.c.o -c ../src/dmabuf_source.c
ninja: build stopped: subcommand failed.
==> ERROR: A failure occurred in build().
    Aborting...

It seems that the expected solution is to handle the error case rather than trying to tell gcc to ignore it with (void).

What really confuses me though is that on debian sid with glibc 2.40 this doesn't even trigger a warning as ftruncate() doesn't seem to be declared with warn_unused_result

#TLDR;

On Debian Sid, we can reproduce this by manually defining _FORTIFY_SOURCE=3. Add -D_FORTIFY_SOURCE=3 to the build's CFlags.

#Detailed Exploration

At first, I could not reproduce the build error on Debian Sid either.

I saw the same thing while testing the build in a debian:sid docker container. With or without both -Wall and -Wextra, the warning wasn't showing up. By default, the libobs.pc package config does not include -Wall for the default Cflags, so the typical default build probably wouldn't use it.

builder@807d37aa0f3a:~/src/pub/wlrobs$ grep -rin 'Cflags' /usr/lib/x86_64-linux-gnu/pkgconfig/wayland-* /usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-client.pc:14:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-cursor.pc:10:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-egl.pc:10:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-server.pc:14:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc:9:Cflags: -I${includedir} -DHAVE_OBSCONFIG_H -mmmx -msse -msse2  
builder@807d37aa0f3a:~/src/pub/wlrobs$ meson setup build 

The Meson build system
Version: 1.6.1
Source dir: /home/builder/src/pub/wlrobs
Build dir: /home/builder/src/pub/wlrobs/build
Build type: native build
Project name: wlrobs
Project version: undefined
C compiler for the host machine: cc (gcc 14.2.0 "cc (Debian 14.2.0-11) 14.2.0")
C linker for the host machine: cc ld.bfd 2.43.50.20241221
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1
Run-time dependency wayland-client found: YES 1.23.0
Run-time dependency libobs found: YES 30.2.3.1
Library dl found: YES
Library rt found: YES
Build targets in project: 1

Found ninja-1.12.1 at /usr/bin/ninja
builder@807d37aa0f3a:~/src/pub/wlrobs$ 
builder@807d37aa0f3a:~/src/pub/wlrobs$ ninja -C build 
ninja: Entering directory `build'
[7/7] Linking target libwlrobs.so

So, it built fine on debian:sid with the default libobs.pc. Next, I modified it specifically to include -Wall, -Wextra, and finally an explicit -Werror=unused-result:

builder@807d37aa0f3a:~/src/pub/wlrobs$ sudo vim /usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc 
### Added: -Wall -Wextra -Werror=unused-result

builder@807d37aa0f3a:~/src/pub/wlrobs$ pkg-config --cflags libobs
-I/usr/include/obs -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -Wall -Wextra -Werror=unused-result 

builder@807d37aa0f3a:~/src/pub/wlrobs$ grep -rin 'Cflags' /usr/lib/x86_64-linux-gnu/pkgconfig/wayland-* /usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc 
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-client.pc:14:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-cursor.pc:10:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-egl.pc:10:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/wayland-server.pc:14:Cflags: -I${includedir}
/usr/lib/x86_64-linux-gnu/pkgconfig/libobs.pc:9:Cflags: -I${includedir} -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -Wall -Wextra -Werror=unused-result  

builder@807d37aa0f3a:~/src/pub/wlrobs$ ninja -C build clean
ninja: Entering directory `build'
[1/1] Cleaning
Cleaning... 7 files.
builder@807d37aa0f3a:~/src/pub/wlrobs$ meson setup --reconfigure build 
The Meson build system
Version: 1.6.1
Source dir: /home/builder/src/pub/wlrobs
Build dir: /home/builder/src/pub/wlrobs/build
Build type: native build
Project name: wlrobs
Project version: undefined
C compiler for the host machine: cc (gcc 14.2.0 "cc (Debian 14.2.0-11) 14.2.0")
C linker for the host machine: cc ld.bfd 2.43.50.20241221
Host machine cpu family: x86_64
Host machine cpu: x86_64
Dependency wayland-client found: YES 1.23.0 (cached)
Dependency libobs found: YES 30.2.3.1 (cached)
Library dl found: YES
Library rt found: YES
Build targets in project: 1

Found ninja-1.12.1 at /usr/bin/ninja
Cleaning... 0 files.
builder@807d37aa0f3a:~/src/pub/wlrobs$ ninja -C build --verbose 
ninja: Entering directory `build'
[1/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o -c ../proto/xdg-output-unstable-v1-protocol.c
[2/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o -c ../proto/wlr-screencopy-unstable-v1-protocol.c
[3/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o -MF libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o.d -o libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o -c ../proto/wlr-export-dmabuf-unstable-v1-protocol.c
[4/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/src_main.c.o -MF libwlrobs.so.p/src_main.c.o.d -o libwlrobs.so.p/src_main.c.o -c ../src/main.c
[5/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/src_scpy_source.c.o -MF libwlrobs.so.p/src_scpy_source.c.o.d -o libwlrobs.so.p/src_scpy_source.c.o -c ../src/scpy_source.c
[6/7] cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -O3 -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/src_dmabuf_source.c.o -MF libwlrobs.so.p/src_dmabuf_source.c.o.d -o libwlrobs.so.p/src_dmabuf_source.c.o -c ../src/dmabuf_source.c
[7/7] cc  -o libwlrobs.so libwlrobs.so.p/src_main.c.o libwlrobs.so.p/proto_xdg-output-unstable-v1-protocol.c.o libwlrobs.so.p/src_scpy_source.c.o libwlrobs.so.p/proto_wlr-screencopy-unstable-v1-protocol.c.o libwlrobs.so.p/src_dmabuf_source.c.o libwlrobs.so.p/proto_wlr-export-dmabuf-unstable-v1-protocol.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,-soname,libwlrobs.so -Wl,--start-group /usr/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libobs.so -ldl -lrt -Wl,--end-group

Still same result: no errors, the build worked!

However, once I compared gcc flags and looked into how the attribute is set, I found out why. If we set fortify source level higher than zero, then the warn_unused_result gets defined as __attribute_warn_unused_result__ and __wur via cdefs.h:

Per-distro header paths:

  • Debian: /usr/include/x86_64-linux-gnu/sys/cdefs.h
  • Arch Linux: /usr/include/sys/cdefs.h
/* If fortification mode, we warn about unused results of certain
   function calls which can lead to problems.  */
#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__)
# define __attribute_warn_unused_result__ \
   __attribute__ ((__warn_unused_result__))
# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
#  define __wur __attribute_warn_unused_result__
# endif
#else
# define __attribute_warn_unused_result__ /* empty */
#endif
#ifndef __wur
# define __wur /* Ignore */
#endif

This definition gets carried into unistd.h as __wur:

This header path is the same on both distros: /usr/include/unistd.h

#if defined __USE_POSIX199309 \
    || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K

/* Truncate the file FD is open on to LENGTH bytes.  */
# ifndef __USE_FILE_OFFSET64
extern int ftruncate (int __fd, __off_t __length) __THROW __wur;
# else
#  ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length),
                           ftruncate64) __wur;
#  else
#   define ftruncate ftruncate64
#  endif
# endif
# ifdef __USE_LARGEFILE64
extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
# endif

#endif /* Use POSIX.1b || X/Open Unix || XPG6.  */

So, for example, if we manually define _FORTIFY_SOURCE=3 and try to re-build that intermediate libwlrobs.so.p/src_scpy_source.c.o object:

builder@807d37aa0f3a:~/src/pub/wlrobs/build$ cc -Ilibwlrobs.so.p -I. -I.. -I../inc -I/usr/include/obs -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -Werror=unused-result -DENABLE_SCPY -D_GNU_SOURCE -DENABLE_DMABUF -fPIC -DHAVE_OBSCONFIG_H D_FORTIFY_SOURCE=3 -mmmx -msse -msse2 -MD -MQ libwlrobs.so.p/src_scpy_source.c.o -MF libwlrobs.so.p/src_scpy_source.c.o.d -o libwlrobs.so.p/src_scpy_source.c.o -c ../src/scpy_source.c 
../src/scpy_source.c: In function 'buffer':
../src/scpy_source.c:241:9: error: ignoring return value of 'ftruncate' declared with attribute 'warn_unused_result' [-Werror=unused-result]
  241 |         ftruncate(this->frame->fd, stride * height);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

This reproduces the same error on Debian Sid. The key was to set _FORTIFY_SOURCE > 0 and also use -Wall.

~scoopta a month ago

I actually played around with the error handling last night before committing that simple cast "fix." The problem is that spot in the code is a nuisance to gracefully handle failures. I will work on a more graceful failure handling solution for it in the mean time I made a (very stupid) commit that should fix the build problems 4f3db4dbe36c

~scoopta REPORTED FIXED a month ago

b8668b4d6d6d includes proper error handling for this situation

~trinitronx a month ago

Tested building b8668b4d6d6d. Can verify that it's now fixed! 🎉 🎊 Thanks!

Register here or Log in to comment, or comment via email.