rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.35k stars 12.72k forks source link

Segmentation fault for simplest hello world with Guix in PATH #113299

Closed ZelphirKaltstahl closed 1 year ago

ZelphirKaltstahl commented 1 year ago

I tried this code:

fn main() {
    println!("Hello, world!");
}

I expected to see this happen: cargo run should print Hello, world!.

Instead, this happened:

    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/hello_world`
Segmentation fault (core dumped)

Meta

rustc --version --verbose:

rustc 1.70.0 (90c541806 2023-05-31)
binary: rustc
commit-hash: 90c541806f23a127002de5b4038be731ba1458ca
commit-date: 2023-05-31
host: x86_64-unknown-linux-gnu
release: 1.70.0
LLVM version: 16.0.2

cargo --version:

cargo 1.70.0 (ec8a8a0ca 2023-04-25)

lsb_release -a

No LSB modules are available.
Distributor ID: Linuxmint
Description:    Linux Mint 20.1
Release:    20.1
Codename:   ulyssa

uname -a

Linux user-desktop 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

gcc --version

gcc (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Rust was installed via rustup, installed via curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh on 2023-07-03.

Backtrace

``` Finished dev [unoptimized + debuginfo] target(s) in 0.00s ```

What I already tried

$ RUSTFLAGS="-C relocation-model=dynamic-no-pic -C link-args=-no-pie" cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/hello_world`
Segmentation fault (core dumped)
tgross35 commented 1 year ago

Could you run with RUST_BACKTRACE=1 and post the result? (might not catch anything) And could you try running the binary directly (./target/debug/hello_world) to verify it's not a cargo issue?

ZelphirKaltstahl commented 1 year ago
$ RUST_BACKTRACE=1 cargo run
   Compiling hello_world v0.1.0 (/home/xiaolong/dev/rust/hello_world)
    Finished dev [unoptimized + debuginfo] target(s) in 0.32s
     Running `target/debug/hello_world`
Segmentation fault (core dumped)
$ RUST_BACKTRACE=1 ./target/debug/hello_world 
Segmentation fault (core dumped)
tgross35 commented 1 year ago

I can't reproduce with the same target, same GCC version, same rust + cargo versions. Time for super verbose mode to see what's going on, could you do:

cargo clean
RUSTFLAGS="-C link-arg=-Wl,--verbose" RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo build -vv
ZelphirKaltstahl commented 1 year ago
verbose output ``` $ RUSTFLAGS="-C link-arg=-Wl,--verbose" RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo build -vv Compiling hello_world v0.1.0 (/home/user/dev/rust/hello_world) Running `CARGO=/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_BIN_NAME=hello_world CARGO_CRATE_NAME=hello_world CARGO_MANIFEST_DIR=/home/user/dev/rust/hello_world CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hello_world CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/home/user/dev/rust/hello_world/target/debug/deps:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' rustc --crate-name hello_world --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=272 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e22d40e86553def7 -C extra-filename=-e22d40e86553def7 --out-dir /home/user/dev/rust/hello_world/target/debug/deps -C incremental=/home/user/dev/rust/hello_world/target/debug/incremental -L dependency=/home/user/dev/rust/hello_world/target/debug/deps -C link-arg=-Wl,--verbose` INFO rustc_codegen_ssa::back::link preparing Executable to "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7" INFO rustc_codegen_ssa::back::link LC_ALL="C" PATH="/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/.cargo/bin:/home/hans/.config/guix/current/bin:/home/user/.config/guix/current/bin:/home/user/.config/guix/current/sbin:/home/user/.config/guix/current/bin:/home/user/.local/bin:/home/user/.guix-profile/bin:/home/user/.guix-profile/sbin:/home/user/.config/guix/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/.local/bin:/usr/lib/jvm/java-17-openjdk-amd64/bin:/usr/local/texlive/2022/bin/x86_64-linux" VSLANG="1033" "cc" "-m64" "/tmp/rustcX2BMCh/symbols.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.1jus6o66igae3ze0.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tso0xryp4hk7njb.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.30mjrv4l6r2a11zg.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3f3n7fk5va7dfy43.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3xvbrrewyhi5p5s1.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.4xr9u3m81u6vkx31.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tzygb3k5ougc0jz.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/dev/rust/hello_world/target/debug/deps" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cbcb223c64b13cf3.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b40bc72e060a8196.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-076a893ead7e7ab5.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2e924dd85b2e9d95.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7975ffb5e62386c4.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-914eb40be05d8663.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-Wl,--verbose" INFO rustc_codegen_ssa::back::link linker stderr: INFO rustc_codegen_ssa::back::link linker stdout: GNU ld (GNU Binutils) 2.38 Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om using internal linker script: ================================================== /* Script for -pie -z combreloc -z separate-code -z relro -z now */ /* Copyright (C) 2014-2022 Free Software Foundation, Inc. Copying and distribution of this script, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. */ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_ARCH(i386:x86-64) ENTRY(_start) SEARCH_DIR("/gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38/x86_64-unknown-linux-gnu/lib64"); SEARCH_DIR("/no-ld-lib-path"); SEARCH_DIR("/gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38/x86_64-unknown-linux-gnu/lib"); SECTIONS { PROVIDE (__executable_start = SEGMENT_START("text-segment", 0)); . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS; .interp : { *(.interp) } .note.gnu.build-id : { *(.note.gnu.build-id) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } .rela.dyn : { *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) *(.rela.fini) *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) *(.rela.ctors) *(.rela.dtors) *(.rela.got) *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) *(.rela.ifunc) } .rela.plt : { *(.rela.plt) *(.rela.iplt) } .relr.dyn : { *(.relr.dyn) } . = ALIGN(CONSTANT (MAXPAGESIZE)); .init : { KEEP (*(SORT_NONE(.init))) } .plt : { *(.plt) *(.iplt) } .plt.got : { *(.plt.got) } .plt.sec : { *(.plt.sec) } .text : { *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) *(.text.startup .text.startup.*) *(.text.hot .text.hot.*) *(SORT(.text.sorted.*)) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf.em. */ *(.gnu.warning) } .fini : { KEEP (*(SORT_NONE(.fini))) } PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); . = ALIGN(CONSTANT (MAXPAGESIZE)); /* Adjust the address for the rodata segment. We want to adjust up to the same address within the page on the next page up. */ . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1))); .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } .rodata1 : { *(.rodata1) } .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) } .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) } /* These sections are generated by the Sun/Oracle C++ compiler. */ .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE)); /* Exception handling */ .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) } .gnu_extab : ONLY_IF_RW { *(.gnu_extab) } .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) } /* Thread Local Storage sections */ .tdata : { PROVIDE_HIDDEN (__tdata_start = .); *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); } .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors)) PROVIDE_HIDDEN (__init_array_end = .); } .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors)) PROVIDE_HIDDEN (__fini_array_end = .); } .ctors : { /* gcc uses crtbegin.o to find the start of the constructors, so we make sure it is first. Because this is a wildcard, it doesn't matter if the user does not actually link against crtbegin.o; the linker won't look for a file to match a wildcard. The wildcard also means that it doesn't matter which directory crtbegin.o is in. */ KEEP (*crtbegin.o(.ctors)) KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) } .dtors : { KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) } .jcr : { KEEP (*(.jcr)) } .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } .dynamic : { *(.dynamic) } .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) } . = DATA_SEGMENT_RELRO_END (0, .); .data : { *(.data .data.* .gnu.linkonce.d.*) SORT(CONSTRUCTORS) } .data1 : { *(.data1) } _edata = .; PROVIDE (edata = .); . = .; __bss_start = .; .bss : { *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. FIXME: Why do we need it? When there is no .bss section, we do not pad the .data section. */ . = ALIGN(. != 0 ? 64 / 8 : 1); } .lbss : { *(.dynlbss) *(.lbss .lbss.* .gnu.linkonce.lb.*) *(LARGE_COMMON) } . = ALIGN(64 / 8); . = SEGMENT_START("ldata-segment", .); .lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : { *(.lrodata .lrodata.* .gnu.linkonce.lr.*) } .ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) : { *(.ldata .ldata.* .gnu.linkonce.l.*) . = ALIGN(. != 0 ? 64 / 8 : 1); } . = ALIGN(64 / 8); _end = .; PROVIDE (end = .); . = DATA_SEGMENT_END (.); /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ /* DWARF 1. */ .debug 0 : { *(.debug) } .line 0 : { *(.line) } /* GNU DWARF 1 extensions. */ .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } /* DWARF 1.1 and DWARF 2. */ .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2. */ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions. */ .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) } /* DWARF 3. */ .debug_pubtypes 0 : { *(.debug_pubtypes) } .debug_ranges 0 : { *(.debug_ranges) } /* DWARF 5. */ .debug_addr 0 : { *(.debug_addr) } .debug_line_str 0 : { *(.debug_line_str) } .debug_loclists 0 : { *(.debug_loclists) } .debug_macro 0 : { *(.debug_macro) } .debug_names 0 : { *(.debug_names) } .debug_rnglists 0 : { *(.debug_rnglists) } .debug_str_offsets 0 : { *(.debug_str_offsets) } .debug_sup 0 : { *(.debug_sup) } .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } } ================================================== ld: mode elf_x86_64 attempt to open /home/user/.guix-profile/lib/../lib/Scrt1.o succeeded /home/user/.guix-profile/lib/../lib/Scrt1.o attempt to open /home/user/.guix-profile/lib/../lib/crti.o succeeded /home/user/.guix-profile/lib/../lib/crti.o attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o succeeded /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o attempt to open /tmp/rustcX2BMCh/symbols.o succeeded /tmp/rustcX2BMCh/symbols.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.1jus6o66igae3ze0.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.1jus6o66igae3ze0.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tso0xryp4hk7njb.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tso0xryp4hk7njb.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.30mjrv4l6r2a11zg.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.30mjrv4l6r2a11zg.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3f3n7fk5va7dfy43.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3f3n7fk5va7dfy43.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3xvbrrewyhi5p5s1.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3xvbrrewyhi5p5s1.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.4xr9u3m81u6vkx31.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.4xr9u3m81u6vkx31.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tzygb3k5ougc0jz.rcgu.o succeeded /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tzygb3k5ougc0jz.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib)std-8389830094602f5a.std.fd8b77e9-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib)panic_unwind-41c1085b8c701d6f.panic_unwind.e0200a46-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib)object-f733fcc57ce38b99.object.db916a9c-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib)memchr-6495ec9d4ce4f37d.memchr.0918167b-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib)addr2line-1e3796360cca5b49.addr2line.1cd01052-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib)gimli-2e7f329b154436e1.gimli.87eb523c-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib)rustc_demangle-1e1f5b8a84008aa8.rustc_demangle.51de0080-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cbcb223c64b13cf3.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cbcb223c64b13cf3.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b40bc72e060a8196.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b40bc72e060a8196.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib)miniz_oxide-1eb33ae9877d3c0f.miniz_oxide.81c2a2bc-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib)adler-0335d894dd05bed7.adler.f906168c-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-076a893ead7e7ab5.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-076a893ead7e7ab5.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2e924dd85b2e9d95.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2e924dd85b2e9d95.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7975ffb5e62386c4.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7975ffb5e62386c4.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib)libc-285425b7cea12024.libc.7aa3cf7a-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib)alloc-38694d775e998991.alloc.02dbbf86-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-914eb40be05d8663.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-914eb40be05d8663.rlib attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib)core-27094fcca7e14863.core.87f140f9-cgu.0.rcgu.o attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib succeeded /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib (/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib)compiler_builtins-919e055b306699ae.compiler_builtins.957a770a-cgu.62.rcgu.o attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libgcc_s.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libgcc_s.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.a failed attempt to open /home/user/.guix-profile/lib/../lib/libgcc_s.so failed attempt to open /home/user/.guix-profile/lib/../lib/libgcc_s.a failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so succeeded opened script file /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so opened script file /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so.1 failed attempt to open libgcc_s.so.1 failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libgcc_s.so.1 failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.so.1 failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc_s.so.1 failed attempt to open /home/user/.guix-profile/lib/../lib/libgcc_s.so.1 failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so.1 failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgcc_s.so.1 failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/libgcc_s.so.1 failed attempt to open /lib/x86_64-linux-gnu/libgcc_s.so.1 succeeded /lib/x86_64-linux-gnu/libgcc_s.so.1 attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libgcc.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libgcc.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgcc.a failed attempt to open /home/user/.guix-profile/lib/../lib/libgcc.so failed attempt to open /home/user/.guix-profile/lib/../lib/libgcc.a failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.so failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a succeeded /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libutil.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libutil.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libutil.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libutil.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libutil.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libutil.a failed attempt to open /home/user/.guix-profile/lib/../lib/libutil.so failed attempt to open /home/user/.guix-profile/lib/../lib/libutil.a succeeded /home/user/.guix-profile/lib/../lib/libutil.a attempt to open /home/user/dev/rust/hello_world/target/debug/deps/librt.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/librt.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librt.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librt.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librt.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librt.a failed attempt to open /home/user/.guix-profile/lib/../lib/librt.so failed attempt to open /home/user/.guix-profile/lib/../lib/librt.a failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/librt.so failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/librt.a failed attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/librt.so succeeded /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/librt.so attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libpthread.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libpthread.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpthread.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpthread.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpthread.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpthread.a failed attempt to open /home/user/.guix-profile/lib/../lib/libpthread.so failed attempt to open /home/user/.guix-profile/lib/../lib/libpthread.a succeeded /home/user/.guix-profile/lib/../lib/libpthread.a attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libm.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libm.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libm.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libm.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libm.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libm.a failed attempt to open /home/user/.guix-profile/lib/../lib/libm.so succeeded opened script file /home/user/.guix-profile/lib/../lib/libm.so /home/user/.guix-profile/lib/../lib/libm.so opened script file /home/user/.guix-profile/lib/../lib/libm.so attempt to open /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libm.so.6 succeeded /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libm.so.6 attempt to open /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libmvec.so.1 succeeded /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libmvec.so.1 attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libdl.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libdl.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libdl.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libdl.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libdl.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libdl.a failed attempt to open /home/user/.guix-profile/lib/../lib/libdl.so failed attempt to open /home/user/.guix-profile/lib/../lib/libdl.a succeeded /home/user/.guix-profile/lib/../lib/libdl.a attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libc.so failed attempt to open /home/user/dev/rust/hello_world/target/debug/deps/libc.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libc.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libc.a failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libc.so failed attempt to open /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libc.a failed attempt to open /home/user/.guix-profile/lib/../lib/libc.so succeeded opened script file /home/user/.guix-profile/lib/../lib/libc.so /home/user/.guix-profile/lib/../lib/libc.so opened script file /home/user/.guix-profile/lib/../lib/libc.so attempt to open /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6 succeeded /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6 attempt to open /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc_nonshared.a succeeded /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc_nonshared.a attempt to open /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/ld-linux-x86-64.so.2 succeeded /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/ld-linux-x86-64.so.2 /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc_nonshared.a attempt to open /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o succeeded /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o attempt to open /home/user/.guix-profile/lib/../lib/crtn.o succeeded /home/user/.guix-profile/lib/../lib/crtn.o Finished dev [unoptimized + debuginfo] target(s) in 0.33s ```
Noratrieb commented 1 year ago

Can you try running the program in gdb and look at the backtrace of the segfault? gdb target/debug/hello_world, then r, then bt

jyn514 commented 1 year ago

Can you confirm that cc -m64 on a hello world C program creates a program that compiles and runs successfully? Ideally with the same env variables set (they are visible in the 4th line of the output you posted, the line starting with LC_ALL=C).

tgross35 commented 1 year ago

Few extra things to try chasing this down if you have the time:

apiraino commented 1 year ago

@ZelphirKaltstahl how did you install Rust, are you emulating a classical filesystem with --emulate-fhs or something similar? I'm not sure of how the Rust toolchain work under Guix.

ZelphirKaltstahl commented 1 year ago

I will try to answer all in sequence.

Can you try running the program in gdb and look at the backtrace of the segfault? gdb target/debug/hello_world, then r, then bt

It might be, that the gdb backtrace is too long for pasting here (3.4MB) so I will try to upload as file instead … Nope, cannot do that either, Github says: "Something went really wrong, and we can't process that file. Try again." Not sure what to do now. Do you have any suggestions, where I could upload it? I could still make it a mega.nz link. If that is not good for you, please suggest an alternative, that does not require making an account. Here is the link.

Can you confirm that cc -m64 on a hello world C program creates a program that compiles and runs successfully? Ideally with the same env variables set (they are visible in the 4th line of the output you posted, the line starting with LC_ALL=C).

I am using the following code as a hello world program in C, found on some website:

#include <stdio.h>

int main()
{
    printf("Hello World");
    return 0;
}

When I use cc -m64 on it, it compiles to some a.out file. When I run that using ./a.out, I get a Segmentation fault (core dumped) again. But I am not sure, which environment variables you mean. Which of the following lines?

$ RUSTFLAGS="-C link-arg=-Wl,--verbose" RUSTC_LOG=rustc_codegen_ssa::back::link=info cargo build -vv
   Compiling hello_world v0.1.0 (/home/user/dev/rust/hello_world)
     Running `CARGO=/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_BIN_NAME=hello_world CARGO_CRATE_NAME=hello_world CARGO_MANIFEST_DIR=/home/user/dev/rust/hello_world CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=hello_world CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/home/user/dev/rust/hello_world/target/debug/deps:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' rustc --crate-name hello_world --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=272 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=e22d40e86553def7 -C extra-filename=-e22d40e86553def7 --out-dir /home/user/dev/rust/hello_world/target/debug/deps -C incremental=/home/user/dev/rust/hello_world/target/debug/incremental -L dependency=/home/user/dev/rust/hello_world/target/debug/deps -C link-arg=-Wl,--verbose`
INFO rustc_codegen_ssa::back::link preparing Executable to "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7"
INFO rustc_codegen_ssa::back::link LC_ALL="C" PATH="/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/.cargo/bin:/home/hans/.config/guix/current/bin:/home/user/.config/guix/current/bin:/home/user/.config/guix/current/sbin:/home/user/.config/guix/current/bin:/home/user/.local/bin:/home/user/.guix-profile/bin:/home/user/.guix-profile/sbin:/home/user/.config/guix/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/.local/bin:/usr/lib/jvm/java-17-openjdk-amd64/bin:/usr/local/texlive/2022/bin/x86_64-linux" VSLANG="1033" "cc" "-m64" "/tmp/rustcX2BMCh/symbols.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.1jus6o66igae3ze0.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tso0xryp4hk7njb.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.30mjrv4l6r2a11zg.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3f3n7fk5va7dfy43.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3xvbrrewyhi5p5s1.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.4xr9u3m81u6vkx31.rcgu.o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tzygb3k5ougc0jz.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/dev/rust/hello_world/target/debug/deps" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cbcb223c64b13cf3.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b40bc72e060a8196.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-076a893ead7e7ab5.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2e924dd85b2e9d95.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7975ffb5e62386c4.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-914eb40be05d8663.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-Wl,--verbose"
INFO rustc_codegen_ssa::back::link linker stderr:

If I take the 5th line, then I see, that there are variables: LC_ALL, PATH and VSLANG, but after VSLANG there is loads of other stuff and I am not sure how to treat that. Should I leave it away when writing my call to cc -m64?

Trying that:

LC_ALL="C" PATH="/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/.cargo/bin:/home/hans/.config/guix/current/bin:/home/user/.config/guix/current/bin:/home/user/.config/guix/current/sbin:/home/user/.config/guix/current/bin:/home/user/.local/bin:/home/user/.guix-profile/bin:/home/user/.guix-profile/sbin:/home/user/.config/guix/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/.local/bin:/usr/lib/jvm/java-17-openjdk-amd64/bin:/usr/local/texlive/2022/bin/x86_64-linux" VSLANG="1033" cc -m64 hello_world.c

Runs, compiles a a.out.

./a.out
Segmentation fault (core dumped)

(edited: still had my user name wrong in the variables, now replaced with the output of the variables with correct user name)

(more in separate post)

ZelphirKaltstahl commented 1 year ago

Few extra things to try chasing this down if you have the time:

* Post the binary here, maybe there are some hints in the dump as to what happened

Trying to upload the binary here on Github … "We don't support that file type." I will upload to mega again. (Or please suggest an alternative.) Here is the link.

* Is there anything unique about your hardware or setup that you can think of? (all looks pretty standard)

