sgrif / pq-sys

Auto-generated rust bindings for libpq
Apache License 2.0
41 stars 32 forks source link

Add a pq-src crate for a bundled feature flag #46

Closed weiznich closed 10 months ago

weiznich commented 1 year ago

I personally have only access to a linux development environment. That makes it hard to fix the remaining issues on windows/macos. If you are a user of diesel or pq-sys and use one of these platforms consider helping figuring out these issues.

fsasieta commented 12 months ago

While I can't guarantee an allotted time per week to support this, I'm interested in contributing. I primarily develop on my local environment using a MacOS platform (ARM Chip). Would be happy to contribute if there are guidelines to doing this. I've skimmed over the diesel contributing guidelines, but have never contributed to diesel

weiznich commented 12 months ago

@fsasieta Thanks for your interest to contribute. There is no need to have guarantee any amount of time for this, as at least for me that's a free time project. For this specific change I'm interested in the following information:

I'm happy to help with as much information as I can if you hit a road block or if there are any other question.

alcroito commented 12 months ago

Attaching build logs on an intel mac, I hope it helps. Commands were:

clone and checkout REL_16_0 tag
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
mkdir build && cd build
../configure --prefix=$PWD/../installed &> configure.txt
make -j8 &> build.txt
make install &> install.txt

pq_build_logs_intel_mac.zip

Looking at homebrew recipe, they pass a few more flags when building but not sure if they are relevant here https://github.com/Homebrew/homebrew-core/blob/master/Formula/lib/libpq.rb#L43

weiznich commented 11 months ago

Thanks for providing these logs :heart: . I will see if they help an report back with results in the next days

weiznich commented 11 months ago

@fsasieta @alcroito Again thanks for your help here. These logs were really helpful. The build for macos now passes the CI. Would it possible for you to check whether that also works in your local environment. You would need to perform the following steps with a diesel + libpq application:

[patch.crates-io] pq-sys = { git = "https://github.com/sgrif/pq-sys/", branch = "bundled" }



* Build your application with cargo build --features "pq-sys/bundled"
* Verify that everything works as before
* (If you have tests also run the test with that feature flag)
version = 
alcroito commented 11 months ago

Hi, i don't have a project that uses pq, but if build coverage on a non-ci machine is of any value, i can try to build a sample project that uses pq if you can provide one.

weiznich commented 11 months ago

@alcroito In that case you can just try what the CI does:

cargo new test_diesel
cd test_diesel
cargo add diesel --no-default-features --features "postgres"
cargo add pq-sys
echo "[patch.crates-io]" >> Cargo.toml
echo "pq-sys = { git = \"https://github.com/sgrif/pq-sys/\", branch = \"bundled\" }" >> Cargo.toml
echo "use diesel::prelude::*;" > src/main.rs
echo "fn main() { PgConnection::establish(\"foo\").unwrap(); }" >> src/main.rs
cargo build --features "pq-sys/bundled"
alcroito commented 11 months ago

@alcroito In that case you can just try what the CI does:

cargo new test_diesel
cd test_diesel
cargo add diesel --no-default-features --features "postgres"
cargo add pq-sys
echo "[patch.crates-io]" >> Cargo.toml
echo "pq-sys = { git = \"https://github.com/sgrif/pq-sys/\", branch = \"bundled\" }" >> Cargo.toml
echo "use diesel::prelude::*;" > src/main.rs
echo "fn main() { PgConnection::establish(\"foo\").unwrap(); }" >> src/main.rs
cargo build --features "pq-sys/bundled"

I can confirm the build succeeded on an intel mac.

weiznich commented 11 months ago

Perfect. Thanks for confirming :heart:

Now I only need to figure out how to handle the windows build…

weiznich commented 10 months ago

@alcroito Thanks again for your help. I've merged this PR as it's now ready to be used :partying_face: