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

Compiling diesel-migrations for FreeBSD fails. #520

Closed
gahag opened this issue Feb 13, 2021 · 3 comments · Fixed by #549
Closed

Compiling diesel-migrations for FreeBSD fails. #520

gahag opened this issue Feb 13, 2021 · 3 comments · Fixed by #549
Labels
A-bsd Area: BSD-family targets container-images

Comments

@gahag
Copy link

gahag commented Feb 13, 2021

Compiling diesel-migrations with cross build --target=x86_64-unknown-freebsd results in the following error:

error: libthr.so.3: cannot open shared object file: No such file or directory
  --> /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/diesel_migrations-1.4.0/src/lib.rs:82:1
   |
82 | extern crate migrations_macros;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: could not compile `diesel_migrations`

Cargo.toml:

name = "ohgodwhy"
version = "0.1.0"
authors = ["gahag <[email protected]>"]
edition = "2018"

[dependencies]
diesel = { version = "1.4", features = ["sqlite"] }
diesel_migrations = { version = "1.4", features = ["sqlite"] }

main.rs:

fn main() {
    println!("Hello, world!");
}

Is this an issue with the cross' FreeBSD setup, or with diesel-migrations?

@gahag
Copy link
Author

gahag commented Feb 14, 2021

I have two projects that use diesel_migrations. For some odd reason, one of them builds fine, while the other fails with the same error as the supplied minimal example. I have no idea why one of them works.

tesaguri added a commit to tesaguri/cross that referenced this issue Apr 8, 2021
The environment variable breaked procedural macro crates which depends
on `libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path
anyway.

Fixes cross-rs#520.
tesaguri added a commit to tesaguri/cross that referenced this issue Apr 8, 2021
The environment variable broke procedural macro crates which depends on
`libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path
anyway.

Fixes cross-rs#520.
tesaguri added a commit to tesaguri/cross that referenced this issue Apr 8, 2021
the environment variable broke procedural macro crates which depends on
`libsqlite3-sys`, such as `migrations_macros`.

even without the variable, `libsqlite3-sys` finds the correct path
anyway.

fixes cross-rs#520.
tesaguri added a commit to tesaguri/cross that referenced this issue Apr 8, 2021
the environment variable has broken procedural macro crates which
depends on `libsqlite3-sys`, such as `migrations_macros`.

even without the variable, `libsqlite3-sys` finds the correct path
anyway.

fixes cross-rs#520.
@tesaguri
Copy link
Contributor

tesaguri commented Apr 8, 2021

This seems to be caused by SQLITE3_LIB_DIR environment variable in the FreeBSD container, which, I guess, causes the procedural macro to attempt to link against the target libsqlite3, instead of the host's one.

I have filed a fix for this issue: #549.

@gahag
Copy link
Author

gahag commented Apr 8, 2021

It's great that you found the issue. I'm excited to try on this patch.

tesaguri added a commit to tesaguri/cross that referenced this issue Aug 9, 2021
the environment variable has broken procedural macro crates which
depends on `libsqlite3-sys`, such as `migrations_macros`.

even without the variable, `libsqlite3-sys` finds the correct path
anyway.

fixes cross-rs#520.
bors bot added a commit that referenced this issue Aug 29, 2021
505: Make the `USER` variable to `docker` optional r=reitermarkus a=eZanmoto

Populating this variable fails under Linux if the local user doesn't have a username. This may happen when using Docker and mapping a user ID from the host into a container, such as when using `--user=$(id -u):$(id -g)`. I suggest making the `USER` environment variable passed to `docker` optional, which allows `cross` to work in the given scenario.

511: FreeBSD: add libssp r=reitermarkus a=junhochoi

This is required to build some native projects
which is build with -fstack-protector when linked.

Also update sqlite3 version (quarterly is updated)

549: don't set `SQLITE3_LIB_DIR` in FreeBSD images r=reitermarkus a=tesaguri

The environment variable has broken procedural macro crates which depend on `libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path anyway.

This fixes #520, as shown in the CI at [tesaguri/cross-freebsd-diesel_migrations-test] repository.

Additionally, this PR updates `freebsd{,-extras}.sh` to use OpenSSL from the base system, because the URLs `https://pkg.freebsd.org/FreeBSD:12:{amd64,i686}/quarterly/All/openssl-1.1.1j,1.txz` returns `404` now.

[tesaguri/cross-freebsd-diesel_migrations-test]: https://github.com/tesaguri/cross-freebsd-diesel_migrations-test

Co-authored-by: Sean Kelleher <[email protected]>
Co-authored-by: Junho Choi <[email protected]>
Co-authored-by: Markus Reiter <[email protected]>
Co-authored-by: Daiki Mizukami <[email protected]>
bors bot added a commit that referenced this issue Aug 29, 2021
511: FreeBSD: add libssp r=reitermarkus a=junhochoi

This is required to build some native projects
which is build with -fstack-protector when linked.

Also update sqlite3 version (quarterly is updated)

549: don't set `SQLITE3_LIB_DIR` in FreeBSD images r=reitermarkus a=tesaguri

The environment variable has broken procedural macro crates which depend on `libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path anyway.

This fixes #520, as shown in the CI at [tesaguri/cross-freebsd-diesel_migrations-test] repository.

Additionally, this PR updates `freebsd{,-extras}.sh` to use OpenSSL from the base system, because the URLs `https://pkg.freebsd.org/FreeBSD:12:{amd64,i686}/quarterly/All/openssl-1.1.1j,1.txz` returns `404` now.

[tesaguri/cross-freebsd-diesel_migrations-test]: https://github.com/tesaguri/cross-freebsd-diesel_migrations-test

Co-authored-by: Junho Choi <[email protected]>
Co-authored-by: Markus Reiter <[email protected]>
Co-authored-by: Daiki Mizukami <[email protected]>
bors bot added a commit that referenced this issue Aug 29, 2021
549: don't set `SQLITE3_LIB_DIR` in FreeBSD images r=reitermarkus a=tesaguri

The environment variable has broken procedural macro crates which depend on `libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path anyway.

This fixes #520, as shown in the CI at [tesaguri/cross-freebsd-diesel_migrations-test] repository.

Additionally, this PR updates `freebsd{,-extras}.sh` to use OpenSSL from the base system, because the URLs `https://pkg.freebsd.org/FreeBSD:12:{amd64,i686}/quarterly/All/openssl-1.1.1j,1.txz` returns `404` now.

[tesaguri/cross-freebsd-diesel_migrations-test]: https://github.com/tesaguri/cross-freebsd-diesel_migrations-test

Co-authored-by: Daiki Mizukami <[email protected]>
tesaguri added a commit to tesaguri/cross that referenced this issue Oct 3, 2021
the environment variable has broken procedural macro crates which
depends on `libsqlite3-sys`, such as `migrations_macros`.

even without the variable, `libsqlite3-sys` finds the correct path
anyway.

fixes cross-rs#520.
tesaguri added a commit to tesaguri/cross that referenced this issue Oct 3, 2021
the environment variable has broken procedural macro crates which
depends on `libsqlite3-sys`, such as `migrations_macros`.

even without the variable, `libsqlite3-sys` finds the correct path
anyway.

fixes cross-rs#520.
bors bot added a commit that referenced this issue Mar 15, 2022
549: don't set `SQLITE3_LIB_DIR` in FreeBSD images r=reitermarkus a=tesaguri

The environment variable has broken procedural macro crates which depend on `libsqlite3-sys`, such as `migrations_macros`.

Even without the variable, `libsqlite3-sys` finds the correct path anyway.

This fixes #520, as shown in the CI at [tesaguri/cross-freebsd-diesel_migrations-test] repository.

~Additionally, this PR updates `freebsd{,-extras}.sh` to use OpenSSL from the base system, because the URLs `https://pkg.freebsd.org/FreeBSD:12:{amd64,i686}/quarterly/All/openssl-1.1.1j,1.txz` returns `404` now.~

[tesaguri/cross-freebsd-diesel_migrations-test]: https://github.com/tesaguri/cross-freebsd-diesel_migrations-test

Co-authored-by: Daiki Mizukami <[email protected]>
@bors bors bot closed this as completed in 1ab9042 Mar 15, 2022
@Alexhuszagh Alexhuszagh added container-images A-bsd Area: BSD-family targets labels Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bsd Area: BSD-family targets container-images
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants