Skip to content

Commit 9acf9f7

Browse files
will now bundle qualcomm headers too, resulting .deb should be fully self contained
1 parent 974f581 commit 9acf9f7

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

synapse/cli/build.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
340340
lib_dst_dir = os.path.join(staging_dir, "opt", "scifi", "lib")
341341
os.makedirs(lib_dst_dir, exist_ok=True)
342342

343+
# QNN libraries are dlopen'd from /usr/lib/ (hardcoded paths in SDK),
344+
# so they must be staged there — not in /opt/scifi/lib/
345+
qnn_dst_dir = os.path.join(staging_dir, "usr", "lib")
346+
os.makedirs(qnn_dst_dir, exist_ok=True)
347+
343348
try:
344349
arch_suffix = detect_arch()
345350
image_tag = f"{app_name}:latest-{arch_suffix}"
@@ -349,6 +354,7 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
349354
f"[yellow]Extracting SDK libraries from Docker image [bold]{image_tag}[/bold]...[/yellow]"
350355
)
351356

357+
# Extract SDK shared libraries → /opt/scifi/lib/
352358
docker_cmd = [
353359
"docker",
354360
"run",
@@ -360,11 +366,29 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
360366
image_tag,
361367
"/bin/bash",
362368
"-c",
363-
"find /usr/lib -name 'libsynapse*.so*' -exec cp -a {} /out/ \\;",
369+
"find /usr/lib -maxdepth 1 -name 'libsynapse*.so*' -exec cp -a {} /out/ \\;",
364370
]
365371

366372
subprocess.run(docker_cmd, check=True)
367373

374+
# Extract QNN runtime libraries → /usr/lib/ (dlopen'd by absolute path)
375+
docker_cmd_qnn = [
376+
"docker",
377+
"run",
378+
"--rm",
379+
"--platform",
380+
platform_opt,
381+
"-v",
382+
f"{qnn_dst_dir}:/out",
383+
image_tag,
384+
"/bin/bash",
385+
"-c",
386+
"find /usr/lib -maxdepth 1 -name 'libQnn*.so' -exec cp -a {} /out/ \\; && "
387+
"if [ -d /usr/lib/rfsa ]; then cp -a /usr/lib/rfsa /out/; fi",
388+
]
389+
390+
subprocess.run(docker_cmd_qnn, check=True)
391+
368392
except subprocess.CalledProcessError as exc:
369393
console.print(
370394
f"[bold red]Error:[/bold red] Failed to copy SDK libraries from Docker image: {exc}"

0 commit comments

Comments
 (0)