Build Failure Due to Undefined Reference to close_range with alsa-lib 1.2.15
A message that is not in the archive (sent off-list or not yet received): [email protected]
alsa-project/alsa-lib issue #485 was opened from darkshram:
### Description
I encountered a build failure while compiling **alsa-lib 1.2.15** due to an undefined reference to close_range. My environment uses **glibc 2.30**, which should support this function.
### Error Message
``` ucm/.libs/libucm.a(ucm_exec.o): In function `uc_mgr_exec': /builddir/build/BUILD/alsa-lib-1.2.15/src/ucm/ucm_exec.c:263: undefined reference to `close_range' collect2: error: ld returned 1 exit status ```
### Solution
To resolve the issue, I applied the following patch, which effectively reverses [the change that introduced](https://github.com/alsa-project/alsa-lib/pull/459) close_range:
```
diff -Naur alsa-lib-1.2.15.orig/src/ucm/ucm_exec.c alsa-lib-1.2.15/src/ucm/ucm_exec.c
--- alsa-lib-1.2.15.orig/src/ucm/ucm_exec.c 2025-12-07 13:41:56.000000000 -0600
+++ alsa-lib-1.2.15/src/ucm/ucm_exec.c 2025-12-08 15:03:30.632324127 -0600
@@ -259,12 +259,8 @@
close(f);
-#if defined(_GNU_SOURCE)
- close_range(3, maxfd, 0);
-#else
for (f = 3; f < maxfd; f++)
close(f);
-#endif
/* install default handlers for the forked process */
signal(SIGINT, SIG_DFL);
```This workaround restored compatibility and allowed the build to complete successfully.
### Additional Information
Please consider this issue for further review. If close_range is required, clearer compatibility notes might be beneficial. Thank you!
Issue URL : https://github.com/alsa-project/alsa-lib/issues/485
Repository URL: https://github.com/alsa-project/alsa-lib