Skip to content

Commit a570624

Browse files
arman-bdclaude
andcommitted
fix: use vendor BoringSSL on Linux instead of system OpenSSL
System OpenSSL on manylinux is too old (lacks TLS 1.3 support). Always use vendor-built BoringSSL for wheel compatibility on Linux. Fixes compilation errors: - TLS1_3_VERSION undeclared - NID_X25519 undeclared - TLS_client_method not available 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent caed658 commit a570624

File tree

1 file changed

+11
-53
lines changed

1 file changed

+11
-53
lines changed

setup.py

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,17 @@ def get_library_paths():
190190
}
191191

192192
elif IS_LINUX:
193-
# Use vendor dependencies if available, otherwise system paths
193+
# Always use vendor-built BoringSSL for wheel compatibility
194194
vendor_dir = Path("vendor").resolve()
195195

196-
# Check if vendor nghttp2 exists
196+
# BoringSSL (always use vendor-built)
197+
vendor_boringssl = vendor_dir / "boringssl"
198+
boringssl_include = str(vendor_boringssl / "include")
199+
boringssl_lib = str(vendor_boringssl / "build" / "ssl")
200+
201+
print(f"Using vendor BoringSSL from: {vendor_boringssl}")
202+
203+
# nghttp2 - prefer vendor build for wheel compatibility
197204
vendor_nghttp2 = vendor_dir / "nghttp2" / "install"
198205
if vendor_nghttp2.exists() and (vendor_nghttp2 / "include").exists():
199206
nghttp2_include = str(vendor_nghttp2 / "include")
@@ -240,58 +247,9 @@ def get_library_paths():
240247
nghttp2_lib = alt_path
241248
break
242249

243-
# Try pkg-config for BoringSSL/OpenSSL (system fallback on Linux)
244-
openssl_include = None
245-
openssl_lib = None
246-
try:
247-
import subprocess
248-
249-
include_output = (
250-
subprocess.check_output(
251-
["pkg-config", "--cflags-only-I", "openssl"], stderr=subprocess.DEVNULL
252-
)
253-
.decode()
254-
.strip()
255-
)
256-
if include_output:
257-
openssl_include = include_output.replace("-I", "").strip()
258-
259-
lib_output = (
260-
subprocess.check_output(
261-
["pkg-config", "--libs-only-L", "openssl"], stderr=subprocess.DEVNULL
262-
)
263-
.decode()
264-
.strip()
265-
)
266-
if lib_output:
267-
openssl_lib = lib_output.replace("-L", "").strip()
268-
except (subprocess.CalledProcessError, FileNotFoundError):
269-
pass
270-
271-
# Use system SSL library on Linux if pkg-config didn't work
272-
if not openssl_include:
273-
openssl_include = "/usr/include"
274-
if not openssl_lib:
275-
openssl_lib = "/usr/lib/x86_64-linux-gnu"
276-
if not Path(openssl_lib).exists():
277-
for alt_path in ["/usr/lib64", "/usr/lib"]:
278-
if Path(alt_path).exists():
279-
openssl_lib = alt_path
280-
break
281-
282-
# Validate paths before returning
283-
if not openssl_include or not openssl_include.strip():
284-
openssl_include = "/usr/include"
285-
if not openssl_lib or not openssl_lib.strip():
286-
openssl_lib = "/usr/lib/x86_64-linux-gnu"
287-
if not nghttp2_include or not nghttp2_include.strip():
288-
nghttp2_include = "/usr/include"
289-
if not nghttp2_lib or not nghttp2_lib.strip():
290-
nghttp2_lib = "/usr/lib/x86_64-linux-gnu"
291-
292250
return {
293-
"openssl_include": openssl_include,
294-
"openssl_lib": openssl_lib,
251+
"openssl_include": boringssl_include,
252+
"openssl_lib": boringssl_lib,
295253
"nghttp2_include": nghttp2_include,
296254
"nghttp2_lib": nghttp2_lib,
297255
}

0 commit comments

Comments
 (0)