-
Notifications
You must be signed in to change notification settings - Fork 32
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
Using asan-enabled libpq is impossible due to inability to pass linker options to cc #70
Comments
I'm happy to accept a PR for this as long as it contains a sufficient amount of documentation. |
Thank you for paying attention to this! But after some experiments, I've discovered that those options don't work. The only way to use such libpq, that I've found, is to use static library and specify sanitizer libs explicitly, and also specify additional postgres libs:
So it's not clear to me yet how this can be resolved — maybe with something like PQ_EXTRA_LIBS="asan ubsan ..."... |
If you goal is to purely have a Asan enabled libpq build you can try to use the same approach as diesel: https://github.com/diesel-rs/diesel/blob/master/.github/workflows/ci.yml#L341-L344 |
Thanks for the reference, but I think they still use standard libpq installed above: |
That command builds its own copy of libpq with sanitizer support enabled. The important bit is the The relevant building code is here: https://github.com/sgrif/pq-sys/blob/master/pq-src/build.rs#L200 |
Thank you for the explanation! The approach with the bundled libpq really works for diesel test, but unfortunately, the "diesel" crate doesn't export such a feature (postgres-bundle-asan or alike), only "diesel-cli" does (and even it exports postgres-bundle, not postgres-bundle-asan). So the question "how to use (prebuilt) asan-enabled libpq" looks still open to me (except for static linking, described above). |
You don't need these features to exist on diesel. Crate features are additive, which means you can just add the relevant crate ( |
When trying to use asan-enabled libpq (as a part of a complete postgres build), compiled as follows:
I've stumbled upon the inability to use this libpq with pq-sys. Please look at a simple demo script:
which fails for me with the following errors:
I guess, this issue can be resolved with something like:
Probably an additional environment variable like PQ_LINK_OPTIONS="-fsanitize=address -fsanitize=undefined -static-libasan -static-libubsan" could work?
(The same procedure completes successfully with postgres compiled without sanitizers enabled.)
The text was updated successfully, but these errors were encountered: