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

Fails to compile rustc 1.39 on aarch64 #208

Open
akirakyle opened this issue Jan 4, 2022 · 23 comments
Open

Fails to compile rustc 1.39 on aarch64 #208

akirakyle opened this issue Jan 4, 2022 · 23 comments
Labels
stale No response received after potential fixes.

Comments

@akirakyle
Copy link

I thought I'd see if the rustc bootstrap chain in guix on aarch64 might work. I think mrustc built successfully but then it encountered an error trying to build rustc 1.39. The following is the end of the build log:

(0/17) BUILDING core v0.0.0
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/bin/mrustc rustc-1.39.0-src/src/libcore/lib.rs -o output/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output/libcore.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output --edition 2018
rustc-1.39.0-src/src/libcore/slice/mod.rs:67: warn:0:Unexpected attribute allow_internal_unstable on associated item
rustc-1.39.0-src/src/libcore/str/mod.rs:2173: warn:0:Unexpected attribute allow_internal_unstable on associated item
In file included from output/libcore.rlib.c:7:
output/libcore.rlib.c: In function ‘ZRQG2ch4core50_0_03ffi10VaListImpl0g2cb05clone5Clone0gb30g’:
output/libcore.rlib.c:219717:10: warning: passing argument 1 of ‘__builtin_va_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
219717 |  va_copy(var3, arg0);
       |          ^~~~
       |          |
       |          struct s_ZRG2ch4core50_0_03ffi10VaListImpl0g **
output/libcore.rlib.c:219717:10: note: expected ‘__va_list *’ but argument is of type ‘struct s_ZRG2ch4core50_0_03ffi10VaListImpl0g **’
output/libcore.rlib.c:219717:16: error: incompatible type for argument 2 of ‘__builtin_va_copy’
219717 |  va_copy(var3, arg0);
       |                ^~~~
       |                |
       |                struct s_ZRG2ch4core50_0_03ffi10VaListImpl0g *
output/libcore.rlib.c:219717:16: note: expected ‘__va_list’ but argument is of type ‘struct s_ZRG2ch4core50_0_03ffi10VaListImpl0g *’
C Compiler failed to execute - error code 256
Process exited with non-zero exit status 1
BUILD FAILED
make: *** [minicargo.mk:82: output/libstd.rlib] Error 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-f" "minicargo.mk" "output/rustc" "-j4" "RUSTC_TARGET=aarch64-unknown-linux-gnu" "RUSTC_VERSION=1.39.0" "MRUSTC_TARGET_VER=1.39" "OUTDIR_SUF=") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 588.9 seconds
command "make" "-f" "minicargo.mk" "output/rustc" "-j4" "RUSTC_TARGET=aarch64-unknown-linux-gnu" "RUSTC_VERSION=1.39.0" "MRUSTC_TARGET_VER=1.39" "OUTDIR_SUF=" failed with status 2

I tried searching this project but I couldn't get a clear idea of if this is supposed to be supported by mrustc? Thanks

@thepowersgang
Copy link
Owner

Those va_copy warnings/errors should have been fixed in 2cf0b74

@akirakyle
Copy link
Author

I tried rebuilding from the latest commit and now I get the following error:

[32m(41/112) BUILDING quote v0.6.12 with features [proc-macro]�[0m
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/bin/mrustc rustc-1.39.0-src/vendor/quote-0.6.12/src/lib.rs -o output/rustc-build/libquote-0_6_12_H1.rlib --crate-name quote --crate-type rlib -C emit-depfile=output/rustc-build/libquote-0_6_12_H1.rlib.d --crate-tag 0_6_12_H1 -g --cfg debug_assertions -O -L output -L output/rustc-build --cfg feature="proc-macro" --extern proc_macro2=output/rustc-build/libproc_macro2-0_4_30_H2.rlib
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/bin/mrustc rustc-1.39.0-src/vendor/syn-0.15.35/build.rs --crate-name build --crate-type bin -o output/rustc-build/build_syn-0_15_35_H3f7_run -L output/rustc-build -g -L output --cfg feature=derive --cfg feature=parsing --cfg feature=printing --cfg feature=clone-impls --cfg feature=proc-macro --cfg feature=visit --cfg feature=extra-traits --cfg feature=quote --cfg feature=full
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/output/rustc-build/build_syn-0_15_35_H3f7_run
�[32m(42/112) BUILDING syn v0.15.35 with features [derive,parsing,printing,clone-impls,proc-macro,visit,extra-traits,quote,full]�[0m
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/bin/mrustc rustc-1.39.0-src/vendor/syn-0.15.35/src/lib.rs -o output/rustc-build/libsyn-0_15_35_H3f7.rlib --crate-name syn --crate-type rlib -C emit-depfile=output/rustc-build/libsyn-0_15_35_H3f7.rlib.d --crate-tag 0_15_35_H3f7 -g --cfg debug_assertions -O -L output -L output/rustc-build --cfg syn_can_use_thread_id --cfg syn_can_use_associated_constants --cfg syn_can_call_macro_by_path --cfg syn_disable_nightly_tests --cfg feature="derive" --cfg feature="parsing" --cfg feature="printing" --cfg feature="clone-impls" --cfg feature="proc-macro" --cfg feature="visit" --cfg feature="extra-traits" --cfg feature="quote" --cfg feature="full" --extern proc_macro2=output/rustc-build/libproc_macro2-0_4_30_H2.rlib --extern quote=output/rustc-build/libquote-0_6_12_H1.rlib --extern unicode_xid=output/rustc-build/libunicode_xid-0_1_0.rlib
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cE9core0_0_06option6Option4Some1gG2cD15syn0_15_35_H3f72ty3Abi0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30786:37: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f72ty3Abi0g’)
30786 |  /* Niche tag */rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"core-0_0_0"::option::Option<::"syn-0_15_35_H3f7"::ty::Abi/*S*/,> #1, {a0})
      |                                     ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74attr4Meta9NameValue0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30798:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74attr13MetaNameValue0g’)
30798 |  rv.DATA.var_2._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::attr::Meta #2, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74attr10NestedMeta7Literal0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30804:22: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f73lit3Lit0g’)
30804 |  rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::attr::NestedMeta #1, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74attr10NestedMeta4Meta0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30809:37: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f74attr4Meta0g’)
30809 |  /* Niche tag */rv.DATA.var_0._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::attr::NestedMeta #0, {a0})
      |                                     ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74expr4Expr3Lit0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30869:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74expr7ExprLit0g’)
30869 |  rv.DATA.var_8._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::expr::Expr #8, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74expr21GenericMethodArgument4Type0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:30928:37: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f72ty4Type0g’)
30928 |  /* Niche tag */rv.DATA.var_0._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::expr::GenericMethodArgument #0, {a0})
      |                                     ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74expr4Stmt4Item0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31009:37: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f74item4Item0g’)
31009 |  /* Niche tag */rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::expr::Stmt #1, {a0})
      |                                     ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item5FnArg8Captured0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31038:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item11ArgCaptured0g’)
31038 |  rv.DATA.var_2._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::FnArg #2, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item5FnArg7Ignored0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31044:22: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f72ty4Type0g’)
31044 |  rv.DATA.var_4._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::FnArg #4, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item8ImplItem5Const0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31085:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item13ImplItemConst0g’)
31085 |  rv.DATA.var_0._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::ImplItem #0, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item8ImplItem6Method0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31103:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item14ImplItemMethod0g’)
31103 |  rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::ImplItem #1, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item8ImplItem4Type0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31109:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item12ImplItemType0g’)
31109 |  rv.DATA.var_2._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::ImplItem #2, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item4Item2Fn0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31139:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item6ItemFn0g’)
31139 |  rv.DATA.var_4._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::Item #4, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item4Item10ForeignMod0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31145:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item14ItemForeignMod0g’)
31145 |  rv.DATA.var_6._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::Item #6, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item9TraitItem5Const0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31216:37: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item14TraitItemConst0g’)
31216 |  /* Niche tag */rv.DATA.var_0._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::TraitItem #0, {a0})
      |                                     ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item9TraitItem6Method0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31228:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item15TraitItemMethod0g’)
31228 |  rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::TraitItem #1, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74item9TraitItem4Type0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31234:22: error: invalid type argument of unary ‘*’ (have ‘struct s_ZRG2cD15syn0_15_35_H3f74item13TraitItemType0g’)
31234 |  rv.DATA.var_2._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::item::TraitItem #2, {a0})
      |                      ^~~~~
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c: In function ‘ZRG3cD15syn0_15_35_H3f74path15GenericArgument4Type0g’:
output/rustc-build/libsyn-0_15_35_H3f7.rlib.c:31426:22: error: invalid type argument of unary ‘*’ (have ‘struct e_ZRG2cD15syn0_15_35_H3f72ty4Type0g’)
31426 |  rv.DATA.var_1._0 = (*arg0); // retval = Variant(::"syn-0_15_35_H3f7"::path::GenericArgument #1, {a0})
      |                      ^~~~~

I can also post the whole logfile if you'd like. Thanks!

@thepowersgang
Copy link
Owner

This might be a bug around handling of high-aligned arguments (i.e. arguments with alignment more than one pointer). Could you check the alignment of these types (should be in the generated source just below the type definition)

@thepowersgang
Copy link
Owner

Confirmed - Didn't handle high-align types in enum and struct constructors.
Fix incoming (once test cycle is complete)

@akirakyle
Copy link
Author

Fantastic, thanks! Do you still need me to send the generated source?

@thepowersgang
Copy link
Owner

No, I figured it out from the function names (and thinking about where it could have been omitted).

@thepowersgang
Copy link
Owner

Fix committed above, can you confirm that it worked?

@akirakyle
Copy link
Author

It appears to be working in that the compilation proceeds beyond that point. However I'm now running out of memory on the following:

(93/112) BUILDING rustc v0.0.0
> /tmp/guix-build-rust-1.39.0.drv-0/mrustc/bin/mrustc rustc-1.39.0-src/src/librustc/lib.rs -o output/rustc-build/librustc.rlib --crate-name rustc --crate-type rlib -C emit-depfile=output/rustc-build/librustc.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output -L output/rustc-build --edition 2018 --extern arena=output/rustc-build/libarena.rlib --extern bitflags=output/rustc-build/libbitflags-1_1_0.rlib --extern fmt_macros=output/rustc-build/libfmt_macros.rlib --extern graphviz=output/rustc-build/libgraphviz.rlib --extern jobserver=output/rustc-build/libjobserver-0_1_16.rlib --extern num_cpus=output/rustc-build/libnum_cpus-1_8_0.rlib --extern scoped_tls=output/rustc-build/libscoped_tls-1_0_0.rlib --extern log=output/rustc-build/liblog-0_4_8_H8400.rlib --extern rustc_rayon=output/rustc-build/librustc_rayon-0_2_0.rlib --extern rustc_rayon_core=output/rustc-build/librustc_rayon_core-0_2_0.rlib --extern polonius_engine=output/rustc-build/libpolonius_engine-0_10_0.rlib --extern rustc_apfloat=output/rustc-build/librustc_apfloat.rlib --extern rustc_target=output/rustc-build/librustc_target.rlib --extern rustc_macros=output/rustc-build/librustc_macros-0_1_0-plugin --extern rustc_data_structures=output/rustc-build/librustc_data_structures.rlib --extern errors=output/rustc-build/librustc_errors.rlib --extern rustc_serialize=output/rustc-build/libserialize.rlib --extern syntax=output/rustc-build/libsyntax.rlib --extern syntax_pos=output/rustc-build/libsyntax_pos.rlib --extern backtrace=output/rustc-build/libbacktrace-0_3_37_H101862.rlib --extern parking_lot=output/rustc-build/libparking_lot-0_9_0_H2.rlib --extern byteorder=output/rustc-build/libbyteorder-1_3_2_H2.rlib --extern chalk_engine=output/rustc-build/libchalk_engine-0_9_0.rlib --extern rustc_fs_util=output/rustc-build/librustc_fs_util.rlib --extern smallvec=output/rustc-build/libsmallvec-0_6_10_H19.rlib --extern measureme=output/rustc-build/libmeasureme-0_3_0.rlib

This was with 8GB + 2GB zswap of memory available. I'm going to try adding additional swapspace and hopefully it'll work this time. Is there anything that can be done to reduce the memory requirements?

@thepowersgang
Copy link
Owner

That one is a bit harder. Manually runing mrustc without -g might help (unfortunately, it's hard-coded on in minicargo).

@akirakyle
Copy link
Author

I upped the available memory to 14GB and it successfully built rustc and cargo. However, now I'm encountering a segfault when trying to rebuild stdlib with rustc. Guix runs this bootstrapping process in an isolated build environment so I'll need to manually step through the process so I can get a backtrace out.

@catap
Copy link
Contributor

catap commented Jan 31, 2022

I'm using local root: 3ec8cd8 and build fails on aarch64 with macOS 12 as:

> /Users/catap/src/mrustc/bin/mrustc rustc-1.39.0-src/vendor/libc/build.rs --crate-name build --crate-type bin -o output-1.39.0/build_libc-0_2_62_Hd_run -L output-1.39.0 -g --cfg feature=rustc-dep-of-std --cfg feature=align --cfg feature=rustc-std-workspace-core
ld: unknown option: --start-group

I'm using standard clang from macOS.

A trivial patch:

diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
index 3bc23222..ce85585f 100644
--- a/src/trans/codegen_c.cpp
+++ b/src/trans/codegen_c.cpp
@@ -1210,7 +1210,7 @@ namespace {
                     {
                         args.push_back(c);
                     }
-                    args.push_back("-Wl,--start-group");    // Group to avoid linking ordering
+                    //args.push_back("-Wl,--start-group");    // Group to avoid linking ordering
                     //args.push_back("-Wl,--push-state");
                     for(auto l_d : libraries_and_dirs)
                     {
@@ -1240,7 +1240,7 @@ namespace {
                         }
                     }
                     //args.push_back("-Wl,--pop-state");
-                    args.push_back("-Wl,--end-group");    // Group to avoid linking ordering
+                    //args.push_back("-Wl,--end-group");    // Group to avoid linking ordering
                     for( const auto& a : Target_GetCurSpec().m_backend_c.m_linker_opts )
                     {
                         args.push_back( a.c_str() );

allows to move forward and have linking error on 1.39.0:

Undefined symbols for architecture arm64:
  "_fstat$INODE64", referenced from:
      _ZRG3cD13std0_0_0_H3002fsB_05inner0g in libstd.rlib.o
      _ZRG2cD13std0_0_0_H3002fs19initial_buffer_size0g in libstd.rlib.o
      _ZRG3cD13std0_0_0_H3002fsB_15inner0g in libstd.rlib.o
      _ZRIG2cD13std0_0_0_H3002fs4File0g8metadata0g in libstd.rlib.o
      _ZRG4cD13std0_0_0_H3003sys4unix2fs9open_from0g in libstd.rlib.o
      _ZRG4cD13std0_0_0_H3003sys4unix2fs27open_to_and_set_permissions0g in libstd.rlib.o
      _ZRG3cD13std0_0_0_H30010sys_common2fs4copy0g in libstd.rlib.o
      ...
  "_lstat$INODE64", referenced from:
      _ZRG4cD13std0_0_0_H3003sys4unix2fs5lstat0g in libstd.rlib.o
  "_readdir_r$INODE64", referenced from:
      _ZRQG4cD13std0_0_0_H3003sys4unix2fs7ReadDir0g4cE9core0_0_04iter6traits8iterator8Iterator0g4next0g in libstd.rlib.o
  "_stat$INODE64", referenced from:
      _ZRG4cD13std0_0_0_H3003sys4unix2fs4stat0g in libstd.rlib.o
ld: symbol(s) not found for architecture arm64

Thus, I've tried 1.54.0 with cp -r stable-1.54.0-linux stable-1.54.0-macos and had:

(0/13) BUILDING core v0.0.0
> /Users/catap/src/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output-1.54.0 --edition 2018
:0: BUG:src/mir/from_hir.cpp:524: TODO: visit - asm! const
Process was terminated with signal 6
FAILING COMMAND:  /Users/catap/src/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output-1.54.0 --edition 2018 make: *** [output-1.54.0/libstd.rlib] Segmentation fault: 11

some logs:

catap@Kirills-mini-m1 output-1.54.0 % cat libcore.rlib_dbg.txt 
Setup: V V V
(0.00 s) Setup: DONE
Target Load: V V V
(0.00 s) Target Load: DONE
Parse: V V V
(0.69 s) Parse: DONE
LoadCrates: V V V
(0.00 s) LoadCrates: DONE
Expand: V V V
(0.66 s) Expand: DONE
Implicit Crates: V V V
(0.00 s) Implicit Crates: DONE
Resolve Use: V V V
(0.01 s) Resolve Use: DONE
Resolve Index: V V V
(0.03 s) Resolve Index: DONE
Resolve Absolute: V V V
(0.10 s) Resolve Absolute: DONE
HIR Lower: V V V
(0.20 s) HIR Lower: DONE
Resolve Type Aliases: V V V
(0.03 s) Resolve Type Aliases: DONE
Resolve Bind: V V V
(0.05 s) Resolve Bind: DONE
Resolve UFCS Outer: V V V
(0.03 s) Resolve UFCS Outer: DONE
Resolve HIR Self Type: V V V
(0.02 s) Resolve HIR Self Type: DONE
Resolve HIR Markings: V V V
(0.02 s) Resolve HIR Markings: DONE
Sort Impls: V V V
(0.00 s) Sort Impls: DONE
Resolve UFCS paths: V V V
(0.20 s) Resolve UFCS paths: DONE
Constant Evaluate: V V V
(0.87 s) Constant Evaluate: DONE
Typecheck Outer: V V V
(0.04 s) Typecheck Outer: DONE
Typecheck Expressions: V V V
(1.22 s) Typecheck Expressions: DONE
Expand HIR Annotate: V V V
(0.05 s) Expand HIR Annotate: DONE
Expand HIR Static Borrow: V V V
(0.05 s) Expand HIR Static Borrow: DONE
Expand HIR Closures: V V V
(0.13 s) Expand HIR Closures: DONE
Expand HIR VTables: V V V
(0.02 s) Expand HIR VTables: DONE
Expand HIR Calls: V V V
(0.02 s) Expand HIR Calls: DONE
Expand HIR Reborrows: V V V
(0.02 s) Expand HIR Reborrows: DONE
Expand HIR ErasedType: V V V
(0.03 s) Expand HIR ErasedType: DONE
Typecheck Expressions (validate): V V V
(0.29 s) Typecheck Expressions (validate): DONE
Lower MIR: V V V
catap@Kirills-mini-m1 output-1.54.0 % 

@bjorn3
Copy link
Contributor

bjorn3 commented Jan 31, 2022

Rustc 1.39 doesn't support macOS for AArch64. Basic support was only introduced stratung from rustc 1.47 in rust-lang/rust#74541.

@catap
Copy link
Contributor

catap commented Jan 31, 2022

@bjorn3 but 1.54.0 should work ;) Here it has some quite deep issue.

@bjorn3
Copy link
Contributor

bjorn3 commented Jan 31, 2022

As far as I am aware 1.54.0 support is still work in progress.

@catap
Copy link
Contributor

catap commented Jan 31, 2022

@bjorn3 yes, but 1.54.0 is failed on something new at the first step of compiling which seems like a bug inside mrustc.

@thepowersgang
Copy link
Owner

1.54.0 is mostly working now, give it a try.

@catap
Copy link
Contributor

catap commented Feb 11, 2022

@thepowersgang I just tried a7eab91 as local root and it crashed as:

bin/minicargo rustc-1.54.0-src/library/std --vendor-dir rustc-1.54.0-src/vendor --script-overrides script-overrides/stable-1.54.0-macos/ --output-dir output-1.54.0/  --manifest-overrides rustc-1.54.0-overrides.toml
> /Users/catap/src/mrustc/bin/mrustc -Z print-cfgs
(0/13) BUILDING core v0.0.0
> /Users/catap/src/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output-1.54.0 --edition 2018
:0: BUG:src/mir/from_hir.cpp:524: TODO: visit - asm! const
Process was terminated with signal 6
FAILING COMMAND:  /Users/catap/src/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 -g --cfg debug_assertions -O -L output-1.54.0 --edition 2018
BUILD FAILED
make: *** [output-1.54.0/libstd.rlib] Error 1

with

catap@Kirills-mini-m1 mrustc % cat output-1.54.0/libcore.rlib_dbg.txt 
Setup: V V V
(0.00 s) Setup: DONE
Target Load: V V V
(0.00 s) Target Load: DONE
Parse: V V V
(0.62 s) Parse: DONE
LoadCrates: V V V
(0.00 s) LoadCrates: DONE
Expand: V V V
(0.55 s) Expand: DONE
Implicit Crates: V V V
(0.00 s) Implicit Crates: DONE
Resolve Use: V V V
(0.01 s) Resolve Use: DONE
Resolve Index: V V V
(0.02 s) Resolve Index: DONE
Resolve Absolute: V V V
(0.08 s) Resolve Absolute: DONE
HIR Lower: V V V
(0.16 s) HIR Lower: DONE
Resolve Type Aliases: V V V
(0.02 s) Resolve Type Aliases: DONE
Resolve Bind: V V V
(0.04 s) Resolve Bind: DONE
Resolve UFCS Outer: V V V
(0.02 s) Resolve UFCS Outer: DONE
Resolve HIR Self Type: V V V
(0.01 s) Resolve HIR Self Type: DONE
Resolve HIR Markings: V V V
(0.01 s) Resolve HIR Markings: DONE
Sort Impls: V V V
(0.00 s) Sort Impls: DONE
Resolve UFCS paths: V V V
(0.15 s) Resolve UFCS paths: DONE
Constant Evaluate: V V V
(0.79 s) Constant Evaluate: DONE
Typecheck Outer: V V V
(0.03 s) Typecheck Outer: DONE
Typecheck Expressions: V V V
(0.83 s) Typecheck Expressions: DONE
Expand HIR Annotate: V V V
(0.03 s) Expand HIR Annotate: DONE
Expand HIR Static Borrow: V V V
(0.04 s) Expand HIR Static Borrow: DONE
Expand HIR Closures: V V V
(0.09 s) Expand HIR Closures: DONE
Expand HIR VTables: V V V
(0.01 s) Expand HIR VTables: DONE
Expand HIR Calls: V V V
(0.02 s) Expand HIR Calls: DONE
Expand HIR Reborrows: V V V
(0.01 s) Expand HIR Reborrows: DONE
Expand HIR ErasedType: V V V
(0.02 s) Expand HIR ErasedType: DONE
Typecheck Expressions (validate): V V V
(0.20 s) Typecheck Expressions (validate): DONE
Lower MIR: V V V
catap@Kirills-mini-m1 mrustc % 

@thepowersgang
Copy link
Owner

@akirakyle You appear to be doing a guix build, is that working? (I might make a new issue for the macos issues)

@thepowersgang thepowersgang added the stale No response received after potential fixes. label Jun 25, 2022
@pan93412
Copy link

pan93412 commented Jun 27, 2022

@akirakyle You appear to be doing a guix build, is that working? (I might make a new issue for the macos issues)

I received the same error when trying to run build-1.54.0.sh:

$ bash build-1.54.0.sh
make: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f minicargo.mk RUSTCSRC
make[1]: Nothing to be done for `RUSTCSRC'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile all
make[1]: Nothing to be done for `all'.
test -e bin/mrustc
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools/minicargo/
make[1]: Nothing to be done for `all'.
test -e bin/minicargo
bin/minicargo rustc-1.54.0-src/library/std --vendor-dir rustc-1.54.0-src/vendor --script-overrides script-overrides/stable-1.54.0-macos/ --output-dir output-1.54.0/  --manifest-overrides rustc-1.54.0-overrides.toml
> /Users/pan93412/Projects/mrustc/bin/mrustc -Z print-cfgs
(0/13) BUILDING core v0.0.0
> /Users/pan93412/Projects/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 --cfg debug_assertions -O -L output-1.54.0 --edition 2018
:0: BUG:src/mir/from_hir.cpp:524: TODO: visit - asm! const
Process was terminated with signal 6
FAILING COMMAND:  /Users/pan93412/Projects/mrustc/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib --crate-name core --crate-type rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --crate-tag 0_0_0 --cfg debug_assertions -O -L output-1.54.0 --edition 2018
BUILD FAILED
make: *** [output-1.54.0/libstd.rlib] Error 1

I was not doing any special kind of build.

@thepowersgang
Copy link
Owner

@pan93412 That's 1.54, probably needs its own issue (that's just a TODO)

@catap
Copy link
Contributor

catap commented Jul 16, 2022

@thepowersgang I've just tested 2c4f89f on aarch64 and the issue still here on 1.54.0.

Shall I create a new issue for 1.54.0?

@thepowersgang
Copy link
Owner

Yes, this issue is about 1.39 only

@Apteryks
Copy link

Apteryks commented Oct 4, 2023

@thepowersgang I've just tested 2c4f89f on aarch64 and the issue still here on 1.54.0.

Shall I create a new issue for 1.54.0?

It appears to work for 1.54.0, which is what Guix does to successfully bootstrap rust on aarch64-linux:

$ LANG=C guix weather -s aarch64-linux rust
computing 1 package derivations for aarch64-linux...
looking for 3 store items on https://ci.guix.gnu.org...
https://ci.guix.gnu.org 
  100.0% substitutes available (3 out of 3)
  at least 102.0 MiB of nars (compressed)
  213.3 MiB on disk (uncompressed)

  at least 1000 queued builds
      armhf-linux: 552 (55.2%)
      aarch64-linux: 436 (43.6%)
      powerpc64le-linux: 2 (.2%)
      x86_64-linux: 10 (1.0%)
  build rate: 166.81 builds per hour
      x86_64-linux: 111.59 builds per hour
      aarch64-linux: 9.20 builds per hour
      i686-linux: 25.16 builds per hour
      powerpc64le-linux: 27.98 builds per hour
looking for 3 store items on https://bordeaux.guix.gnu.org...
https://bordeaux.guix.gnu.org 
  100.0% substitutes available (3 out of 3)
  at least 101.5 MiB of nars (compressed)
  213.3 MiB on disk (uncompressed)
  (continuous integration information unavailable)

If it doesn't work for you, you may want to review how it's done in Guix in the (gnu packages rust) module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale No response received after potential fixes.
Projects
None yet
Development

No branches or pull requests

6 participants