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

Segfault on cross compiling to musl #914

Open
enaut opened this issue Mar 8, 2021 · 6 comments
Open

Segfault on cross compiling to musl #914

enaut opened this issue Mar 8, 2021 · 6 comments

Comments

@enaut
Copy link

enaut commented Mar 8, 2021

Setup

Versions

  • Rust: x86_64-unknown-linux-musl
  • Diesel: 1.4
  • Database: SQLITE

Feature Flags

  • diesel: features = ["sqlite"]

Problem Description

When cross compiling to x86_64-unknown-linux-musl target diesel segfaults immediately in line: https://github.com/diesel-rs/diesel/blob/bec389a1ea329c161fc7a8fb8df8bea29a3432bf/diesel/src/sqlite/connection/raw.rs#L23

Workaround

In #musl IRC I was given the workaround to add:

libsqlite3-sys = { version = "*", features = ["bundled"] }

to Cargo.toml solves this issue.

So somehow even when cross compiling the libsqlite3-sys is not bundled but dynamically linked which fails.

What are you trying to accomplish?

I want to use musl builds to have a standalone binary of my actix-web app.

Steps to reproduce

I created a minimal example: https://github.com/enaut/musl-segfault-sample

compile and run on linux with: cargo run --target x86_64-unknown-linux-musl

@avkonst
Copy link

avkonst commented Mar 15, 2021

I confirm the problem. I have got the same.

@jbsiddall
Copy link

Im having same issue, but i'm using postgres instead of sqlite. I've not tried the workaround yet.

@thomcc
Copy link
Member

thomcc commented Jun 2, 2021

I think this comes from a dynamic/static C runtime mismatch, but am not 100% certain.

@enaut
Copy link
Author

enaut commented Jun 6, 2021

It may be helpful to automagically add the "bundled" feature when compiling for musl target - or a similar condition?

dgoulet-tor pushed a commit to dgoulet-tor/arti that referenced this issue Aug 27, 2021
see rusqlite/rusqlite#914

sha256: 684ebc4b8c270fc63beba185f6c54ceeb98734f13aa7aeca9b64acb33432a21c
wang-q added a commit to wang-q/intspan that referenced this issue Feb 21, 2022
wang-q added a commit to wang-q/nwr that referenced this issue Feb 21, 2022
@hellerbarde
Copy link

Potentially related: tonarino/innernet#228 (comment)

@rolandjitsu
Copy link

I've also stumbled into a segfault: #1290 (comment).

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

6 participants