Opened 2 years ago

Last modified 13 months ago

#65942 assigned defect

mrustc with GCC for PowerPC

Reported by: barracuda156 Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: powerpc Cc:
Port: mrustc

Description

So unlike on Rosetta, where mrustc fell early, natively it builds to this stage:

test -e bin/mrustc
/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
> /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/mrustc-11a9c01119988e30ba40bab4ee5f60753c0c4b61/bin/mrustc -Z print-cfgs
(0/13) BUILDING core v0.0.0
> /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/mrustc-11a9c01119988e30ba40bab4ee5f60753c0c4b61/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
rustc-1.54.0-src/library/core/src/../../stdarch/crates/core_arch/src/x86/avx2.rs:520: error:0:Type mismatch between [u32; 8] and [u32; 576460752303423488] - sizes differ
rustc-1.54.0-src/library/core/src/../../stdarch/crates/core_arch/src/x86/avx2.rs:520: note: From here
Process was terminated with signal 6
FAILING COMMAND:  /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/mrustc-11a9c01119988e30ba40bab4ee5f60753c0c4b61/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
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/mrustc-11a9c01119988e30ba40bab4ee5f60753c0c4b61" && /usr/bin/make -j2 -w -f minicargo.mk -j2 bin/mrustc bin/minicargo && /usr/bin/make -j2 -C tools/dump_hirfile && /usr/bin/make -j2 -C tools/standalone_miri && /usr/bin/make -j1 -f minicargo.mk LIBS 
Exit code: 2

It looks like it then tries to use some x86-specific files, which fails.

Change History (7)

comment:1 Changed 2 years ago by catap (Kirill A. Korinsky)

Seems that you're using some old and unmerged version of Portfile.

mrust contains a few places where x86_64 is hardcoded inside codebase, I've adjusted as part of this PR which is blocked by upstream https://github.com/macports/macports-ports/pull/16284 .

To be honest I haven't tried to build it on i386, it probably fails. So, I suggest to wait with support of ppc until i386 is here.

comment:2 Changed 2 years ago by barracuda156

I will try that, thank you. Basically I opened the ticket to track the matter. Not that I expect an immediate resolution :)

Tried this update: https://github.com/macports/macports-ports/pull/16284 Identical failure on the same spot.

Last edited 2 years ago by barracuda156 (previous) (diff)

comment:3 Changed 20 months ago by barracuda156

comment:4 Changed 20 months ago by barracuda156

