# How to build QT binary with bundled libraries?

**URL:** https://discourse.nixos.org/t/how-to-build-qt-binary-with-bundled-libraries/24471
**Category:** Uncategorized
**Created:** [January 6, 2023, 9:06am UTC](https://discourse.nixos.org/t/how-to-build-qt-binary-with-bundled-libraries/24471 "2023-01-06T09:06:34Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![tobiasBora](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/t/9de0a6/32.png) [@tobiasBora](https://discourse.nixos.org/u/tobiasBora)
#### Post date: [January 7, 2023, 9:34am UTC](https://discourse.nixos.org/t/how-to-build-qt-binary-with-bundled-libraries/24471/2 "2023-01-07T09:34:03Z")

</div>

Sorry, I dont have a computer to test, but here are a few thougts:

- if the libraries are picked at runtime using dlopen, autopatchelf can’t see them so you might need to use `runtimeDependencies`, and disable the optimisations on rpath, `dontPatchELF = true;`. See also [How to set `runtimeDependencies` for shared libraries? - #5 by tobiasBora](https://discourse.nixos.org/t/how-to-set-runtimedependencies-for-shared-libraries/14857/5)
- if the binary really expects lib to be in a subfolder, you can copy the whole program to `$out/opt` and add a wrapper (maybe a link would work as well) in `$out/bin` that calls stuff in `$out/opt`

---

_[View the full topic](https://discourse.nixos.org/t/how-to-build-qt-binary-with-bundled-libraries/24471)._
