e2fsprogs icon indicating copy to clipboard operation
e2fsprogs copied to clipboard

Issue when compiling from source on MSYS2 UCRT64

Open Peggun opened this issue 10 months ago • 1 comments

There is a bug when trying to build from source whilst on Windows 11 using MSYS2 URCT64

../../../lib/ss/help.c: In function 'ss_help':
../../../lib/ss/help.c:109:21: error: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
  109 |     switch (child = fork()) {
      |                     ^~~~
../../../lib/ss/help.c:119:16: error: implicit declaration of function 'wait'; did you mean 'cwait'? [-Wimplicit-function-declaration]
  119 |         while (wait(NULL) != child) {
      |                ^~~~
      |                cwait
make[2]: *** [Makefile:373: help.o] Error 1
make[2]: Leaving directory '/home/admin/e2tools/e2fsprogs/build/lib/ss'
make[1]: *** [Makefile:457: all-libs-recursive] Error 1
make[1]: Leaving directory '/home/admin/e2tools/e2fsprogs/build'
make: *** [Makefile:372: all] Error 2

I am only building from source because there is no package (that I know of) that contains e2fsprogs on URCT64. Any help would be good! Thanks

Peggun avatar Mar 15 '25 08:03 Peggun

I don't have any Windows development machines. We do run CI builds using Github Actions using MSYS2 using i386 and x86_64, but we're not trying to build lib/ss, since it's not needed for Android's Windows SDK, and the developer who set up the Github action cared about avoiding breakages for Android SDK. In general, support for platforms or OS's for which I don't have access to on a best effort basis. Which means, if it's obvious, I'll try to fix things. But otherwise, people who want to use second class OS's (and Windows is definitely second class) needs to send me patches.

In general, e2fsprogs assumes that the OS and/or build environment must be POSIX-compliant. And fork(2) and wait(2) are required to be present on POSIX-compliant implementations. It also appears, at least according to Github Actions when building on MSYS2 on x86_64 when it runs configure, that MSYS2 doesn't supply the <sys/wait.h> header file --- which again, is required by POSIX. Per POSIX and the Single Unix Specifiation, the function prototype for fork(2) is declared in unistd.h[1], and wait(2) is declared in sys/wait.h[2]. And sys/help.c tries to include unistd.h and sys/wait.h if they exist.

[1] https://pubs.opengroup.org/onlinepubs/009696899/functions/fork.html [2] https://pubs.opengroup.org/onlinepubs/009696899/functions/wait.html

I suppose someone could add configure tests to check for the presence of fork(2) and wait(2), and on a platform which doesn't result in HAVE_FORK or HAVE_WAIT, we could disable pager functionality in lib/ss/help.c. But since I am blessed in not having a Windows development machine (some 30 years ago I had to support Kerberos on Windows, because that was part of my job But now someone would have to pay me huge amounts of money to deal with the horror which is Windows), what I usually tell people reporting Windows problems is, "patches gratefully accepted". Or they can pay someone do Windows development, since it can be challenging to find people to do development Windows for fun. :-)

tytso avatar Mar 16 '25 04:03 tytso