Skip to content

fix(btls-sys): skip nonexistent link search directories#165

Merged
0x676e67 merged 1 commit into
0x676e67:mainfrom
18o:fix/nonexistent-link-search-dirs
Jul 14, 2026
Merged

fix(btls-sys): skip nonexistent link search directories#165
0x676e67 merged 1 commit into
0x676e67:mainfrom
18o:fix/nonexistent-link-search-dirs

Conversation

@18o

@18o 18o commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Only emit cargo:rustc-link-search directives for directories that actually exist.

The BoringSSL build script currently emits several candidate library search paths. Depending on the generated CMake layout, directories such as build/lib and build/crypto may not exist because libcrypto.a and libssl.a are placed directly under build/.

These nonexistent paths are still passed to the linker as -L arguments.

Motivation

Rust 1.97 reports linker output by default, making the existing invalid search paths visible:

warning: linker stderr: unable to open library directory '.../build/lib': FileNotFound
warning: unable to open library directory '.../build/crypto': FileNotFound

This is reproducible when cross-compiling with cargo-zigbuild. It is not specific to Zig: any linker that reports nonexistent library
search directories may expose the same issue.

## Changes

Check each candidate path with Path::is_dir() before emitting its cargo:rustc-link-search directive.

This removes invalid linker arguments without changing the selected libraries or the existing platform-specific directory resolution.

## Verification

- Ran cargo test -p btls-sys
- Cross-compiled the mk_certs example for x86_64-unknown-linux-gnu
- Confirmed that the nonexistent library directory warnings are no longer emitted

@0x676e67

Copy link
Copy Markdown
Owner

nice job

@0x676e67
0x676e67 merged commit ab7f522 into 0x676e67:main Jul 14, 2026
28 checks passed
@18o
18o deleted the fix/nonexistent-link-search-dirs branch July 14, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants