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

diesel_codegen forces dynamic linkage #19

Closed
clux opened this issue Oct 16, 2017 · 4 comments
Closed

diesel_codegen forces dynamic linkage #19

clux opened this issue Oct 16, 2017 · 4 comments

Comments

@clux
Copy link
Owner

clux commented Oct 16, 2017

libpq exists now, and the pq-sys crate will compile, however, programs using diesel_codegen will not. Not quite sure what to do about it. It is apparently trying to link dynamically itself with ssl:

   Compiling webapp v0.1.0 (file:///volume)
error: /volume/target/release/deps/libdiesel_codegen-70f8d8f6e88545a4.so: undefined symbol: SSL_set_ex_data
 --> src/lib.rs:4:1
  |
4 | extern crate diesel_codegen;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: Could not compile `webapp`.
clux added a commit that referenced this issue Oct 16, 2017
@clux clux mentioned this issue Oct 16, 2017
@clux clux changed the title fix build of diesel_codegen diesel_codegen forces dynamic linkage Oct 19, 2017
@clux
Copy link
Owner Author

clux commented Oct 19, 2017

not sure why diesel_codegen needs to force us into dynamic land. Both rocket_codegen and serde_codegen work fine statically linked. At any rate make test-diesel will produce the current failure in a minimal environment. None of the other popular rust build images currently work with this either.

@clux
Copy link
Owner Author

clux commented Oct 20, 2017

Actually, golddranks musl image does successfully build diesel_codegen! I was using it with wrong parameters. It's also reliant on sgrif/pq-sys#18 so need a patched pq-sys in Cargo.toml, but should be able to bisect from here.

@clux clux closed this as completed in b93f1db Oct 20, 2017
clux added a commit that referenced this issue Oct 20, 2017
more diesel advenures - fixes #19
@clux
Copy link
Owner Author

clux commented Oct 20, 2017

So the codegen crates do create dynamic libraries, but interestingly they are only used at build time (to generate code naturally), so they can use the gnu toolchain in the build image (which the diesel_codegen is doing). Today's version of muslrust will have the fix, which will work for people as long as they patch pq-sys to follow that PR above:

[dependencies.diesel]
features = ["postgres"]
version = "0.16.0"

[dependencies.diesel_codegen]
features = ["postgres"]
version = "0.16.0"

[patch.crates-io]
pq-sys = { git = 'https://github.com/golddranks/pq-sys' }

@clux
Copy link
Owner Author

clux commented Mar 7, 2018

With newer versions of diesel, and a merged pr, this can now use the official versions (however with a yet to be released pq-sys):

[dependencies.diesel]
features = ["postgres"]
version = "1.1.1"

[patch.crates-io]
pq-sys = { git = 'https://github.com/sgrif/pq-sys' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant