Skip to content

Compilation of fastfetch-1.11.3 fails under musl-libc #472

@mc680x0

Description

@mc680x0

Expected behaviour: successful compilation

Behaviour produced: compilation fails at object "brightness_linux" with the error 'PATH_MAX' undeclared

Fix:
Under musl-libc, PATH_MAX is provided in limits.h - adding
#include <limits.h> to src/detection/brightness/brightness_linux.c allows fastfetch to compile with no errors, and runs correctly.

I note that src/logo/image/image.c also uses PATH_MAX, and should also have this include provided to ensure correct building against musl-libc.

Output from build:
[97/139] /usr/bin/x86_64-gentoo-linux-musl-gcc -DFF_ENABLE_BUFFER -DFF_HAVE_LIBPCI=1 -DFF_HAVE_SQLITE3=1 -DFF_HAVE_THREADS -DFF_HAVE_UTMPX_H -D_GNU_SOURCE -I/var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3_build -I/var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src -DNDEBUG -march=sandybridge -O2 -mfpmath=sse -fstack-protector-strong -pipe -Wall -Wextra -Wconversion -std=gnu11 -flto=auto -fno-fat-lto-objects -MD -MT CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o -MF CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o.d -o CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o -c /var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src/detection/brightness/brightness_linux.c FAILED: CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o /usr/bin/x86_64-gentoo-linux-musl-gcc -DFF_ENABLE_BUFFER -DFF_HAVE_LIBPCI=1 -DFF_HAVE_SQLITE3=1 -DFF_HAVE_THREADS -DFF_HAVE_UTMPX_H -D_GNU_SOURCE -I/var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3_build -I/var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src -DNDEBUG -march=sandybridge -O2 -mfpmath=sse -fstack-protector-strong -pipe -Wall -Wextra -Wconversion -std=gnu11 -flto=auto -fno-fat-lto-objects -MD -MT CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o -MF CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o.d -o CMakeFiles/libfastfetch.dir/src/detection/brightness/brightness_linux.c.o -c /var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src/detection/brightness/brightness_linux.c /var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src/detection/brightness/brightness_linux.c: In function 'ffDetectBrightness': /var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src/detection/brightness/brightness_linux.c:44:47: error: 'PATH_MAX' undeclared (first use in this function) 44 | ffStrbufInitA(&display->name, PATH_MAX + 1); | ^~~~~~~~ /var/tmp/portage/app-misc/fastfetch-1.11.3/work/fastfetch-1.11.3/src/detection/brightness/brightness_linux.c:44:47: note: each undeclared identifier is reported only once for each function it appears in

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions