[GH-ISSUE #4578] PATH_MAX is undeclared on musl libc #2710

Closed
opened 2026-05-05 09:22:36 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @dm9pZCAq on GitHub (Sep 27, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4578

Description

build failed due to PATH_MAX missed on musl libc

Steps to Reproduce

build on musl libc (voidlinux, alpinelinux, kisslinux)

Environment

  • Gentoo linux with musl profile
  • trying to build firejail-0.9.64.4

Log

main.c:1003:26: error: use of undeclared identifier 'PATH_MAX'
                if (strlen(argv[i]) >= MAX_ARG_LEN) {
                                       ^
./firejail.h:364:22: note: expanded from macro 'MAX_ARG_LEN'
#define MAX_ARG_LEN (PATH_MAX + 32) // --foobar=PATH
                     ^
main.c:1015:23: error: use of undeclared identifier 'PATH_MAX'
                if (strlen(*ptr) >= MAX_ENV_LEN) {
                                    ^
./firejail.h:658:22: note: expanded from macro 'MAX_ENV_LEN'
#define MAX_ENV_LEN (PATH_MAX + 32)     // FOOBAR=SOME_PATH
                     ^

How to fix

here is patch from voidlinux
https://github.com/void-linux/void-packages/blob/master/srcpkgs/firejail/patches/musl.patch

with this patch everything builds fine for me

Originally created by @dm9pZCAq on GitHub (Sep 27, 2021). Original GitHub issue: https://github.com/netblue30/firejail/issues/4578 ### Description build failed due to `PATH_MAX` missed on musl libc ### Steps to Reproduce build on musl libc (`voidlinux`, `alpinelinux`, `kisslinux`) ### Environment - Gentoo linux with musl profile - trying to build `firejail-0.9.64.4` ### Log ``` main.c:1003:26: error: use of undeclared identifier 'PATH_MAX' if (strlen(argv[i]) >= MAX_ARG_LEN) { ^ ./firejail.h:364:22: note: expanded from macro 'MAX_ARG_LEN' #define MAX_ARG_LEN (PATH_MAX + 32) // --foobar=PATH ^ main.c:1015:23: error: use of undeclared identifier 'PATH_MAX' if (strlen(*ptr) >= MAX_ENV_LEN) { ^ ./firejail.h:658:22: note: expanded from macro 'MAX_ENV_LEN' #define MAX_ENV_LEN (PATH_MAX + 32) // FOOBAR=SOME_PATH ^ ``` ### How to fix here is patch from `voidlinux` https://github.com/void-linux/void-packages/blob/master/srcpkgs/firejail/patches/musl.patch with this patch everything builds fine for me
gitea-mirror 2026-05-05 09:22:36 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kmk3 commented on GitHub (Sep 27, 2021):

@dm9pZCAq commented on Sep 27:

Description

build failed due to PATH_MAX missed on musl libc

Steps to Reproduce

build on musl libc (voidlinux, alpinelinux, kisslinux)

Environment

  • Gentoo linux with musl profile
  • trying to build firejail-0.9.64.4

Log

main.c:1003:26: error: use of undeclared identifier 'PATH_MAX'
                if (strlen(argv[i]) >= MAX_ARG_LEN) {
                                       ^
./firejail.h:364:22: note: expanded from macro 'MAX_ARG_LEN'
#define MAX_ARG_LEN (PATH_MAX + 32) // --foobar=PATH
                     ^
main.c:1015:23: error: use of undeclared identifier 'PATH_MAX'
                if (strlen(*ptr) >= MAX_ENV_LEN) {
                                    ^
./firejail.h:658:22: note: expanded from macro 'MAX_ENV_LEN'
#define MAX_ENV_LEN (PATH_MAX + 32)     // FOOBAR=SOME_PATH
                     ^

Thanks for the report.

How to fix

here is patch from voidlinux
https://github.com/void-linux/void-packages/blob/master/srcpkgs/firejail/patches/musl.patch

with this patch everything builds fine for me

The patch looks good to me; could you open a PR for it?

Cc: @Duncaen (who appears to be the patch author)

<!-- gh-comment-id:928111367 --> @kmk3 commented on GitHub (Sep 27, 2021): @dm9pZCAq commented [on Sep 27](https://github.com/netblue30/firejail/issues/4578#issue-1008298442): > ### Description > > build failed due to `PATH_MAX` missed on musl libc > > ### Steps to Reproduce > > build on musl libc (`voidlinux`, `alpinelinux`, `kisslinux`) > > ### Environment > > * Gentoo linux with musl profile > * trying to build `firejail-0.9.64.4` > > ### Log > > ``` > main.c:1003:26: error: use of undeclared identifier 'PATH_MAX' > if (strlen(argv[i]) >= MAX_ARG_LEN) { > ^ > ./firejail.h:364:22: note: expanded from macro 'MAX_ARG_LEN' > #define MAX_ARG_LEN (PATH_MAX + 32) // --foobar=PATH > ^ > main.c:1015:23: error: use of undeclared identifier 'PATH_MAX' > if (strlen(*ptr) >= MAX_ENV_LEN) { > ^ > ./firejail.h:658:22: note: expanded from macro 'MAX_ENV_LEN' > #define MAX_ENV_LEN (PATH_MAX + 32) // FOOBAR=SOME_PATH > ^ > ``` Thanks for the report. > ### How to fix > > here is patch from `voidlinux` > https://github.com/void-linux/void-packages/blob/master/srcpkgs/firejail/patches/musl.patch > > with this patch everything builds fine for me The patch looks good to me; could you open a PR for it? Cc: @Duncaen (who appears to be the patch author)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#2710
No description provided.