Not that I know of. This is a "tower" pc, not a mobile laptop. Something you put under your desk, not on your lap.

* Try an old version (`rustup install 1.56 && cargo +1.56 run`) to see if this was a regression that was introduced at some point. If this works and you have time, you could try some more versions and bisect where the regression is
rustup install 1.56 && cargo +1.56 run
info: syncing channel updates for '1.56-x86_64-unknown-linux-gnu'
info: latest update on 2021-11-01, rust version 1.56.1 (59eed8a2a 2021-11-01)
info: downloading component 'cargo'
  6.2 MiB /   6.2 MiB (100 %)   2.6 MiB/s in  2s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'rust-docs'
 17.3 MiB /  17.3 MiB (100 %)   2.6 MiB/s in  2s ETA:  0s
info: downloading component 'rust-std'
 23.5 MiB /  23.5 MiB (100 %)   2.6 MiB/s in  2s ETA:  0s
info: downloading component 'rustc'
 52.9 MiB /  52.9 MiB (100 %)  16.3 MiB/s in  4s ETA:  0s
info: downloading component 'rustfmt'
  3.9 MiB /   3.9 MiB (100 %)   2.6 MiB/s in  1s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 17.3 MiB /  17.3 MiB (100 %)   9.2 MiB/s in  1s ETA:  0s
info: installing component 'rust-std'
 23.5 MiB /  23.5 MiB (100 %)  17.6 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 52.9 MiB /  52.9 MiB (100 %)  20.0 MiB/s in  2s ETA:  0s
info: installing component 'rustfmt'

  1.56-x86_64-unknown-linux-gnu installed - rustc 1.56.1 (59eed8a2a 2021-11-01)

info: checking for self-update
   Compiling hello_world v0.1.0 (/home/user/dev/rust/hello_world)
    Finished dev [unoptimized + debuginfo] target(s) in 0.41s
     Running `target/debug/hello_world`
Segmentation fault (core dumped)
* Have you been able to compile anything at any point with Rust? Or do you know of any people with a similar setup that have run into this problem? (e.g. coworkers with the same computer & OS)

Lately I thought I would pick up Rust again and go through the Rust book again to get up to date knowledge. In the past I have used Rust, but perhaps not on this machine. Not sure whether it was already on this machine. Could also have been on another machine. Basically I merely wanted to learn again and am not sure, whether I was able to compile and run any Rust code on this machine before.

Similar setup: Not aware of any, since most of my friends are not devs and they all have other hardware.

This machine is a private machine, not my job/work machine, so no coworkers with the same hardware either.

ZelphirKaltstahl commented 1 year ago

@ZelphirKaltstahl how did you install Rust, are you emulating a classical filesystem with --emulate-fhs or something similar? I'm not sure of how the Rust toolchain work under Guix.

I am running all this on Linux Mint, no emulation I am aware of, no VM, no anything special I can see. However, I noticed, that in some of the output Rust looks inside Guix folders/directories. I am not running Guix OS. I merely have Guix as a package manager on my system ("Guix on foreign distro"), so directories of it are on the PATH. I guess Rust should not use anything from Guix, even if it "finds" any libraries there. Perhaps that is the actual problem. I did not install Rust via Guix, so it should not interact with Guix.

tgross35 commented 1 year ago

Thank you for going through the effort to collect this information, the details help a lot. It seems like maybe the problem is with cc since it does the same thing - could you share cc --version -v?

Fyi it seems like your mega link is broken fyi - the text itself is fine but it takes you to the github page on click. I have used https://paste.c-net.org/ before for sharing binaries but am not sure about its limits (mega is fine too)

Noratrieb commented 1 year ago

From the backtrace it looks like the dynamic linker is encountering infinite recursion and therefore stackoverflowing (wtf??). But given that the C program also segfaults, this looks like an issue on your system and not a problem with Rust. Looks like something about your Guix installation is wrong. Maybe a Guix support forum/mailing list or whatever they use can help you.

Cyanoxygen commented 1 year ago

Here's my theory:

From your verbose linker output and your bug report, you are using Linux Mint, but the linker being used comes from Guix you have installed on your distro.

The Guix ld is trying to link your hello_world with host (Linux Mint) runtimes, along with glibc from Guix. It tried hard to link libraries from everywhere, thus creating hello_world with parts from two different worlds (sort of). Here is the list of object files chosen by Guix ld, grep'd from your verbose linker output:

Chosen object files ``` /home/user/.guix-profile/lib/../lib/Scrt1.o /home/user/.guix-profile/lib/../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o /tmp/rustcX2BMCh/symbols.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.1jus6o66igae3ze0.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tso0xryp4hk7njb.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.30mjrv4l6r2a11zg.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3f3n7fk5va7dfy43.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.3xvbrrewyhi5p5s1.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.4xr9u3m81u6vkx31.rcgu.o /home/user/dev/rust/hello_world/target/debug/deps/hello_world-e22d40e86553def7.2tzygb3k5ougc0jz.rcgu.o /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8389830094602f5a.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-41c1085b8c701d6f.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-f733fcc57ce38b99.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-6495ec9d4ce4f37d.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1e3796360cca5b49.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2e7f329b154436e1.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-1e1f5b8a84008aa8.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-cbcb223c64b13cf3.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b40bc72e060a8196.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1eb33ae9877d3c0f.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-0335d894dd05bed7.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-076a893ead7e7ab5.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-2e924dd85b2e9d95.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7975ffb5e62386c4.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-285425b7cea12024.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-38694d775e998991.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-914eb40be05d8663.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-27094fcca7e14863.rlib /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-919e055b306699ae.rlib /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a /home/user/.guix-profile/lib/../lib/libutil.a /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/librt.so /home/user/.guix-profile/lib/../lib/libpthread.a /home/user/.guix-profile/lib/../lib/libm.so /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libm.so.6 /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libmvec.so.1 /home/user/.guix-profile/lib/../lib/libdl.a /home/user/.guix-profile/lib/../lib/libc.so /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc.so.6 /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc_nonshared.a /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/ld-linux-x86-64.so.2 /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib/libc_nonshared.a /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /home/user/.guix-profile/lib/../lib/crtn.o ```

I think the solution is just to gain access to a clean environment (e.g. to use the environment from Linux Mint instead of guix shell), and use host (Linux Mint) tools to compile programs.

jyn514 commented 1 year ago

i am going to close this since it happens for C code too but feel free to keep discussing on the issue.

ZelphirKaltstahl commented 1 year ago

(Will try to respond to everything later.)

ZelphirKaltstahl commented 1 year ago

Thank you for going through the effort to collect this information, the details help a lot. It seems like maybe the problem is with cc since it does the same thing - could you share cc --version -v?

$ cc --version -v
Using built-in specs.
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu help-dummy -quiet -dumpbase help-dummy -mtune=generic -march=x86-64 -auxbase help-dummy -version --version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccgrR1JA.s
GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.1) version 9.4.0 (x86_64-linux-gnu)
    compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 as -v --64 --version -o /tmp/ccgWwlnz.o /tmp/ccgrR1JA.s
GNU assembler version 2.38 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.38
GNU assembler (GNU Binutils) 2.38
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-unknown-linux-gnu'.
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/home/user/.guix-profile/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/home/user/.guix-profile/lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cckoOYEA.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro --version /home/user/.guix-profile/lib/../lib/Scrt1.o /home/user/.guix-profile/lib/../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/home/user/.guix-profile/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/user/.guix-profile/lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. /tmp/ccgWwlnz.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /home/user/.guix-profile/lib/../lib/crtn.o
collect2 version 9.4.0
/home/user/.guix-profile/bin/ld -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cckoOYEA.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro --version /home/user/.guix-profile/lib/../lib/Scrt1.o /home/user/.guix-profile/lib/../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/home/user/.guix-profile/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/home/user/.guix-profile/lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. /tmp/ccgWwlnz.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /home/user/.guix-profile/lib/../lib/crtn.o
GNU ld (GNU Binutils) 2.38
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--version' '-v' '-mtune=generic' '-march=x86-64'

From the backtrace it looks like the dynamic linker is encountering infinite recursion and therefore stackoverflowing (wtf??). But given that the C program also segfaults, this looks like an issue on your system and not a problem with Rust. Looks like something about your Guix installation is wrong. Maybe a Guix support forum/mailing list or whatever they use can help you.

I don't think that will help, because I have no issue using GNU Guix package manager, so they will tell me, that for Rust things I need to ask Rust community for help : ) GNU Guix package manager runs fine, so they would not see an issue with it.

I just tried using gcc directly, which works:

$ gcc hello_world.c -o a.out
$ ./a.out 
Hello World

So it must be how Rust or cc is set up or what environment variables it uses. (correct?)

From your https://github.com/rust-lang/rust/issues/113299#issuecomment-1619166173 and your bug report, you are using Linux Mint, but the linker being used comes from Guix you have installed on your distro.

Why is this the case? Why does Rust not know what linker the actual linker is, instead of making use of the one Guix has put anywhere? Shouldn't Rust know the system's actual linker? Or are there no conventional linker locations, so that any linker found could be "the one"?

I think the solution is just to gain access to a clean environment (e.g. to use the environment from Linux Mint instead of guix shell), and use host (Linux Mint) tools to compile programs.

Yes, this seems to be the case. Not sure how to get there though. Maybe I could take Guix off the PATH and reinstall Rust and then try again?

Cyanoxygen commented 1 year ago
PATH="/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/user/.cargo/bin:/home/hans/.config/guix/current/bin:/home/user/.config/guix/current/bin:/home/user/.config/guix/current/sbin:/home/user/.config/guix/current/bin:/home/user/.local/bin:/home/user/.guix-profile/bin:/home/user/.guix-profile/sbin:/home/user/.config/guix/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/user/.local/bin:/usr/lib/jvm/java-17-openjdk-amd64/bin:/usr/local/texlive/2022/bin/x86_64-linux"

You definitely left Guix in your PATH.

Why does Rust not know what linker the actual linker is, instead of making use of the one Guix has put anywhere?

The default linker used by rustc is cc. That means, a program called cc should be present in your PATH, or you have to specify a liker during compilation, either by editing Cargo.toml or specifying RUSTFLAGS (-C linker=/path/to/the/linker).
However, cc is a C compiler, but it can help you to link objects, by calling collect2 (intermediate for ld), collect2 then will call ld or another linker. You can see this behavior with gcc --verbose or for Rust, -C link-arg=--verbose which turns on verbose output for cc.

Plus, there's one thing to notice: when using the C compiler to link programs, cc will add paths of GCC runtime to the list of object files. You can see this behavior with gcc --verbose, too, as it will print out the command line arguments while invoking collect2.

Suppose I have a very clean (i.e. without ANY environment variables, even PATH) environment, when I tell rustc to compile a program, it will fail as it can not find a linker to invoke, as in the picture below:

Click to expand/collapse the picture ![image](https://github.com/rust-lang/rust/assets/29174191/3f343e39-c55b-4b76-8c9d-cf76d9382f66)

And if I create a symbolic link of gcc to /tmp/bin/cc, GCC will still complain about missing ld:

Click here to expand/collapse ![image](https://github.com/rust-lang/rust/assets/29174191/80125d49-7c60-442f-a5c6-004401479e50)

Therefore, I think the situation is:

TL;DR Rust invoked host cc, and host cc invoked Giux ld (which comes from PATH).

Shouldn't Rust know the system's actual linker? Or are there no conventional linker locations, so that any linker found could be "the one"?

On a freshly installed Guix system, with gcc-toolchain installed, here's the linker and compiler (cc does not exist):

cyan@apjf38heriulfh34of5 ~$ which ld
/home/cyan/.guix-profile/bin/ld
cyan@apjf38heriulfh34of5 ~$ which gcc
/home/cyan/.guix-profile/bin/gcc

For other distros with (almost) FHS compliance, they usually reside on /usr/bin/{cc,ld}. And if we take LLVM's own linker (lld), ld.gold, and cross-compilation into account, then things started to get complex.

Anyway, no one can determine what linker to use, it can not be hard coded (at least no one does). For Rust, the only thing it can do is rely on PATH to get a C compiler (which can link objects). The C compiler will then try to invoke ld.

and reinstall Rust and then try again?

You don't have to do this if your home folder is not managed by Guix.

ZelphirKaltstahl commented 1 year ago

Thanks for giving the detailed explanation about how this works in general! Lots of things I did not know.

I will try with temporarily removing Guix from my PATH.

ZelphirKaltstahl commented 1 year ago

Actually the title of this issue was changed from my original title and now is wrong. Even though I may have Guix stuff on my PATH, I repeat, that my OS is not GNU Guix. I am merely using Guix as a package manager "on foreign distro".

-> I suggest changing the title, so that other people will not think this is exclusively about GNU Guix OS.

ZelphirKaltstahl commented 1 year ago

Trying things with guix not on the path did not make the segfault disappear. Trying on another machine, which has GNU Guix installed as well did not result in the segfault. Not sure what to make of this.

tgross35 commented 1 year ago

There has to be something different in what is getting picked up, or a weird configuration with cc/gcc. I'd start by diffing the output in printenv between the two machines and seeing what doesn't match up, and also seeing if the outputs of which cc and which gcc. You can also run gcc -dumpspecs on both machines and see what is different, or try compiling your C program with -v to see what is happening. I would focus on getting a sample C program to run successfully and then switch to Rust - maybe see if running a fresh downloaded GCC binary works? Or purging & reinstalling your system gcc?

It's good that you have a reference machine, but it's really unfortunate that you still haven't had any success. Absolute worst case you can build in a docker container, but that's a solution that shouldn't be necessary.

ZelphirKaltstahl commented 1 year ago

Thanks for the pointers.

I have set up a virtual machine with Debian 12 to test there (works). I imagine I could write code on the host system and mount a shared folder into the virtual machine (just like a volume in a docker container).

If I have any new information regarding my issue, I will post it here.