@@ -1169,11 +1169,19 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
1169
1169
break :prefix "-l" ;
1170
1170
};
1171
1171
switch (system_lib .use_pkg_config ) {
1172
- .no = > try zig_args .append (b .fmt ("{s}{s}" , .{ prefix , system_lib .name })),
1172
+ .no = > {
1173
+ if (compile .linkage != .static ) {
1174
+ // Avoid putting another compiled library inside a static library.
1175
+ try zig_args .append (b .fmt ("{s}{s}" , .{ prefix , system_lib .name }));
1176
+ }
1177
+ },
1173
1178
.yes , .force = > {
1174
1179
if (compile .runPkgConfig (system_lib .name )) | result | {
1175
1180
try zig_args .appendSlice (result .cflags );
1176
- try zig_args .appendSlice (result .libs );
1181
+ if (compile .linkage != .static ) {
1182
+ // Avoid putting another compiled library inside a static library.
1183
+ try zig_args .appendSlice (result .libs );
1184
+ }
1177
1185
try seen_system_libs .put (arena , system_lib .name , result .cflags );
1178
1186
} else | err | switch (err ) {
1179
1187
error .PkgConfigInvalidOutput ,
@@ -1215,10 +1223,10 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
1215
1223
},
1216
1224
.lib = > l : {
1217
1225
const other_produces_implib = other .producesImplib ();
1218
- const other_is_static = other_produces_implib or other .isStaticLibrary ();
1226
+ const other_is_compiled_lib = other_produces_implib or other .isStaticLibrary () or other . isDynamicLibrary ();
1219
1227
1220
- if (compile .isStaticLibrary () and other_is_static ) {
1221
- // Avoid putting a static library inside a static library.
1228
+ if (compile .isStaticLibrary () and other_is_compiled_lib ) {
1229
+ // Avoid putting another compiled library inside a static library.
1222
1230
break :l ;
1223
1231
}
1224
1232
0 commit comments