lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
880 stars 62 forks source link

Build error E0733 #455

Closed matthieupeeters closed 1 week ago

matthieupeeters commented 1 week ago

Introduction

When trying to build SQLpage from source on Ubuntu 24.04 LTS, "rustc" ends with the error: "error[E0733]: recursion in an async fn requires boxing"

To Reproduce

Download SQLpage: $ git clone https://github.com/lovasoa/SQLpage.git Run the build step:

$ cargo build

Actual behavior

The build process ends with:

error[E0733]: recursion in an `async fn` requires boxing
   --> src/webserver/database/syntax_tree.rs:133:1
    |
133 | / pub(super) async fn extract_req_param<'a, 'b>(
134 | |     param: &StmtParam,
135 | |     request: &'a RequestInfo,
136 | |     db_connection: &'b mut DbConn,
137 | | ) -> anyhow::Result<Option<Cow<'a, str>>> {
    | |_________________________________________^ recursive `async fn`
    |
    = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
    = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

error[E0733]: recursion in an `async fn` requires boxing
   --> src/webserver/database/syntax_tree.rs:162:1
    |
162 | / async fn concat_params<'a, 'b>(
163 | |     args: &[StmtParam],
164 | |     request: &'a RequestInfo,
165 | |     db_connection: &'b mut DbConn,
166 | | ) -> anyhow::Result<Option<Cow<'a, str>>> {
    | |_________________________________________^ recursive `async fn`
    |
    = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
    = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

For more information about this error, try `rustc --explain E0733`.
The following warnings were emitted during compilation:

warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/js/tabler.min.js to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm__tabler_core_1.0.0-beta20_dist_js_tabler.min.js".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm__tabler_core_1.0.0-beta20_dist_css_tabler.min.css".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/@tabler/icons-sprite@3.4.0/dist/tabler-sprite.svg to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm__tabler_icons-sprite_3.4.0_dist_tabler-sprite.svg".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/apexcharts@3.49.1/dist/apexcharts.min.js to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm_apexcharts_3.49.1_dist_apexcharts.min.js".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/js/tom-select.popular.min.js to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm_tom-select_2.3.1_dist_js_tom-select.popular.min.js".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/list.js-fixed@2.3.4/dist/list.min.js to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm_list.js-fixed_2.3.4_dist_list.min.js".
warning: sqlpage@0.24.0: Downloading https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler-vendors.min.css to cache file "/home/mathi/src/sqlpag/SQLpage/target/sqlpage_artefacts/https___cdn.jsdelivr.net_npm__tabler_core_1.0.0-beta20_dist_css_tabler-vendors.min.css".

error: could not compile `sqlpage` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

Expected behavior

Compilation succeeds and a binary is build.

Version information

lovasoa commented 1 week ago

Hello and welcome to SQLPage !

We depend on the latest rust compiler; the error you are seeing is due to ubuntu packaging a version of rustc < 1.77. We depend on this feature specifically: https://blog.rust-lang.org/2024/03/21/Rust-1.77.0.html#support-for-recursion-in-async-fn

You can install the latest rust compiler easily with rustup: https://rustup.rs/

Out of curiosity, what are you trying to implement in sqlpage ?

matthieupeeters commented 1 week ago

Hi Lovasoa,

Thanks! I will try again with a newer version of the rust compiler.

I love your project and work, but it has little to do with my work at the moment. I am trying to show some open geographic datasets in a map, so that's what I am using it for.

matthieupeeters commented 1 week ago

Indeed it compiles fine with a newer version of rustc.