Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify RPATH when linking to libpq #225

Merged
merged 15 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-18.04, macos-10.15 ]
# NOTE: Although we'd like to use stable, we cannot with a newer version
# of Propolis as a dependency (which only builds with nightly).
# toolchain: [ nightly-2021-04-24, stable ]
toolchain: [ nightly-2021-04-24 ]
# See rust-toolchain for why we're using nightly here.
toolchain: [ nightly-2021-09-03 ]
steps:
# actions/checkout@v2
- uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
Expand Down
23 changes: 18 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"omicron-bootstrap-agent",
"omicron-common",
"omicron-nexus",
"omicron-rpaths",
"omicron-sled-agent",
"oximeter/oximeter",
"oximeter/oximeter-macro-impl",
Expand All @@ -12,6 +13,7 @@ default-members = [
"omicron-bootstrap-agent",
"omicron-common",
"omicron-nexus",
"omicron-rpaths",
"omicron-sled-agent",
"oximeter/oximeter",
"oximeter/oximeter-macro-impl",
Expand All @@ -32,3 +34,11 @@ panic = "abort"
#dropshot = { path = "../dropshot/dropshot" }
#[patch."https://github.com/oxidecomputer/steno"]
#steno = { path = "../steno" }

#
# We maintain a fork of pq-sys to address upstream issues. See the
# README.md.oxide in the "oxide" branch of our fork for details.
#
[patch.crates-io.pq-sys]
git = 'https://github.com/oxidecomputer/pq-sys'
branch = "omicron"
7 changes: 3 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ We use Diesel's PostgreSQL support to connect to CockroachDB (which is wire-comp

After doing this, you should have the `pg_config` command on your PATH. For example, on Helios, you'd want `/opt/ooce/bin` on your PATH.

See the note about setting RUSTFLAGS and RUSTDOCFLAGS at build time below.
See the note about setting RUSTDOCFLAGS at build time below.
--
. CockroachDB v20.2.5.
+
Expand Down Expand Up @@ -106,11 +106,10 @@ the database files will be deleted when you stop the program.

The easiest way to start the required databases is to use the built-in `omicron-dev` tool. This tool assumes that the `cockroach` and `clickhouse` executables are on your PATH, and match the versions above.

. Set `RUSTFLAGS` and `RUSTDOCFLAGS` in your environment so that built binaries will be able to find your local copy of libpq. A typical example might look like this:
. Work around https://github.com/rust-lang/cargo/issues/9895[rust-lang/cargo#9895]: set `RUSTDOCFLAGS` in your environment so that built test binaries will be able to find your local copy of libpq. A typical example might look like this:
+
----
$ export RUSTFLAGS="-Clink-args=-R$(pg_config --libdir)"
$ export RUSTDOCFLAGS="$RUSTFLAGS"
$ export RUSTDOCFLAGS="-Clink-args=-R$(pg_config --libdir)"
----
+ Note that this might be wrong in some configurations or if you're using environment variables to control how the `pq-sys` crate finds libpq. See https://github.com/oxidecomputer/omicron/issues/213[#213] for details.
+
Expand Down
5 changes: 5 additions & 0 deletions omicron-bootstrap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ name = "omicron-bootstrap-agent"
version = "0.1.0"
edition = "2018"

[build-dependencies.omicron-rpaths]
path = "../omicron-rpaths"

[dependencies]
http = "0.2.0"
hyper = "0.14"
# See omicron-rpaths for more about the "pq-sys" dependency.
pq-sys = "*"
serde_json = "1.0"
smf = "0.2"
structopt = "0.3"
Expand Down
6 changes: 6 additions & 0 deletions omicron-bootstrap-agent/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See omicron-rpaths for documentation.
// NOTE: This file MUST be kept in sync with the other build.rs files in this
// repository.
fn main() {
omicron_rpaths::configure_default_omicron_rpaths();
}
5 changes: 5 additions & 0 deletions omicron-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "omicron-common"
version = "0.1.0"
edition = "2018"

[build-dependencies.omicron-rpaths]
path = "../omicron-rpaths"

[dependencies]
anyhow = "1.0"
async-trait = "0.1.51"
Expand All @@ -14,6 +17,8 @@ hyper = "0.14"
libc = "0.2.98"
propolis-server = { git = "https://github.com/oxidecomputer/propolis", rev = "bc0661e" }
postgres-protocol = "0.6.1"
# See omicron-rpaths for more about the "pq-sys" dependency.
pq-sys = "*"
rayon = "1.5"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] }
ring = "0.16"
Expand Down
6 changes: 6 additions & 0 deletions omicron-common/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See omicron-rpaths for documentation.
// NOTE: This file MUST be kept in sync with the other build.rs files in this
// repository.
fn main() {
omicron_rpaths::configure_default_omicron_rpaths();
}
5 changes: 5 additions & 0 deletions omicron-nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "omicron-nexus"
version = "0.1.0"
edition = "2018"

[build-dependencies.omicron-rpaths]
path = "../omicron-rpaths"

[dependencies]
anyhow = "1.0"
async-trait = "0.1.51"
Expand All @@ -18,6 +21,8 @@ lazy_static = "1.4.0"
libc = "0.2.98"
macaddr = { version = "1.0.1", features = [ "serde_std" ]}
newtype_derive = "0.1.6"
# See omicron-rpaths for more about the "pq-sys" dependency.
pq-sys = "*"
serde_json = "1.0"
serde_with = "1.9.4"
structopt = "0.3"
Expand Down
6 changes: 6 additions & 0 deletions omicron-nexus/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See omicron-rpaths for documentation.
// NOTE: This file MUST be kept in sync with the other build.rs files in this
// repository.
fn main() {
omicron_rpaths::configure_default_omicron_rpaths();
}
6 changes: 6 additions & 0 deletions omicron-rpaths/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "omicron-rpaths"
version = "0.1.0"
edition = "2021"

[dependencies]
Loading