From d2de81bebe2235b338690efd3b7a83b388d94d8c Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Sat, 13 Jan 2024 14:39:11 -0500 Subject: [PATCH 1/4] doc: runtime dependency resolution --- doc/dependency_resolution.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/doc/dependency_resolution.md b/doc/dependency_resolution.md index 7ef9ee76..32b1ef51 100644 --- a/doc/dependency_resolution.md +++ b/doc/dependency_resolution.md @@ -10,10 +10,12 @@ Assuming a dependency is installed in `$prefix`, it uses one or more of the foll Take a look at each dependency's installation prefix to see which of these options are available. -To use these dependencies with your software, they must be findable by its build system. +## Resolving Build Dependencies + +To use these dependencies with your software, they must be findable by its build system The following sections explain how to do so with each. -### Meson +### :large_blue_diamond: Meson For `iguana`, the build system is `meson`, which accepts the build options ```bash -Dpkg_config_path=$prefix/lib/pkgconfig @@ -21,7 +23,7 @@ For `iguana`, the build system is `meson`, which accepts the build options ``` (where multiple paths are delimited by commas). -### CMake +### :large_blue_diamond: CMake For `cmake`, the `pkg-config` path can be combined with the `cmake` path, so only the build option ```bash @@ -31,10 +33,30 @@ is needed; this assumes: - all dependencies are in `$prefix` (delimit multiple paths with semicolons) - `PKG_CONFIG_USE_CMAKE_PREFIX_PATH` has not been disabled. -### General Case +### :large_blue_diamond: General Case Environment variables may be used instead of build options for a general approach: ```bash export PKG_CONFIG_PATH=$prefix/lib/pkgconfig export CMAKE_PREFIX_PATH=$prefix ``` (where multiple paths are delimited by colons). + +`pkg-config` files (`.pc`) allow for usage of the `pkg-config` command. Assuming the package is `hipo4` and `hipo4.pc` is found in `PKG_CONFIG_PATH`, compiler flags may be found by +```bash +pkg-config --libs hipo4 +pkg-config --cflags hipo4 +``` +Any variable defined in `hipo4.pc` is accessible with `pkg-config --variable `. + +## Resolving Runtime Dependencies + +TODO: change these notes into documentation + +- prefer `rpath`s over `$LD_LIBRARY_PATH` or `$DYLD_LIBRARY_PATH` (or other + environment variables), since they are globally mutable +- both `rpaths` and environment variables are OS-dependent +- while `rpaths` are typical in build files, they are usually stripped at +installation, otherwise dependencies cannot be relocated (easily) +- containerization with one installation prefix removes the need of both + `rpath`s and `ld` environment vars since dependency files will all be findable in the + default, assumed places From e9548ff55d16f27fd898e844e4536ec3df8e1d90 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Tue, 16 Jan 2024 11:01:27 -0500 Subject: [PATCH 2/4] doc: typo --- doc/dependency_resolution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dependency_resolution.md b/doc/dependency_resolution.md index 32b1ef51..8c03d13b 100644 --- a/doc/dependency_resolution.md +++ b/doc/dependency_resolution.md @@ -12,7 +12,7 @@ are available. ## Resolving Build Dependencies -To use these dependencies with your software, they must be findable by its build system +To use these dependencies with your software, they must be findable by its build system. The following sections explain how to do so with each. ### :large_blue_diamond: Meson From 250e322f894f897ede7fd846cc275462d1154dc5 Mon Sep 17 00:00:00 2001 From: Christopher Dilks Date: Tue, 16 Jan 2024 11:09:50 -0500 Subject: [PATCH 3/4] doc: write it better --- doc/dependency_resolution.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/doc/dependency_resolution.md b/doc/dependency_resolution.md index 8c03d13b..b72abb23 100644 --- a/doc/dependency_resolution.md +++ b/doc/dependency_resolution.md @@ -50,13 +50,9 @@ Any variable defined in `hipo4.pc` is accessible with `pkg-config --variable Date: Tue, 16 Jan 2024 11:13:36 -0500 Subject: [PATCH 4/4] fix: link --- doc/dependency_resolution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dependency_resolution.md b/doc/dependency_resolution.md index b72abb23..883e29cf 100644 --- a/doc/dependency_resolution.md +++ b/doc/dependency_resolution.md @@ -55,4 +55,4 @@ setting [rpath variables](https://en.wikipedia.org/wiki/Rpath); this is preferre such as `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH`, since they are globally mutable. However, depending on your local setup and the current state of your environment variables, you may need to set some variables -such that `iguana` is prioritized. See [the Environment Variables section in the setup guide for more details](setup.md). +such that `iguana` is prioritized. See [the Environment Variables section in the setup guide for more details](setup.md#env).