Skip to content

Commit 27d7226

Browse files
committed
statically link libpq
1 parent 55b120a commit 27d7226

File tree

6 files changed

+29
-30
lines changed

6 files changed

+29
-30
lines changed

.cargo/config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@
66
#
77
[build]
88
rustdocflags = "--document-private-items"
9+
10+
#
11+
# Link libpq statically because there is no good way to specify RPATH for the
12+
# dynamic version. See omicron#213 for details.
13+
#
14+
[env]
15+
PQ_LIB_STATIC = "yes"

.github/workflows/rust.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ jobs:
7373
fail-fast: false
7474
matrix:
7575
os: [ ubuntu-18.04, macos-10.15 ]
76-
# NOTE: Although we'd like to use stable, we cannot with a newer version
77-
# of Propolis as a dependency (which only builds with nightly).
78-
# toolchain: [ nightly-2021-04-24, stable ]
79-
toolchain: [ nightly-2021-04-24 ]
76+
# See rust-toolchain.toml. If you update this, you MUST update
77+
# rust-toolchain.toml as well!
78+
toolchain: [ nightly-2021-09-03 ]
8079
steps:
8180
# actions/checkout@v2
8281
- uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b

Cargo.lock

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@ panic = "abort"
3232
#dropshot = { path = "../dropshot/dropshot" }
3333
#[patch."https://github.com/oxidecomputer/steno"]
3434
#steno = { path = "../steno" }
35+
36+
#
37+
# We maintain a fork of pq-sys to address upstream issues. See README.md.oxide
38+
# in the branch for details.
39+
#
40+
[patch.crates-io.pq-sys]
41+
git = 'https://github.com/oxidecomputer/pq-sys'
42+
branch = "omicron"

README.adoc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ We use Diesel's PostgreSQL support to connect to CockroachDB (which is wire-comp
6969
* Mac: `brew install postgresql`
7070

7171
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.
72-
73-
See the note about setting RUSTFLAGS and RUSTDOCFLAGS at build time below.
7472
--
7573
. CockroachDB v20.2.5.
7674
+
@@ -105,16 +103,6 @@ the database files will be deleted when you stop the program.
105103
* `sled-agent-sim`: a simulator for the component that manages a single sled
106104

107105
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.
108-
109-
. 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:
110-
+
111-
----
112-
$ export RUSTFLAGS="-Clink-args=-R$(pg_config --libdir)"
113-
$ export RUSTDOCFLAGS="$RUSTFLAGS"
114-
----
115-
+ 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.
116-
+
117-
NOTE: You may be able to skip this step if your libpq is in a directory that's already part of the runtime linker's default search path, which may be the case if you've installed libpq using the system package manager. This step is necessarily on Helios because the package manager does not put libpq on the default ld.so search path.
118106
. Start CockroachDB using `omicron-dev db-run`:
119107
+
120108
[source,text]

rust-toolchain.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
# We use nightly to enable the "asm" feature for dtrace probes.
21
#
3-
# Additionally, we specify this specific verion of nightly to
4-
# workaround known bugs for illumos on more recent versions.
5-
# Context: https://github.com/rust-lang/rust/pull/85772
2+
# We use nightly for a few unstable features:
63
#
7-
# Short-term: Once that bug is fixed, we should feel free
8-
# to update to migrate to a more recent nightly.
4+
# - the "asm" feature for dtrace probes (within Propolis)
5+
# - the "configurable_env" feature (stabilized in 1.56)
6+
#
7+
# We specify a specific, known-good nightly to avoid regular breakage.
8+
# Once the above features stabilize, we should switch back to "stable".
99
#
10-
# Long-term: Once the ASM feature is stabilized, we should
11-
# consider using stable instead of nightly.
1210

1311
[toolchain]
1412
# NOTE: This toolchain is also specified within .github/workflows/rust.yml
1513
# If you update it here, update that file too.
16-
channel = "nightly-2021-04-24"
14+
channel = "nightly-2021-09-03"
1715
profile = "default"

0 commit comments

Comments
 (0)