From 922878b22e66fafe62b1c846831da3c521c7b3fe Mon Sep 17 00:00:00 2001 From: Josh Megnauth Date: Sun, 5 Jan 2025 02:37:41 -0500 Subject: [PATCH] fix: GNU seems to prefer its own glob.h Make (and possibly other) GNU programs seem to prefer using its own `glob.h`. For Make, its configure detects if GNU's glob then uses it if it is OR compiles a bundled version if it's not. Make fails to link now that we have `glob.h` (duplicated symbols). --- src/header/glob/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/header/glob/mod.rs b/src/header/glob/mod.rs index 66f3f5d66a..0041fe2f61 100644 --- a/src/header/glob/mod.rs +++ b/src/header/glob/mod.rs @@ -41,6 +41,7 @@ pub const GLOB_ABORTED: c_int = 2; // Pattern does not match any existing pathname, and GLOB_NOCHECK was not set pub const GLOB_NOMATCH: c_int = 3; +#[linkage = "weak"] // GNU prefers its own glob e.g. in Make #[repr(C)] #[derive(Debug)] pub struct glob_t { @@ -52,6 +53,7 @@ pub struct glob_t { __opaque: *mut c_void, // Vec<*mut c_char> } +#[linkage = "weak"] // GNU prefers its own glob e.g. in Make #[no_mangle] pub unsafe extern "C" fn glob( pattern: *const c_char, @@ -145,6 +147,7 @@ pub unsafe extern "C" fn glob( 0 } +#[linkage = "weak"] // GNU prefers its own glob e.g. in Make #[no_mangle] pub unsafe extern "C" fn globfree(pglob: *mut glob_t) { // Retake ownership