Quick updates:

  1. mrustc builds as a ppc binary, but with totally wrong target settings: that explains why rust was picking x86.
    /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b/bin/mrustc -Z print-cfgs
    sergey-fedorovs-power-mac-g5:~ svacchanda$ /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b/bin/mrustc -Z print-cfgs
    Setup: V V V
    (0.00 s) Setup: DONE
    Target Load: V V V
    (0.00 s) Target Load: DONE
    >rust_compiler=mrustc
    >target_arch=x86_64
    >target_endian=little
    >target_env=gnu
    >target_family=unix
    >target_has_atomic=8
    >target_has_atomic=16
    >target_has_atomic=32
    >target_has_atomic=64
    >target_has_atomic=ptr
    >target_has_atomic=cas
    >target_has_atomic_equal_alignment=8
    >target_has_atomic_equal_alignment=16
    >target_has_atomic_equal_alignment=32
    >target_has_atomic_equal_alignment=64
    >target_has_atomic_equal_alignment=ptr
    >target_has_atomic_load_store=8
    >target_has_atomic_load_store=16
    >target_has_atomic_load_store=32
    >target_has_atomic_load_store=64
    >target_has_atomic_load_store=ptr
    >target_os=macos
    >target_pointer_width=64
    >target_vendor=apple
    >target_vendor=
    >apple
    >unix
    
  1. Latest update to mrustc has broken some patch:
    make[1]: Nothing to be done for `all'.
    test -e bin/minicargo
    tar -xf rustc-1.54.0-src.tar.gz
    cd rustc-1.54.0-src/ && patch -p0 < ../rustc-1.54.0-src.patch;
    /bin/sh: ../rustc-1.54.0-src.patch: No such file or directory
    make: *** [rustc-1.54.0-src//dl-version] Error 1
    Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b" && /usr/bin/make -j2 -w -f minicargo.mk -j2 bin/mrustc bin/minicargo && /usr/bin/make -j2 -C tools/dump_hirfile && /usr/bin/make -j2 -C tools/standalone_miri && /usr/bin/make -j1 -f minicargo.mk LIBS 
    Exit code: 2
    

comment:5 in reply to:  1 Changed 20 months ago by barracuda156

Replying to catap:

Seems that you're using some old and unmerged version of Portfile.

mrust contains a few places where x86_64 is hardcoded inside codebase, I've adjusted as part of this PR which is blocked by upstream https://github.com/macports/macports-ports/pull/16284 .

To be honest I haven't tried to build it on i386, it probably fails. So, I suggest to wait with support of ppc until i386 is here.

  1. Patch path is broken atm. Build looks for it in ${workpath}, but it is in mrustc source folder. Manually moving the patch fixes that.
  1. Targets for ppc are here: https://github.com/thepowersgang/mrustc/pull/302
  1. Settings are wrong in rustc-1.54.0-src/library/stdarch/crates/core_arch/src/mod.rs and rustc-1.54.0-src/library/stdarch/crates/core_arch/src/powerpc/mod.rs. VSX should be used conditionally. Altivec code seems semi-broken, there are numerous warnings of this sort:
    Macro:vector_mladd:0: warn:0:Unexpected attribute target_feature on associated item
    Macro:vector_perm:0: warn:0:Unexpected attribute target_feature on associated item
    

Both are to be disabled, I guess, for now.

  1. After all that, build fails on this:
    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
    > /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b/bin/mrustc -Z print-cfgs
    (0/13) BUILDING core v0.0.0
    > /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b/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
    MIR TODO: ::"core-0_0_0"::core_arch::macros::#0::FRAGMENTS BB0/0: Handle big endian in constant evaluate
    Process was terminated with signal 6
    FAILING COMMAND:  /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b/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
    Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-1b1416b" && /usr/bin/make -j2 -w -f minicargo.mk -j2 bin/mrustc bin/minicargo && /usr/bin/make -j2 -C tools/dump_hirfile && /usr/bin/make -j2 -C tools/standalone_miri && /usr/bin/make -j1 -f minicargo.mk LIBS 
    Exit code: 2
    

comment:6 Changed 13 months ago by barracuda156

Building from master (setting powerpc as the Rust arch and adding a patch to disable unsupported VSX), I got here:

[CXX] -o ../../bin/standalone_miri
/usr/bin/make -f Makefile all
make[1]: Nothing to be done for `all'.
test -e bin/mrustc
/usr/bin/make -C tools/minicargo/
make[1]: Nothing to be done for `all'.
test -e bin/minicargo
bin/minicargo --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 rustc-1.54.0-src/mrustc-stdlib/
--- BUILDING core v0.0.0 (0.0% 1r,0w,19b/20t)
> /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-38c9db2/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --cfg debug_assertions -O -L output-1.54.0 --crate-name core --crate-type rlib --crate-tag 0_0_0 --edition 2018 > output-1.54.0/libcore.rlib_dbg.txt
 (0.0% 1r,0w,19b/20t): core v0.0.0
:0:0 BUG:ASSERT FAIL: src/hir/hir_ops.cpp:1296:ep.m_mir: No HIR (!ep) and no MIR (!ep.m_mir) for ::"core-0_0_0"::panicking::#0::panic_impl<'#local3,>
Process was terminated with signal 6
FAILING COMMAND: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-38c9db2/bin/mrustc rustc-1.54.0-src/library/core/src/lib.rs -o output-1.54.0/libcore.rlib -C emit-depfile=output-1.54.0/libcore.rlib.d --cfg debug_assertions -O -L output-1.54.0 --crate-name core --crate-type rlib --crate-tag 0_0_0 --edition 2018
Env:  OUT_DIR=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-38c9db2/output-1.54.0/build_core CARGO_MANIFEST_DIR=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_lang_mrustc/mrustc/work/thepowersgang-mrustc-38c9db2/rustc-1.54.0-src/library/core CARGO_PKG_NAME=core CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0
 (5.0% 0r,0w,19b/20t):
BUILD FAILED
make: *** [LIBS] Error 1

comment:7 Changed 13 months ago by barracuda156

Version: 2.7.22.8.1
Note: See TracTickets for help on using tickets.