@@ -2201,17 +2201,23 @@ fn verify_distribution_behavior(dist_path: &Path) -> Result<Vec<String>> {
2201
2201
// that fails this check (e.g. by setting an rpath on just python+libpython).
2202
2202
// https://github.com/pyinstaller/pyinstaller/issues/9204#issuecomment-3171050891
2203
2203
if cfg ! ( target_os = "linux" ) {
2204
+ // musl's ldd is packaged in the "musl-dev" Debian package.
2205
+ let ldd = if python_json. target_triple . contains ( "-musl" ) && cfg ! ( not( target_env = "musl" ) ) {
2206
+ "musl-ldd"
2207
+ } else {
2208
+ "ldd"
2209
+ } ;
2204
2210
for ( name, variants) in python_json. build_info . extensions . iter ( ) {
2205
2211
for ext in variants {
2206
2212
let Some ( shared_lib) = & ext. shared_lib else {
2207
2213
continue ;
2208
2214
} ;
2209
2215
let shared_lib_path = temp_dir. path ( ) . join ( "python" ) . join ( shared_lib) ;
2210
- let output = duct:: cmd ( " ldd" , [ shared_lib_path] )
2216
+ let output = duct:: cmd ( ldd, [ shared_lib_path] )
2211
2217
. unchecked ( )
2212
2218
. stdout_capture ( )
2213
2219
. run ( )
2214
- . context ( format ! ( "Failed to run `ldd {shared_lib}`" ) ) ?;
2220
+ . context ( format ! ( "Failed to run `{ ldd} {shared_lib}`" ) ) ?;
2215
2221
let stdout = String :: from_utf8_lossy ( & output. stdout ) ;
2216
2222
// Format of ldd output, for both glibc and musl:
2217
2223
// - Everything starts with a tab.
@@ -2229,7 +2235,7 @@ fn verify_distribution_behavior(dist_path: &Path) -> Result<Vec<String>> {
2229
2235
// TODO: If we ever have any optional dependencies besides libcrypt (which is
2230
2236
// glibc-only), we will need to capture musl ldd's stderr and parse it.
2231
2237
errors. push ( format ! (
2232
- "`ldd {shared_lib}` exited with {}:\n {stdout}" ,
2238
+ "`{ ldd} {shared_lib}` exited with {}:\n {stdout}" ,
2233
2239
output. status
2234
2240
) ) ;
2235
2241
} else {
@@ -2241,7 +2247,9 @@ fn verify_distribution_behavior(dist_path: &Path) -> Result<Vec<String>> {
2241
2247
continue ;
2242
2248
} ;
2243
2249
let dep_source = deps
2244
- . and_then ( |deps| deps. iter ( ) . find ( |dep| dep. 0 == needed) . map ( |dep| dep. 1 ) )
2250
+ . and_then ( |deps| {
2251
+ deps. iter ( ) . find ( |dep| dep. 0 == needed) . map ( |dep| dep. 1 )
2252
+ } )
2245
2253
. unwrap_or ( SystemRequired ) ;
2246
2254
if resolution. starts_with ( "not found" ) && dep_source != SystemOptional {
2247
2255
ldd_errors. push ( format ! ( "{needed} was expected to be found" ) ) ;
@@ -2253,7 +2261,7 @@ fn verify_distribution_behavior(dist_path: &Path) -> Result<Vec<String>> {
2253
2261
}
2254
2262
if !ldd_errors. is_empty ( ) {
2255
2263
errors. push ( format ! (
2256
- "In `ldd {shared_lib}`:\n - {}\n {stdout}" ,
2264
+ "In `{ ldd} {shared_lib}`:\n - {}\n {stdout}" ,
2257
2265
ldd_errors. join( "\n - " )
2258
2266
) ) ;
2259
2267
}
0 commit comments