launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
13.48k stars 1.28k forks source link

Error E0425 while trying to `cargo run` on FreeBSD machine #3468

Closed Deaponn closed 2 months ago

Deaponn commented 2 months ago

Bug Description

When trying to run command cargo run, the compilation is terminated because of error[E0425]: cannot find function 'size_of' in this scope error. I am running an Actix server on FreeBSD version 14.1-RELEASE-p3.

Details

While using cargo run on my development machine (Manjaro Linux 24.0.7) works as intended, I get the below error while running it on the server (FreeBSD version 14.1-RELEASE-p3):

error[E0425]: cannot find function `size_of` in this scope
   --> /home/deaponn/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-postgres-0.8.1/src/types/cube.rs:307:33
    |
307 |     const PACKED_WIDTH: usize = size_of::<u32>();
    |                                 ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
1   + use core::mem::size_of;
    |
1   + use std::mem::size_of;
    |

For more information about this error, try `rustc --explain E0425`.
error: could not compile `sqlx-postgres` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

My workflow is as follows:

  1. Make some changes in my git repo, tested with localhost postgres database
  2. If everything works I push the changes
  3. Connect to the server via SSH and pull the changes
  4. Run the server there with cargo run to confirm everything works fine

The only difference between development machine and the server is the .env file, but its content is read only after compilation.

Minimal Reproduction

Remember to do it on FreeBSD machine

  1. git clone https://github.com/Deaponn/rybocheck.git
  2. cd rybocheck/backend
  3. mv example.env .env (shouldn't be an issue, but for completeness sake)
  4. cargo run

Info

ghost commented 2 months ago

Same issue, on rust 1.79.0, on Ubuntu 24.04 (kernel: 5.15.153.1-microsoft-standard-WSL2)

ghost commented 2 months ago

Using rustc 1.80.1 seems to work just fine.

CommanderStorm commented 2 months ago

@Deaponn the issue has been resolved 17 hours ago See the following issue for further context: