Stream: beginners

Topic: could not compile


view this post on Zulip Jan Wirth (May 23 2022 at 21:32):

Hey there
I'm struggling to run the hello world example.

view this post on Zulip Jan Wirth (May 23 2022 at 21:32):

error[E0425]: cannot find function `fexecve` in crate `libc`
   --> cli/src/lib.rs:609:26
    |
609 |                   if libc::fexecve(fd, argv.as_ptr(), envp.as_ptr()) != 0 {
    |                            ^^^^^^^ help: a function with a similar name exists: `execve`
    |
   ::: /Users/janwirth/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.125/src/unix/mod.rs:862:5
    |
862 | /     pub fn execve(
863 | |         prog: *const c_char,
864 | |         argv: *const *const c_char,
865 | |         envp: *const *const c_char,
866 | |     ) -> ::c_int;
    | |_________________- similarly named function `execve` defined here

error[E0425]: cannot find function `memfd_create` in crate `libc`
   --> cli/src/lib.rs:655:33
    |
655 |         let fd = unsafe { libc::memfd_create(anonymous_file_name.as_ptr().cast(), flags) };
    |                                 ^^^^^^^^^^^^ not found in `libc`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `roc_cli` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

[nix-shell:~/roc]$

view this post on Zulip Jan Wirth (May 23 2022 at 21:32):

I had it working before, but I pulled to get the latest updates from trunk and it seems broken since.

view this post on Zulip Jan Wirth (May 23 2022 at 21:33):

Is it posisble that I have to clear some nix cache or so?

view this post on Zulip Folkert de Vries (May 23 2022 at 21:42):

ah, no

view this post on Zulip Folkert de Vries (May 23 2022 at 21:42):

we're missing some conditional compilation there

view this post on Zulip Folkert de Vries (May 23 2022 at 21:42):

that's annoying

view this post on Zulip Folkert de Vries (May 23 2022 at 21:42):

what OS are you on?

view this post on Zulip Folkert de Vries (May 23 2022 at 21:51):

@Richard Feldman I'm assuming this is a macos issue where certain functions in libc are not there and we need to probably pull linux and macos apart in the code.

view this post on Zulip Folkert de Vries (May 23 2022 at 21:51):

it's hard for me to get right though because on linux everything just works

view this post on Zulip Richard Feldman (May 24 2022 at 00:23):

yeah that's one of the functions that Linux libc has but Mac doesn't

view this post on Zulip Richard Feldman (May 24 2022 at 00:23):

I'll make a PR to fix

view this post on Zulip Jan Wirth (May 24 2022 at 08:46):

Yeah I'm on OSX M1
image.png

view this post on Zulip Richard Feldman (May 24 2022 at 13:42):

https://github.com/rtfeldman/roc/pull/3124/files should fix this!

view this post on Zulip Hashi364 (Jun 03 2022 at 23:45):

I can't build roc_loadthe error was

error: failed to run custom build command for `roc_load v0.1.0 (PATH/roc/compile/load)`

Caused by:
  process didn't exit successfully: `PATH/roc/target/debug/build/roc_load-152347a29c7becb0/build-script-build` (signal: 4, SIGILL: illegal instruction)
  --- stdout
  cargo:rerun-if-changed=../builtins/roc/Bool.roc
  cargo:rerun-if-changed=../builtins/roc/Result.roc

view this post on Zulip Folkert de Vries (Jun 04 2022 at 07:20):

What system are you on?

view this post on Zulip Hashi364 (Jun 04 2022 at 12:53):

Arch

view this post on Zulip Anton (Jun 05 2022 at 08:21):

Hi @Hashi364, can you describe the steps you took? Did you download the repo and run cargo build from the root of the repo dir?

view this post on Zulip Hashi364 (Jun 05 2022 at 15:08):

@Anton I cloned the repo, installed the nix package manager and Flakes, created ~/.config/nix/nix.config as a copy of /etc/nix/nix.conf and appended experimental-fatures = nix-command flakes, entered the repo_dir and ran nix develop and then cargo build

view this post on Zulip Anton (Jun 06 2022 at 08:01):

Thanks @Hashi364, could you also share the output of lscpu? Do you happen to be inside a virtual machine? Once I have this information I'll try to reproduce the error.

view this post on Zulip Hashi364 (Jun 06 2022 at 23:47):

Arquitetura:                  x86_64
  Modo(s) operacional da CPU: 32-bit, 64-bit
  Tamanhos de endereço:       36 bits physical, 48 bits virtual
  Ordem dos bytes:            Little Endian
CPU(s):                       4
  Lista de CPU(s) on-line:    0-3
ID de fornecedor:             GenuineIntel
  Nome do modelo:             Intel(R) Pentium(R) CPU  N3700  @ 1.60GHz
    Família da CPU:           6
    Modelo:                   76
    Thread(s) per núcleo:     1
    Núcleo(s) por soquete:    4
    Soquete(s):               1
    Step:                     3
    CPU(s) scaling MHz:       36%
    CPU MHz máx.:             2400,0000
    CPU MHz mín.:             480,0000
    BogoMIPS:                 3201.33
    Opções:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe s
                              yscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf
                              tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadli
                              ne_timer aes rdrand lahf_lm 3dnowprefetch epb pti tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida a
                              rat
Recursos de virtualização:
  Virtualização:              VT-x
Caches (soma de todos):
  L1d:                        96 KiB (4 instâncias)
  L1i:                        128 KiB (4 instâncias)
  L2:                         2 MiB (2 instâncias)
NUMA:
  Nó(s) de NUMA:              1
  CPU(s) de nó0 NUMA:         0-3
Vulnerabilidades:
  Itlb multihit:              Not affected
  L1tf:                       Not affected
  Mds:                        Vulnerable: Clear CPU buffers attempted, no microcode; SMT disabled
  Meltdown:                   Mitigation; PTI
  Spec store bypass:          Not affected
  Spectre v1:                 Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:                 Mitigation; Retpolines, STIBP disabled, RSB filling
  Srbds:                      Not affected
  Tsx async abort:            Not affected

@Anton

view this post on Zulip Folkert de Vries (Jun 07 2022 at 07:45):

I think cargo build -vv ("very verbose") may tell us more

view this post on Zulip Folkert de Vries (Jun 07 2022 at 07:45):

it looks like either a segfault or panic, would be good to know which

view this post on Zulip Anton (Jun 07 2022 at 13:04):

I think the Pentium processor is the problem, those don't have the same instructions available as most modern CPUs. This also means I won't be able to reproduce the problem. @Hashi364 , you can use gdb to find the instruction that causes the problem. I don't have any experience with gdb, but perhaps @Folkert de Vries or @Brendan Hansknecht can provide more detailed information on how to find the instruction as well as figure out which code generates that instruction.

view this post on Zulip Folkert de Vries (Jun 07 2022 at 13:05):

that implies it's a problem with the rust compiler, which I find hard to believe

view this post on Zulip Folkert de Vries (Jun 07 2022 at 13:06):

much more likely I made something segfault when reading/writing subs to/from disk

view this post on Zulip Anton (Jun 07 2022 at 13:08):

Couldn't some dependency create the illegal instruction error like in this issue?

view this post on Zulip Richard Feldman (Jun 07 2022 at 13:13):

wouldn't simd instructions be illegal (due to not existing) on a pentium?

view this post on Zulip Folkert de Vries (Jun 07 2022 at 13:16):

hmm, potentially

view this post on Zulip Folkert de Vries (Jun 07 2022 at 13:16):

we don't really check for feature availability in the simd code, just assume that these features are available on x86_64

view this post on Zulip Folkert de Vries (Jun 07 2022 at 13:16):

and they would be on most recent CPUs,

view this post on Zulip Richard Feldman (Jun 07 2022 at 13:18):

hm, apparently N3700 is Braswell, which does support SIMD

view this post on Zulip Richard Feldman (Jun 07 2022 at 13:18):

https://laptopmedia.com/review/intel-pentium-n3700-review-the-budget-braswell-family-is-here/

view this post on Zulip Hashi364 (Jun 07 2022 at 23:49):

Building with cargo build -vvshows this warning from C/C++ twice (which doesn't look usefull to me) and the same error at the end:

warning:                  from /nix/store/j85inaz3mf0vy03c2jr835pqr0x5898b-llvm-13.0.0-dev/include/llvm-c/DataTypes.h:27,
warning:                  from /nix/store/j85inaz3mf0vy03c2jr835pqr0x5898b-llvm-13.0.0-dev/include/llvm-c/Types.h:17,
warning:                  from /nix/store/j85inaz3mf0vy03c2jr835pqr0x5898b-llvm-13.0.0-dev/include/llvm-c/Target.h:23,
warning:                  from wrappers/target.c:7:
warning: /nix/store/f8z3wraxrbziyf93lwh6adslm89zi6fw-glibc-2.33-123-dev/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
warning:   397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
warning:       |    ^~~~~~~```

view this post on Zulip Folkert de Vries (Jun 08 2022 at 00:00):

hmm, does cargo check -vv complete succesfully?

view this post on Zulip Hashi364 (Jun 08 2022 at 00:15):

It fails with the same error

view this post on Zulip Folkert de Vries (Jun 08 2022 at 00:22):

hmm, do you happen to have lldb installed?

view this post on Zulip Folkert de Vries (Jun 08 2022 at 00:22):

it's part of llvm

view this post on Zulip Folkert de Vries (Jun 08 2022 at 00:22):

if so, lldb cargo -- check -vv might do something

view this post on Zulip Folkert de Vries (Jun 08 2022 at 00:23):

the tricky part is that we and cargo are spawning a bunch of threads

view this post on Zulip Hashi364 (Jun 09 2022 at 01:11):

I can't run lldb inside a nix develop shell.
I tried installing from pacman -S lldb looks like it works (but not on nix develop shell)
I tried installing from nix-env -i lldb but it can't find libicuuc.so

view this post on Zulip Hashi364 (Jun 09 2022 at 01:23):

When I try pacman's lldb yells that can't find some libraries' version information or something

lldb: /nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib/libpanelw.so.6: no version information available (required by /usr/lib/liblldb.so.13)
lldb: /nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /usr/lib/liblldb.so.13)
lldb: /nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /usr/lib/liblldb.so.13)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib/liblldb.so.13)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /usr/lib/liblldb.so.13)
lldb: /nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib/libncursesw.so.6: no version information available (required by /usr/lib/libLLVM-13.so)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib/libLLVM-13.so)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by /usr/lib/libLLVM-13.so)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /usr/lib/libLLVM-13.so)
lldb: /nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib/libclang-cpp.so.13)

view this post on Zulip Anton (Jun 09 2022 at 08:22):

I can try making lldb work inside nix tomorrow.

view this post on Zulip Anton (Jun 10 2022 at 10:15):

@Hashi364 in flake.nix you can add llvmPkgs.lldb below llvmPkgs.lld. Then you can do nix develop followed by lldb cargo -- check -vv.

view this post on Zulip Folkert de Vries (Jun 10 2022 at 10:17):

assuming that works, it puts you in something like an interpreter. run (followed by enter) should run the application and crash, then bt gives the backtrace. That's what I'd like to see

view this post on Zulip Hashi364 (Jun 10 2022 at 18:17):

@Anton @Folkert de Vries Only one error this time:

/nix/store/bf05bf7znhygdpfxh2kdagmxwi1xfkis-lldb-13.0.0/bin/lldb: error while loading shared libraries: libicuuc.so.71: cannot open shared object file: No such file or directory

view this post on Zulip Folkert de Vries (Jun 10 2022 at 18:17):

I think this is still a nix problem

view this post on Zulip Folkert de Vries (Jun 10 2022 at 18:18):

at least, I'm guessing just lldb would give the same thing?

view this post on Zulip Hashi364 (Jun 10 2022 at 18:51):

Yes, both lldb and lldb cargo -- check -vv say the same thing

view this post on Zulip Anton (Jun 11 2022 at 08:41):

From what I could find there appears to be something wrong with your archlinux mirror, to fix this:

And then try lldb again in the roc dir:

view this post on Zulip Hashi364 (Jun 12 2022 at 13:41):

@Anton I did it, same error

view this post on Zulip Anton (Jun 13 2022 at 08:40):

Thanks for sticking with us @Hashi364, I'll try to test it on ArchLinux today or tomorrow.

view this post on Zulip Hashi364 (Jun 13 2022 at 17:21):

Ok, don't feel rushed

view this post on Zulip Anton (Jun 14 2022 at 13:13):

I couldn't get lldb to work but;

  1. in flake.nix you can replace llvmPkgs.lldb with gdb
  2. run nix develop
  3. execute gdb target/debug/build/roc_load-152347a29c7becb0/build-script-build
  4. step through the program until the failure

I think that should reveal the instruction at which the program fails which may be an instruction your CPU does not support.

view this post on Zulip Hashi364 (Jun 15 2022 at 01:29):

I "full" run:

(gdb) run
Starting program: /home/shikiyo/selfinstalled/roc/target/debug/build/roc_load-152347a29c7becb0/build-script-build
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/rir9pf0kz1mb84x5bd3yr0fx415yy423-glibc-2.33-123/lib/libthread_db.so.1".
cargo:rerun-if-changed=../builtins/roc/Bool.roc
[New Thread 0x7ffff7ac1640 (LWP 6690)]
[New Thread 0x7ffff72bd640 (LWP 6691)]
[New Thread 0x7ffff6ab9640 (LWP 6692)]
[Thread 0x7ffff72bd640 (LWP 6691) exited]
[Thread 0x7ffff6ab9640 (LWP 6692) exited]
[Thread 0x7ffff7ac1640 (LWP 6690) exited]
thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', compiler/load/build.rs:50:66
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[Inferior 1 (process 6686) exited with code 0145]

A "stepped run":

(gdb) break main
Breakpoint 1 at 0x555555646d64: main. (2 locations)
(gdb) run
Starting program: /home/shikiyo/selfinstalled/roc/target/debug/build/roc_load-152347a29c7becb0/build-script-build
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/rir9pf0kz1mb84x5bd3yr0fx415yy423-glibc-2.33-123/lib/libthread_db.so.1".

Breakpoint 1, 0x0000555555647a50 in main ()
(gdb) n
Single stepping until exit from function main,
which has no line number information.

Breakpoint 1, build_script_build::main () at compiler/load/build.rs:21
21      for (module_id, filename) in MODULES {
(gdb) n
22          write_subs_for_module(*module_id, filename);
(gdb) n
cargo:rerun-if-changed=../builtins/roc/Bool.roc
[New Thread 0x7ffff7ac1640 (LWP 7234)]
[New Thread 0x7ffff72bd640 (LWP 7235)]
[New Thread 0x7ffff6ab9640 (LWP 7236)]
[Thread 0x7ffff6ab9640 (LWP 7236) exited]
[Thread 0x7ffff7ac1640 (LWP 7234) exited]
[Thread 0x7ffff72bd640 (LWP 7235) exited]
thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', compiler/load/build.rs:50:66
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[Inferior 1 (process 7211) exited with code 0145]

view this post on Zulip Hashi364 (Jun 15 2022 at 01:38):

Breaking on write_subs_for_module:

(gdb) b write_subs_for_module
Breakpoint 1 at 0xf2e15: file compiler/load/build.rs, line 28.
(gdb) run
Starting program: /home/shikiyo/selfinstalled/roc/target/debug/build/roc_load-152347a29c7becb0/build-script-build
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/rir9pf0kz1mb84x5bd3yr0fx415yy423-glibc-2.33-123/lib/libthread_db.so.1".

Breakpoint 1, build_script_build::write_subs_for_module (module_id=..., filename=...) at compiler/load/build.rs:28
28      println!("cargo:rerun-if-changed=../builtins/roc/{}", filename);
(gdb) n
cargo:rerun-if-changed=../builtins/roc/Bool.roc
30      let arena = Bump::new();
(gdb)
31      let src_dir = PathBuf::from(".");
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
37          PathBuf::from(filename),
(gdb)
39          &src_dir,
(gdb)
40          Default::default(),
(gdb)
42          roc_reporting::report::RenderTarget::ColorTerminal,
(gdb)
43          Threading::AllAvailable,
(gdb)
35      let res_module = roc_load_internal::file::load_and_typecheck_str(
(gdb)
[New Thread 0x7ffff7ac1640 (LWP 9490)]
[New Thread 0x7ffff72bd640 (LWP 9491)]
[New Thread 0x7ffff6ab9640 (LWP 9492)]
[Thread 0x7ffff72bd640 (LWP 9491) exited]
[Thread 0x7ffff7ac1640 (LWP 9490) exited]
[Thread 0x7ffff6ab9640 (LWP 9492) exited]
44      );
(gdb)
46      let module = res_module.unwrap();
(gdb)
47      let subs = module.solved.inner();
(gdb)
48      let exposed_vars_by_symbol: Vec<_> = module.exposed_to_host.into_iter().collect();
(gdb)
48      let exposed_vars_by_symbol: Vec<_> = module.exposed_to_host.into_iter().collect();
(gdb)
50      let mut output_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
(gdb)
thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', compiler/load/build.rs:50:66
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[Inferior 1 (process 9458) exited with code 0145]

view this post on Zulip Hashi364 (Jun 15 2022 at 01:39):

Looks like I don't have a OUT_DIR system variable

view this post on Zulip Hashi364 (Jun 15 2022 at 01:46):

I made a dir mkdir build and ran OUT_DIR=build gdb target/debug/build/roc_load-152347a29c7becb0/build-script-build
(I may have pressed <Enter> too fast at the and):

(gdb) b write_subs_for_module
Breakpoint 1 at 0xf2e15: file compiler/load/build.rs, line 28.
(gdb) run
Starting program: /home/shikiyo/selfinstalled/roc/target/debug/build/roc_load-152347a29c7becb0/build-script-build
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/rir9pf0kz1mb84x5bd3yr0fx415yy423-glibc-2.33-123/lib/libthread_db.so.1".
n
Breakpoint 1, build_script_build::write_subs_for_module (module_id=..., filename=...) at compiler/load/build.rs:28
28      println!("cargo:rerun-if-changed=../builtins/roc/{}", filename);
(gdb) n
cargo:rerun-if-changed=../builtins/roc/Bool.roc
30      let arena = Bump::new();
(gdb) n
31      let src_dir = PathBuf::from(".");
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
37          PathBuf::from(filename),
(gdb)
39          &src_dir,
(gdb)
40          Default::default(),
(gdb)
42          roc_reporting::report::RenderTarget::ColorTerminal,
(gdb)
43          Threading::AllAvailable,
(gdb)
35      let res_module = roc_load_internal::file::load_and_typecheck_str(
(gdb)
[New Thread 0x7ffff7ac1640 (LWP 10878)]
[New Thread 0x7ffff72c0640 (LWP 10879)]
[New Thread 0x7ffff6ab9640 (LWP 10880)]
[Thread 0x7ffff6ab9640 (LWP 10880) exited]
[Thread 0x7ffff72c0640 (LWP 10879) exited]
[Thread 0x7ffff7ac1640 (LWP 10878) exited]
44      );
(gdb)
46      let module = res_module.unwrap();
(gdb)
47      let subs = module.solved.inner();
(gdb)
48      let exposed_vars_by_symbol: Vec<_> = module.exposed_to_host.into_iter().collect();
(gdb)
48      let exposed_vars_by_symbol: Vec<_> = module.exposed_to_host.into_iter().collect();
(gdb)
50      let mut output_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
(gdb)
50      let mut output_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
(gdb)
51      output_path.extend(&[filename]);
(gdb)
52      output_path.set_extension("dat");
(gdb)
53      let mut file = std::fs::File::create(&output_path).unwrap();
(gdb)
54      subs.serialize(&exposed_vars_by_symbol, &mut file).unwrap();
(gdb)
54      subs.serialize(&exposed_vars_by_symbol, &mut file).unwrap();
(gdb)
55  }
(gdb)
build_script_build::main () at compiler/load/build.rs:21
21      for (module_id, filename) in MODULES {
(gdb)
22          write_subs_for_module(*module_id, filename);
(gdb)

Thread 1 "build-script-bu" hit Breakpoint 1, build_script_build::write_subs_for_module (module_id=..., filename=...) at compiler/load/build.rs:28
28      println!("cargo:rerun-if-changed=../builtins/roc/{}", filename);
(gdb)
cargo:rerun-if-changed=../builtins/roc/Result.roc
30      let arena = Bump::new();
(gdb)
31      let src_dir = PathBuf::from(".");
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
32      let source = roc_builtins::roc::module_source(module_id);
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
33      let target_info = roc_target::TargetInfo::default_x86_64();
(gdb)
37          PathBuf::from(filename),
(gdb)
39          &src_dir,
(gdb)
40          Default::default(),
(gdb)
42          roc_reporting::report::RenderTarget::ColorTerminal,
(gdb)
43          Threading::AllAvailable,
(gdb)
35      let res_module = roc_load_internal::file::load_and_typecheck_str(
(gdb)
[New Thread 0x7ffff6ab9640 (LWP 10977)]
[New Thread 0x7ffff72c0640 (LWP 10978)]
[New Thread 0x7ffff7ac1640 (LWP 10979)]

Thread 5 "build-script-bu" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7ffff6ab9640 (LWP 10977)]
core::core_arch::x86::avx::_mm256_setr_epi16 (e00=7, e01=7, e02=7, e03=7, e04=7, e05=7, e06=7, e07=7, e08=7, e09=7, e10=7, e11=7, e12=7, e13=7, e14=7, e15=7) at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/../../stdarch/crates/core_arch/src/x86/avx.rs:2368
2368  /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/../../stdarch/crates/core_arch/src/x86/avx.rs: No such file or directory.
(gdb)
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb)
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) [Thread 0x7ffff72c0640 (LWP 10978) exited]
[Thread 0x7ffff6ab9640 (LWP 10977) exited]
[Thread 0x7ffff7c6a880 (LWP 10842) exited]

Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb)

view this post on Zulip Hashi364 (Jun 15 2022 at 01:48):

Try to save the reading, looks like this is important:

core::core_arch::x86::avx::_mm256_setr_epi16 (e00=7, e01=7, e02=7, e03=7, e04=7, e05=7, e06=7, e07=7, e08=7, e09=7, e10=7, e11=7, e12=7, e13=7, e14=7, e15=7) at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/../../stdarch/crates/core_arch/src/x86/avx.rs:2368
2368  /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c/library/core/src/../../stdarch/crates/core_arch/src/x86/avx.rs: No such file or directory.

view this post on Zulip Anton (Jun 15 2022 at 08:41):

Looks like it's trying to use avx instructions, which your CPU doesn't support. Now we have to figure out what rust code is generating that instruction.

view this post on Zulip Anton (Jun 15 2022 at 08:55):

Looking at the disassembly of my roc_load-152347a29c7becb0/build-script-build:
callq eb0cf0 <_ZN4core9core_arch3x863avx17_mm256_set1_epi1617h486812b7e971ca88E> is called inside roc_collections21small_string_interner21find_i16_slice_x86

view this post on Zulip Anton (Jun 15 2022 at 09:01):

bingo :)
In compiler/collections/src/small_string_interner.rs in the function find_i16_slice_x86_64, we explicitly call _mm256_set1_epi16:

let keys = unsafe { _mm256_set1_epi16(key) };

And from the definition we can see that it is an avx instruction:

/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_set1_epi16)
#[inline]
#[target_feature(enable = "avx")]
//#[cfg_attr(test, assert_instr(vpshufb))]
#[cfg_attr(test, assert_instr(vinsertf128))]
// This intrinsic has no corresponding instruction.
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_set1_epi16(a: i16) -> __m256i {
    _mm256_setr_epi16(a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a)
}

view this post on Zulip Anton (Jun 15 2022 at 09:06):

Rust std has is_x86_feature_detected!("avx") so we can change #[cfg(target_arch = "x86_64")] to also check that.
Should I apply the fix like that @Folkert de Vries?

view this post on Zulip Anton (Jun 15 2022 at 10:35):

I ended up using target-feature instead. The fix is on the illegal_instruction_PENTIUM_N3700 branch. Can you give it a try @Hashi364 (nix develop followed by cargo build)?

view this post on Zulip Hashi364 (Jun 16 2022 at 00:33):

git switch illegal_instruction_PENTIUM_N3700, nix develop, cargo build:

Compiling cfg-if v1.0.0
   Compiling libc v0.2.125
   Compiling proc-macro2 v1.0.38
   Compiling unicode-xid v0.2.3
error: unknown codegen option:  target-cpu

error: could not compile cfg-if due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

view this post on Zulip Hashi364 (Jun 16 2022 at 00:39):

With cargo build -vv part 1

Compiling cfg-if v1.0.0
   Compiling libc v0.2.125
   Compiling proc-macro2 v1.0.38
   Compiling unicode-xid v0.2.3
     Running `CARGO=/nix/store/mzckrnrszs2f1hrssb4cdqisjrrh87il-cargo-1.60.0-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=cfg_if CARGO_MANIFEST_DIR=/home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_DESCRIPTION='A macro to ergonomically define an item depending on a large number of #[cfg]
parameters. Structured like an if-else chain, the first matching branch is the
item that gets emitted.
' CARGO_PKG_HOMEPAGE='https://github.com/alexcrichton/cfg-if' CARGO_PKG_LICENSE=MIT/Apache-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=cfg-if CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/cfg-if' CARGO_PKG_VERSION=1.0.0 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/shikiyo/selfinstalled/roc/target/debug/deps:/nix/store/j3wy0pj7xcxdmj2sjlwsm825hynrbrmg-rust-default-1.60.0/lib:/nix/store/nk9n0g0gk856nnzcik0q7dwpqq49qjzz-pkg-config-wrapper-0.29.2/lib:/nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib:/nix/store/5vqz6vp6cwlr94684583zzpwz5mvn9af-libffi-3.4.2/lib:/nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib:/nix/store/p7syn79gwkjxcpqw2w79jw0qdlxr8s26-zlib-1.2.11/lib:/nix/store/9zb5qxnixld6bdvcp5isphi4qwscf6b7-valgrind-3.18.1/lib:/nix/store/xn34bjf4p7c4gcgxfsi8x09ikcsk55yh-vulkan-headers-1.2.189.1/lib:/nix/store/fjk8k473smpgxsqcs9lkdwayznlg6zgk-vulkan-loader-1.2.189.1/lib:/nix/store/qf6za190wgnq6i0k4yl75x84qcjlx05n-vulkan-tools-1.2.189.1/lib:/nix/store/qvifqgyfmq990sbgqn0blc6jx7429ypz-vulkan-validation-layers-1.2.189.1/lib:/nix/store/0pp8dys4m0j3d4idqjwzpk7xyapm0v8v-libX11-1.7.2/lib:/nix/store/bgilik8910381jk9vjmkkzmks00k271l-libXcursor-1.2.0/lib:/nix/store/n89p0dfm498v4zk1lv7pjrrfxqg26sqy-libXrandr-1.5.2/lib:/nix/store/17npsrav57vc90sn4034y51l0pndr1s5-libXi-1.8/lib:/nix/store/hc32k2zvhxmjg6280vs30kbqzgnfiwfd-libxcb-1.14/lib:/nix/store/ghj9i9xcadkrzlsfi1zr39pxwhgsqgrh-alsa-lib-1.2.5.1/lib' ROC_DEBUG_ALIAS_ANALYSIS=0 ROC_PRETTY_PRINT_ALIAS_CONTENTS=0 ROC_PRINT_IR_AFTER_REFCOUNT=0 ROC_PRINT_IR_AFTER_RESET_REUSE=0 ROC_PRINT_IR_AFTER_SPECIALIZATION=0 ROC_PRINT_LLVM_FN_VERIFICATION=0 ROC_PRINT_LOAD_LOG=0 ROC_PRINT_MISMATCHES=0 ROC_PRINT_UNIFICATIONS=0 ROC_VERIFY_RIGID_LET_GENERALIZED=0 ROC_WORKSPACE_DIR=/home/shikiyo/selfinstalled/roc/ rustc --crate-name cfg_if --edition=2018 /home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=56df745b5175507b -C extra-filename=-56df745b5175507b --out-dir /home/shikiyo/selfinstalled/roc/target/debug/deps -L dependency=/home/shikiyo/selfinstalled/roc/target/debug/deps --cap-lints warn '-C target-cpu=native'`
     Running `CARGO=/nix/store/mzckrnrszs2f1hrssb4cdqisjrrh87il-cargo-1.60.0-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.125 CARGO_PKG_AUTHORS='The Rust Project Developers' CARGO_PKG_DESCRIPTION='Raw FFI bindings to platform libraries like libc.
GitHub

view this post on Zulip Hashi364 (Jun 16 2022 at 00:40):

Part 2:

GitHub - alexcrichton/cfg-if: A if/elif-like macro for Rust #[cfg] statements

A if/elif-like macro for Rust #[cfg] statements. Contribute to alexcrichton/cfg-if development by creating an account on GitHub.

' CARGO_PKG_HOMEPAGE='https://github.com/rust-lang/libc' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=libc CARGO_PKG_REPOSITORY='https://github.com/rust-lang/libc' CARGO_PKG_VERSION=0.2.125 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=125 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/shikiyo/selfinstalled/roc/target/debug/deps:/nix/store/j3wy0pj7xcxdmj2sjlwsm825hynrbrmg-rust-default-1.60.0/lib:/nix/store/nk9n0g0gk856nnzcik0q7dwpqq49qjzz-pkg-config-wrapper-0.29.2/lib:/nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib:/nix/store/5vqz6vp6cwlr94684583zzpwz5mvn9af-libffi-3.4.2/lib:/nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib:/nix/store/p7syn79gwkjxcpqw2w79jw0qdlxr8s26-zlib-1.2.11/lib:/nix/store/9zb5qxnixld6bdvcp5isphi4qwscf6b7-valgrind-3.18.1/lib:/nix/store/xn34bjf4p7c4gcgxfsi8x09ikcsk55yh-vulkan-headers-1.2.189.1/lib:/nix/store/fjk8k473smpgxsqcs9lkdwayznlg6zgk-vulkan-loader-1.2.189.1/lib:/nix/store/qf6za190wgnq6i0k4yl75x84qcjlx05n-vulkan-tools-1.2.189.1/lib:/nix/store/qvifqgyfmq990sbgqn0blc6jx7429ypz-vulkan-validation-layers-1.2.189.1/lib:/nix/store/0pp8dys4m0j3d4idqjwzpk7xyapm0v8v-libX11-1.7.2/lib:/nix/store/bgilik8910381jk9vjmkkzmks00k271l-libXcursor-1.2.0/lib:/nix/store/n89p0dfm498v4zk1lv7pjrrfxqg26sqy-libXrandr-1.5.2/lib:/nix/store/17npsrav57vc90sn4034y51l0pndr1s5-libXi-1.8/lib:/nix/store/hc32k2zvhxmjg6280vs30kbqzgnfiwfd-libxcb-1.14/lib:/nix/store/ghj9i9xcadkrzlsfi1zr39pxwhgsqgrh-alsa-lib-1.2.5.1/lib' ROC_DEBUG_ALIAS_ANALYSIS=0 ROC_PRETTY_PRINT_ALIAS_CONTENTS=0 ROC_PRINT_IR_AFTER_REFCOUNT=0 ROC_PRINT_IR_AFTER_RESET_REUSE=0 ROC_PRINT_IR_AFTER_SPECIALIZATION=0 ROC_PRINT_LLVM_FN_VERIFICATION=0 ROC_PRINT_LOAD_LOG=0 ROC_PRINT_MISMATCHES=0 ROC_PRINT_UNIFICATIONS=0 ROC_VERIFY_RIGID_LET_GENERALIZED=0 ROC_WORKSPACE_DIR=/home/shikiyo/selfinstalled/roc/ rustc --crate-name build_script_build /home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.125/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=e60b3e521702b755 -C extra-filename=-e60b3e521702b755 --out-dir /home/shikiyo/selfinstalled/roc/target/debug/build/libc-e60b3e521702b755 -L dependency=/home/shikiyo/selfinstalled/roc/target/debug/deps --cap-lints warn '-C target-cpu=native'`
     Running CARGO=/nix/store/mzckrnrszs2f1hrssb4cdqisjrrh87il-cargo-1.60.0-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=build_script_build CARGO_MANIFEST_DIR=/home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.38 CARGO_PKG_AUTHORS='David Tolnay <dtolnay@gmail.com>:Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_DESCRIPTION='A substitute implementation of the compiler'\''s `proc_macro API to decouple
token-based libraries from the procedural macro use case.
GitHub

GitHub - rust-lang/libc: Raw bindings to platform APIs for Rust

Raw bindings to platform APIs for Rust. Contribute to rust-lang/libc development by creating an account on GitHub.

' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=proc-macro2 CARGO_PKG_REPOSITORY='https://github.com/dtolnay/proc-macro2' CARGO_PKG_VERSION=1.0.38 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=38 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/shikiyo/selfinstalled/roc/target/debug/deps:/nix/store/j3wy0pj7xcxdmj2sjlwsm825hynrbrmg-rust-default-1.60.0/lib:/nix/store/nk9n0g0gk856nnzcik0q7dwpqq49qjzz-pkg-config-wrapper-0.29.2/lib:/nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib:/nix/store/5vqz6vp6cwlr94684583zzpwz5mvn9af-libffi-3.4.2/lib:/nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib:/nix/store/p7syn79gwkjxcpqw2w79jw0qdlxr8s26-zlib-1.2.11/lib:/nix/store/9zb5qxnixld6bdvcp5isphi4qwscf6b7-valgrind-3.18.1/lib:/nix/store/xn34bjf4p7c4gcgxfsi8x09ikcsk55yh-vulkan-headers-1.2.189.1/lib:/nix/store/fjk8k473smpgxsqcs9lkdwayznlg6zgk-vulkan-loader-1.2.189.1/lib:/nix/store/qf6za190wgnq6i0k4yl75x84qcjlx05n-vulkan-tools-1.2.189.1/lib:/nix/store/qvifqgyfmq990sbgqn0blc6jx7429ypz-vulkan-validation-layers-1.2.189.1/lib:/nix/store/0pp8dys4m0j3d4idqjwzpk7xyapm0v8v-libX11-1.7.2/lib:/nix/store/bgilik8910381jk9vjmkkzmks00k271l-libXcursor-1.2.0/lib:/nix/store/n89p0dfm498v4zk1lv7pjrrfxqg26sqy-libXrandr-1.5.2/lib:/nix/store/17npsrav57vc90sn4034y51l0pndr1s5-libXi-1.8/lib:/nix/store/hc32k2zvhxmjg6280vs30kbqzgnfiwfd-libxcb-1.14/lib:/nix/store/ghj9i9xcadkrzlsfi1zr39pxwhgsqgrh-alsa-lib-1.2.5.1/lib' ROC_DEBUG_ALIAS_ANALYSIS=0 ROC_PRETTY_PRINT_ALIAS_CONTENTS=0 ROC_PRINT_IR_AFTER_REFCOUNT=0 ROC_PRINT_IR_AFTER_RESET_REUSE=0 ROC_PRINT_IR_AFTER_SPECIALIZATION=0 ROC_PRINT_LLVM_FN_VERIFICATION=0 ROC_PRINT_LOAD_LOG=0 ROC_PRINT_MISMATCHES=0 ROC_PRINT_UNIFICATIONS=0 ROC_VERIFY_RIGID_LET_GENERALIZED=0 ROC_WORKSPACE_DIR=/home/shikiyo/selfinstalled/roc/ rustc --crate-name build_script_build --edition=2018 /home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.38/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=8ed3c46b652f6dfc -C extra-filename=-8ed3c46b652f6dfc --out-dir /home/shikiyo/selfinstalled/roc/target/debug/build/proc-macro2-8ed3c46b652f6dfc -L dependency=/home/shikiyo/selfinstalled/roc/target/debug/deps --cap-lints warn '-C target-cpu=native'`
     Running `CARGO=/nix/store/mzckrnrszs2f1hrssb4cdqisjrrh87il-cargo-1.60.0-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=unicode_xid CARGO_MANIFEST_DIR=/home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-xid-0.2.3 CARGO_PKG_AUTHORS='erick.tryzelaar <erick.tryzelaar@gmail.com>:kwantam <kwantam@gmail.com>:Manish Goregaokar <manishsmail@gmail.com>' CARGO_PKG_DESCRIPTION='Determine whether characters have the XID_Start
or XID_Continue properties according to
Unicode Standard Annex #31.

' CARGO_PKG_HOMEPAGE='https://github.com/unicode-rs/unicode-xid' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=unicode-xid CARGO_PKG_REPOSITORY='https://github.com/unicode-rs/unicode-xid' CARGO_PKG_VERSION=0.2.3 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=3 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/shikiyo/selfinstalled/roc/target/debug/deps:/nix/store/j3wy0pj7xcxdmj2sjlwsm825hynrbrmg-rust-default-1.60.0/lib:/nix/store/nk9n0g0gk856nnzcik0q7dwpqq49qjzz-pkg-config-wrapper-0.29.2/lib:/nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib:/nix/store/5vqz6vp6cwlr94684583zzpwz5mvn9af-libffi-3.4.2/lib:/nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib:/nix/store/p7syn79gwkjxcpqw2w79jw0qdlxr8s26-zlib-1.2.11/lib:/nix/store/9zb5qxnixld6bdvcp5isphi4qwscf6b7-valgrind-3.18.1/lib:/nix/store/xn34bjf4p7c4gcgxfsi8x09ikcsk55yh-vulkan-headers-1.2.189.1/lib:/nix/store/fjk8k473smpgxsqcs9lkdwayznlg6zgk-vulkan-loader-1.2.189.1/lib:/nix/store/qf6za190wgnq6i0k4yl75x84qcjlx05n-vulkan-tools-1.2.189.1/lib:/nix/store/qvifqgyfmq990sbgqn0blc6jx7429ypz-vulkan-validation-layers-1.2.189.1/lib:/nix/store/0pp8dys4m0j3d4idqjwzpk7xyapm0v8v-libX11-1.7.2/lib:/nix/store/bgilik8910381jk9vjmkkzmks00k271l-libXcursor-1.2.0/lib:/nix/store/n89p0dfm498v4zk1lv7pjrrfxqg26sqy-libXrandr-1.5.2/lib:/nix/store/17npsrav57vc90sn4034y51l0pndr1s5-libXi-1.8/lib:/nix/store/hc32k2zvhxmjg6280vs30kbqzgnfiwfd-libxcb-1.14/lib:/nix/store/ghj9i9xcadkrzlsfi1zr39pxwhgsqgrh-alsa-lib-1.2.5.1/lib' ROC_DEBUG_ALIAS_ANALYSIS=0 ROC_PRETTY_PRINT_ALIAS_CONTENTS=0 ROC_PRINT_IR_AFTER_REFCOUNT=0 ROC_PRINT_IR_AFTER_RESET_REUSE=0 ROC_PRINT_IR_AFTER_SPECIALIZATION=0 ROC_PRINT_LLVM_FN_VERIFICATION=0 ROC_PRINT_LOAD_LOG=0 ROC_PRINT_MISMATCHES=0 ROC_PRINT_UNIFICATIONS=0 ROC_VERIFY_RIGID_LET_GENERALIZED=0 ROC_WORKSPACE_DIR=/home/shikiyo/selfinstalled/roc/ rustc --crate-name unicode_xid /home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-xid-0.2.3/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=5409942a6294a17e -C extra-filename=-5409942a6294a17e --out-dir /home/shikiyo/selfinstalled/roc/target/debug/deps -L dependency=/home/shikiyo/selfinstalled/roc/target/debug/deps --cap-lints warn '-C target-cpu=native'`
error: unknown codegen option:  target-cpu

error: could not compile cfg-if due to previous error

view this post on Zulip Hashi364 (Jun 16 2022 at 00:40):

Part 3:

Caused by:
  process didn't exit successfully: `CARGO=/nix/store/mzckrnrszs2f1hrssb4cdqisjrrh87il-cargo-1.60.0-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=cfg_if CARGO_MANIFEST_DIR=/home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0 CARGO_PKG_AUTHORS='Alex Crichton <alex@alexcrichton.com>' CARGO_PKG_DESCRIPTION='A macro to ergonomically define an item depending on a large number of #[cfg]
  parameters. Structured like an if-else chain, the first matching branch is the
  item that gets emitted.
  ' CARGO_PKG_HOMEPAGE='https://github.com/alexcrichton/cfg-if' CARGO_PKG_LICENSE=MIT/Apache-2.0 CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=cfg-if CARGO_PKG_REPOSITORY='https://github.com/alexcrichton/cfg-if' CARGO_PKG_VERSION=1.0.0 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/shikiyo/selfinstalled/roc/target/debug/deps:/nix/store/j3wy0pj7xcxdmj2sjlwsm825hynrbrmg-rust-default-1.60.0/lib:/nix/store/nk9n0g0gk856nnzcik0q7dwpqq49qjzz-pkg-config-wrapper-0.29.2/lib:/nix/store/lbccj93nnf77zxg3m9gmral5avbp64z2-gcc-10.3.0-lib/lib:/nix/store/5vqz6vp6cwlr94684583zzpwz5mvn9af-libffi-3.4.2/lib:/nix/store/9s8s7snpms482zm3z68aq91d184ynqma-ncurses-6.2/lib:/nix/store/p7syn79gwkjxcpqw2w79jw0qdlxr8s26-zlib-1.2.11/lib:/nix/store/9zb5qxnixld6bdvcp5isphi4qwscf6b7-valgrind-3.18.1/lib:/nix/store/xn34bjf4p7c4gcgxfsi8x09ikcsk55yh-vulkan-headers-1.2.189.1/lib:/nix/store/fjk8k473smpgxsqcs9lkdwayznlg6zgk-vulkan-loader-1.2.189.1/lib:/nix/store/qf6za190wgnq6i0k4yl75x84qcjlx05n-vulkan-tools-1.2.189.1/lib:/nix/store/qvifqgyfmq990sbgqn0blc6jx7429ypz-vulkan-validation-layers-1.2.189.1/lib:/nix/store/0pp8dys4m0j3d4idqjwzpk7xyapm0v8v-libX11-1.7.2/lib:/nix/store/bgilik8910381jk9vjmkkzmks00k271l-libXcursor-1.2.0/lib:/nix/store/n89p0dfm498v4zk1lv7pjrrfxqg26sqy-libXrandr-1.5.2/lib:/nix/store/17npsrav57vc90sn4034y51l0pndr1s5-libXi-1.8/lib:/nix/store/hc32k2zvhxmjg6280vs30kbqzgnfiwfd-libxcb-1.14/lib:/nix/store/ghj9i9xcadkrzlsfi1zr39pxwhgsqgrh-alsa-lib-1.2.5.1/lib' ROC_DEBUG_ALIAS_ANALYSIS=0 ROC_PRETTY_PRINT_ALIAS_CONTENTS=0 ROC_PRINT_IR_AFTER_REFCOUNT=0 ROC_PRINT_IR_AFTER_RESET_REUSE=0 ROC_PRINT_IR_AFTER_SPECIALIZATION=0 ROC_PRINT_LLVM_FN_VERIFICATION=0 ROC_PRINT_LOAD_LOG=0 ROC_PRINT_MISMATCHES=0 ROC_PRINT_UNIFICATIONS=0 ROC_VERIFY_RIGID_LET_GENERALIZED=0 ROC_WORKSPACE_DIR=/home/shikiyo/selfinstalled/roc/ rustc --crate-name cfg_if --edition=2018 /home/shikiyo/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-1.0.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=56df745b5175507b -C extra-filename=-56df745b5175507b --out-dir /home/shikiyo/selfinstalled/roc/target/debug/deps -L dependency=/home/shikiyo/selfinstalled/roc/target/debug/deps --cap-lints warn '-C target-cpu=native'` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed

view this post on Zulip Anton (Jun 16 2022 at 10:36):

I fixed the unknown codegen option: target-cpu can you pull the latest version of the branch and try again?

view this post on Zulip Hashi364 (Jun 16 2022 at 11:54):

cargo build and cargo check ran ok, but cargo test fails, maybe I shouldn't worry about it, this is part of the output (I changed the input files and flags given to cc for ...):

Compiling roc_cli v0.1.0 (/home/shikiyo/selfinstalled/roc/cli)
   Compiling roc-bindgen v0.1.0 (/home/shikiyo/selfinstalled/roc/bindgen)
error: linking with cc failed: exit status: 1
  |
  = note: "cc" "-m64" ...
  = note: /nix/store/11szv8mf8ww7gv36kfgj56d68cx7chg3-gcc-wrapper-10.3.0/bin/ld: line 256: 36138 Killed                  /nix/store/wa59khxfvx6nf1wgdr5bjyyf9rdk23jc-binutils-2.35.2/bin/ld ${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"} ${extraAfter+"${extraAfter[@]}"}
          collect2: error: ld returned 137 exit status


error: could not compile roc_cli due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

view this post on Zulip Anton (Jun 16 2022 at 12:29):

Nice that build and check are working :)

I changed the input files and flags given to cc for ...

I'm not sure I follow completely, did you call something directly to recreate the error?

To fix things step by step, I recommend starting with building all tests cargo test --locked --release --no-run. If that works we can then try running them with cargo test --locked --release.

view this post on Zulip Hashi364 (Jun 16 2022 at 12:41):

I didn't change anything, I just didn't copied the full output (because it's too long). In the output there is something like note : "cc" "-m64" ... I put ... instead of a bunch of files and flags

view this post on Zulip Hashi364 (Jun 16 2022 at 12:44):

Trying to make things clear: I ran cargo test and I didn't paste the full output.
I'll try the step by step soon

view this post on Zulip Folkert de Vries (Jun 16 2022 at 12:58):

random observation /nix/store/11szv8mf8ww7gv36kfgj56d68cx7chg3-gcc-wrapper-10.3.0/bin/ld seems odd. It's definitely slow, lld is probably the better choice

view this post on Zulip Folkert de Vries (Jun 16 2022 at 12:58):

I have this in my ~/.cargo/config.toml

# Link with lld, per https://github.com/rust-lang/rust/issues/39915#issuecomment-538049306
# Use target-cpu=native, per https://deterministic.space/high-performance-rust.html
# rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=native"]
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=native"]
``

view this post on Zulip Folkert de Vries (Jun 16 2022 at 12:58):

not sure if nix has some different way to configure it

view this post on Zulip Richard Feldman (Jun 16 2022 at 13:10):

we could also consider trying mold, which claims to outperform lld (and I think was created by the author of lld and/or gold?) and which has a nix package

view this post on Zulip Richard Feldman (Jun 16 2022 at 13:14):

it doesn't support macOS yet, but mac support seems to be pretty far along and actively developed

view this post on Zulip Richard Feldman (Jun 16 2022 at 13:14):

Screen-Shot-2022-06-16-at-9.14.35-AM.png

view this post on Zulip Richard Feldman (Jun 16 2022 at 13:15):

:point_up: from the mold readme

view this post on Zulip Hashi364 (Jun 16 2022 at 19:48):

I ran cargo test --locked --release --no-run, worked, but cargo test --locked --release failed in this test battery:

Running tests/test_bindgen_cli.rs (target/release/deps/test_bindgen_cli-958923e56db382f9)
Running cargo build --release on the cli crate before running the tests. This may take a bit!

running 9 tests
test bindgen_cli_run::all_fixtures_have_tests ... ok
test bindgen_cli_run::enumeration ... ok
test bindgen_cli_run::basic_record ... ok
test bindgen_cli_run::basic_recursive_union ... ok
test bindgen_cli_run::advanced_recursive_union ... ok
test bindgen_cli_run::nested_record ... ok
test bindgen_cli_run::union_without_padding ... ok
test bindgen_cli_run::nullable_unwrapped ... ok
test bindgen_cli_run::union_with_padding ... FAILED

failures:

---- bindgen_cli_run::union_with_padding stdout ----
thread 'bindgen_cli_run::union_with_padding' panicked at 'bad status Out { stdout: "🔨 Rebuilding host...\n", stderr: "", status: ExitStatus(unix_wait_status(139)) }', bindgen/tests/test_bindgen_cli.rs:235:9
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace


failures:
    bindgen_cli_run::union_with_padding

test result: FAILED. 8 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 11.44s

error: test failed, to rerun pass '-p roc-bindgen --test test_bindgen_cli'

view this post on Zulip Richard Feldman (Jun 16 2022 at 19:49):

is that the only test out of all of cargo test that fails?

view this post on Zulip Richard Feldman (Jun 16 2022 at 19:49):

e.g. if you do cargo test --no-fail-fast do you see other failures too?

view this post on Zulip Hashi364 (Jun 16 2022 at 21:17):

This battery failed too:

running 37 tests
test cli_run::all_examples_have_tests ... ok
test cli_run::all_benchmarks_have_tests ... ok
test cli_run::base64 ... FAILED
test cli_run::astar ... FAILED
test cli_run::cfold ... FAILED
test cli_run::deriv ... FAILED
test cli_run::closure ... FAILED
test cli_run::cli ... ok
test cli_run::exposed_not_defined ... ok
test cli_run::effects ... FAILED
test cli_run::format_check_folders ... ok
test cli_run::fib ... FAILED
test cli_run::format_check_good ... ok
test cli_run::format_check_reformatting_needed ... ok
test cli_run::breakout ... ok
test cli_run::helloC ... ok
test cli_run::helloSwift ... ok
test cli_run::helloWeb ... ok
test cli_run::helloWorld ... ok
test cli_run::helloZig ... FAILED
test cli_run::issue2279 ... FAILED
test cli_run::known_type_error ... ok
test cli_run::nqueens ... FAILED
test cli_run::quicksort ... FAILED
test cli_run::quicksort_app ... ok
test cli_run::rbtree_ck ... FAILED
test cli_run::rbtree_insert ... FAILED
test cli_run::run_multi_dep_str_optimized ... FAILED
test cli_run::run_multi_dep_str_unoptimized ... FAILED
test cli_run::helloRust ... ok
test cli_run::run_multi_dep_thunk_optimized ... FAILED
test cli_run::run_multi_dep_thunk_unoptimized ... FAILED
test cli_run::unknown_generates_with ... ok
test cli_run::unused_import ... ok
test cli_run::tui ... FAILED
test cli_run::false_interpreter has been running for over 60 seconds
test cli_run::gui has been running for over 60 seconds
test cli_run::false_interpreter ... ok
test cli_run::gui ... ok

view this post on Zulip Hashi364 (Jun 16 2022 at 21:20):

Valgrind said something similar in may fails

valgrind stderr was: "
valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).
valgrind:
valgrind:  Cannot continue -- exiting now.  Sorry.

"', cli/tests/cli_run.rs:200:29

view this post on Zulip Anton (Jun 17 2022 at 10:02):

I was able to reproduce these issues on my archlinux VM. I'll look into solving them in the coming days.

view this post on Zulip Folkert de Vries (Jun 17 2022 at 11:37):

does the fix suggested by valgrind work?

view this post on Zulip Anton (Jun 17 2022 at 11:48):

I haven't tried it yet

view this post on Zulip Maximilian E (Jun 17 2022 at 15:32):

It's been a while since I've built Roc from source and after upgrading zig & LLVM it seems to me that Roc should build, but I still get this error:

 Compiling roc_alias_analysis v0.1.0 (/mnt/d/dev/roc-lang/compiler/alias_analysis)
   Compiling roc_gen_dev v0.1.0 (/mnt/d/dev/roc-lang/compiler/gen_dev)
error[E0658]: use of unstable library feature 'available_parallelism'
    --> compiler/load_internal/src/file.rs:1276:19
     |
1276 |             match std::thread::available_parallelism().map(|v| v.get()) {
     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: see issue #74479 <https://github.com/rust-lang/rust/issues/74479> for more information

   Compiling roc_gen_llvm v0.1.0 (/mnt/d/dev/roc-lang/compiler/gen_llvm)
For more information about this error, try `rustc --explain E0658`.
error: could not compile `roc_load_internal` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed

Is this new or am I doing something wrong?

view this post on Zulip Anton (Jun 17 2022 at 15:38):

You may not be in the right rust version, we're on 1.60. What is the output of cargo --version?

view this post on Zulip Anton (Jun 17 2022 at 15:42):

We have a file called rust-toolchain.toml to prevent this automatically, but the error really does make it look like you're using an older rust version.

view this post on Zulip Maximilian E (Jun 17 2022 at 17:49):

I get this: cargo --version cargo 1.58.0 (f01b232bc 2022-01-19)
You're right, I'll need to upgrade rust too, thanks!

view this post on Zulip Anton (Jun 21 2022 at 17:48):

@Hashi364 sudo pacman -Syu debuginfod should fix all the valgrind errors. I'll make an issue for the union_without_padding error, I'm probably not the best person to fix that one :sweat_smile:

view this post on Zulip Hashi364 (Jun 21 2022 at 21:55):

Installing debuginfod didn't fix valgrind errors, shouldn't I put it in flakes.nix or something like it?

view this post on Zulip Anton (Jun 22 2022 at 08:19):

Hmm, no, it can't go in nix flakes, there is no nix package for debuginfod.
I executed sudo pacman -Syu debuginfod after nix develop, not sure if it would make a difference but can you try it like that?

view this post on Zulip Anton (Jun 22 2022 at 09:47):

If that does not work, I'd also try adding DEBUGINFOD_URLS="https://debuginfod.archlinux.org/"below LLVM_SYS_130_PREFIX = ... in flake.nix (exit from the nix shell if you already did nix develop) and run nix develop again.

view this post on Zulip Hashi364 (Jun 22 2022 at 10:47):

Oh, after nix develop, I'll try it

view this post on Zulip Hashi364 (Jun 22 2022 at 11:04):

It worked, now only bindgen_cli_run::union_with_padding

view this post on Zulip Anton (Jun 22 2022 at 11:19):

Awesome :tada: thanks for your patience :)

view this post on Zulip Richard Feldman (Jun 22 2022 at 11:59):

interestingly, we recently got a CI failure that I can't explain for union_without_padding (so, similar but not quite the same test) after a code change that should be totally unrelated:

https://github.com/rtfeldman/roc/runs/6992258439?check_suite_focus=true

view this post on Zulip Richard Feldman (Jun 22 2022 at 11:59):

I can't reproduce it locally on my M1, but I re-ran out on CI and it failed again


Last updated: Jul 06 2025 at 12:14 UTC