Commit f663d4b 1 parent 26ca41a commit f663d4b Copy full SHA for f663d4b
File tree 3 files changed +47
-0
lines changed
3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use cairo_lang_utils::Upcast;
5
5
use indoc:: formatdoc;
6
6
use itertools:: Itertools ;
7
7
use smol_str:: { SmolStr , ToSmolStr } ;
8
+ use std:: thread;
8
9
9
10
use scarb_ui:: args:: FeaturesSpec ;
10
11
use scarb_ui:: components:: Status ;
@@ -150,7 +151,20 @@ where
150
151
Ok ( ( ) )
151
152
}
152
153
154
+ /// Run compiler in a new thread.
155
+ /// The stack size of created threads can be altered with `RUST_MIN_STACK` env variable.
153
156
pub fn compile_unit ( unit : CompilationUnit , ws : & Workspace < ' _ > ) -> Result < ( ) > {
157
+ thread:: scope ( |s| {
158
+ thread:: Builder :: new ( )
159
+ . name ( format ! ( "scarb compile {}" , unit. id( ) ) )
160
+ . spawn_scoped ( s, || compile_unit_inner ( unit, ws) )
161
+ . expect ( "Failed to spawn compiler thread." )
162
+ . join ( )
163
+ . expect ( "Compiler thread has panicked." )
164
+ } )
165
+ }
166
+
167
+ fn compile_unit_inner ( unit : CompilationUnit , ws : & Workspace < ' _ > ) -> Result < ( ) > {
154
168
let package_name = unit. main_package_id ( ) . name . clone ( ) ;
155
169
156
170
ws. config ( )
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ const sidebar = {
90
90
"https://github.com/software-mansion/scarb/tree/main/examples" ,
91
91
) ,
92
92
p ( "Scarb vs Cargo" , "/docs/scarb-vs-cargo" ) ,
93
+ p ( "Troubleshooting" , "/docs/troubleshooting" ) ,
93
94
] ,
94
95
} ,
95
96
] ,
Original file line number Diff line number Diff line change
1
+ # Troubleshooting
2
+
3
+ It is possible that you encounter some issues while working with Scarb.
4
+ This page lists some common issues and their possible solutions.
5
+ Before reporting an issue to the Scarb team, please make sure to check the following list.
6
+
7
+ ## Stack overflow
8
+
9
+ In case of a bug in the Cairo compiler implementation, it may consume too much stack space in some specific cases.
10
+ Usually, this happens while compiling large Cairo codebases.
11
+ This often results in an error message like:
12
+
13
+ ```
14
+ thread 'main' has overflowed its stack
15
+ fatal runtime error: stack overflow
16
+ Aborted (core dumped)
17
+ ```
18
+
19
+ Usually it does not seem to consume infinite amounts though, so you can try to confine it in an arbitrarily chosen
20
+ big memory chunk.
21
+
22
+ To run the Cairo compiler with a bigger stack size, you can use the ` RUST_MIN_STACK ` environmental variable.
23
+ For example, to set the stack size to 128MB, you can run:
24
+
25
+ ``` bash
26
+ RUST_MIN_STACK=134217728 scarb build
27
+ ```
28
+
29
+ Please note that this is a workaround and not a permanent solution.
30
+ If you encounter this issue, please report it to the compiler team at [ Cairo issues] .
31
+
32
+ [ Cairo issues ] : https://github.com/starkware-libs/cairo/issues/
You can’t perform that action at this time.
0 commit comments