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

Build Fails on x32, pointer size mismatch #334

Open
gmatht opened this issue Sep 19, 2024 · 1 comment
Open

Build Fails on x32, pointer size mismatch #334

gmatht opened this issue Sep 19, 2024 · 1 comment

Comments

@gmatht
Copy link

gmatht commented Sep 19, 2024

I keep getting Type mismatch between [(); 16] and [(); 8] - sizes differ errors.

I have tried adding to build-1.54.0.sh :

export RUSTC_TARGET=x86_64-unknown-linux-gnux32
export TARGET=x86_64-unknown-linux-gnux32

And replacing RUSTC_TARGET ?= x86_64-unknown-linux-gnu with

  ifeq ($(shell g++ -v 2>&1 | grep Target),x86_64-pc-linux-gnux32)
    RUSTC_TARGET ?= x86_64-pc-linux-gnux32
  else
    RUSTC_TARGET ?= x86_64-unknown-linux-gnu
  endif

in minicargo.mk.

The first command to fail was:

...mrustc/bin/mrustc rustc-1.54.0-src/compiler/rustc_parse/src/lib.rs -o output-1.54.0/rustc-build/librustc_parse.rlib -C emit-depfile=output-1.54.0/rustc-build/librustc_parse.rlib.d --cfg debug_assertions -O -L output-1.54.0 -L output-1.54.0/rustc-build --crate-name rustc_parse --crate-type rlib --crate-tag 0_0_0 --edition 2018 --extern bitflags=output-1.54.0/rustc-build/libbitflags-1_2_1.rlib --extern tracing=output-1.54.0/rustc-build/libtracing-0_1_26_H30002.rlib --extern rustc_ast_pretty=output-1.54.0/rustc-build/librustc_ast_pretty.rlib --extern rustc_data_structures=output-1.54.0/rustc-build/librustc_data_structures.rlib --extern rustc_feature=output-1.54.0/rustc-build/librustc_feature.rlib --extern rustc_lexer=output-1.54.0/rustc-build/librustc_lexer-0_1_0.rlib --extern rustc_errors=output-1.54.0/rustc-build/librustc_errors.rlib --extern rustc_session=output-1.54.0/rustc-build/librustc_session.rlib --extern rustc_span=output-1.54.0/rustc-build/librustc_span.rlib --extern rustc_ast=output-1.54.0/rustc-build/librustc_ast.rlib --extern unicode_normalization=output-1.54.0/rustc-build/libunicode_normalization-0_1_18_H1.rlib --extern smallvec=output-1.54.0/rustc-build/libsmallvec-1_6_1_H12.rlib > output-1.54.0/rustc-build/librustc_parse.rlib_dbg.txt
 (0.0% 2r,0w,25b/27t): rustc_middle v0.0.0, rustc_parse v0.0.0
Macro:{16}rustc_data_structures::static_assert_size/*?*/:0:27 error:0:Type mismatch between [(); 16] and [(); 8] - sizes differ
rustc-1.54.0-src/compiler/rustc_parse/src/parser/attr_wrapper.rs:38: note: From here
Process was terminated with signal 6

Some diagnostic commands:

$ 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=linux
>target_pointer_width=32
>target_vendor=gnu
>target_vendor=
>linux
>unix
$ uname -a
Linux AlienR10 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 AMD Ryzen 7 5800 8-Core Processor AuthenticAMD GNU/Linux
$ lsb_release -a
LSB Version:    n/a
Distributor ID: Gentoo
Description:    Gentoo Linux
Release:        2.15
Codename:       n/a
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnux32/13/lto-wrapper
Target: x86_64-pc-linux-gnux32
Configured with: /var/tmp/portage/sys-devel/gcc-13.3.1_p20240614/work/gcc-13-20240614/configure --host=x86_64-pc-linux-gnux32 --build=x86_64-pc-linux-gnux32 --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnux32/gcc-bin/13 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnux32/13/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnux32/13 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnux32/13/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnux32/13/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnux32/13/include/g++-v13 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnux32/13/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.3.1_p20240614 p17' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m64,m32,mx32 --disable-fixed-point --with-abi=mx32 --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-default-ssp --disable-fixincludes --with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.1 20240614 (Gentoo 13.3.1_p20240614 p17)
@thepowersgang
Copy link
Owner

Either mrustc doesn't know that x32 has 32-bit pointers, or the asserts in rustc are being included when they shouldn't (due to the mrustc x32 target still saying the arch is amd64)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants