Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

[Windows]: Cannot open linker script file linkall.x due to umlauts in project path #124

Closed
oleid opened this issue Nov 5, 2023 · 4 comments

Comments

@oleid
Copy link

oleid commented Nov 5, 2023

Dear all,

I'm trying to build a hello world project derived from this template on Windows 10 in a MSVC environment.
It was set up the following way:

  1. Install rustup-msvc via scoop
  2. Install microsoft command line compiler (like the scoop package suggested)
  3. Install nightly rust via rustup
  4. Install espup and cargo-generate via cargo
  5. Run espup install according to documentation

After that I generated the project for esp32 via this git repo

cargo build compiles everything but linking fails with:

rustc linker call Running `C:\Users\Olaf\scoop\persist\rustup-msvc\.rustup\toolchains\esp\bin\rustc.exe --crate-name esp32_test --edition=2021 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=80f34878350df424 -C extra-filename=-80f34878350df424 --out-dir C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps --target xtensa-esp32-none-elf -C incremental=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\incremental -L dependency=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps -L dependency=C:\Users\Olaf\src\esp32-test\target\debug\deps --extern noprelude:alloc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\liballoc-b83b4f40532317de.rlib --extern noprelude:compiler_builtins=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libcompiler_builtins-a6abaaf812b88ac3.rlib --extern noprelude:core=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libcore-20cc3db7174822c3.rlib --extern embedded_io=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libembedded_io-a11d11f01d50d33e.rlib --extern embedded_svc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libembedded_svc-638243c65551179d.rlib --extern esp_alloc=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_alloc-7a18a8bc1e9c1a16.rlib --extern esp_backtrace=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_backtrace-ad8b19c56c9384b2.rlib --extern esp_println=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_println-e2b09142032fb05f.rlib --extern esp_wifi=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp_wifi-59cc4053dbb9d2cc.rlib --extern hal=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libesp32_hal-bb25ebe35e864c4e.rlib --extern heapless=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libheapless-fbbf0ee7ccf78ebd.rlib --extern log=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\liblog-7afd8e7f1ada38de.rlib --extern smoltcp=C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\deps\libsmoltcp-5337ec9fc4f58151.rlib -Z unstable-options -C link-arg=-Tlinkall.x -C link-arg=-Trom_functions.x -C link-arg=-nostartfiles -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp-wifi-sys-8b20ad09368be88d\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp32-hal-c193d42e30ee7e61\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp-hal-common-0291b71a3c0a8705\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\esp32-8425ed446dd1dfa3\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\xtensa-lx-833d551610d3c712\out -L C:\Users\Olaf\src\esp32-test\target\xtensa-esp32-none-elf\debug\build\xtensa-lx-rt-fad6f9f2fe77c11b\out`
Even longer linker command line "xtensa-esp32-elf-gcc" "C:\\Users\\Olaf\\AppData\\Local\\Temp\\rustcy77nHW\\symbols.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.18tft40bkky3iiop.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1fgztwd7z7jcd4lr.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1fqaim87q0kcvj7s.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1nigjorlzph3r68y.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.1penbsf3b7kqg1pc.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.21o0qworany5ct1f.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.24gk3itw4xg74r3u.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.2q6d0ky4c2i5orx1.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.38zelovied0ywvl1.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.39dm23rbfuqmtf7r.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3f9vhxgm8ev4omgq.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3ptdszurxm48lj40.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3qyxlqnu8z3pxf4n.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3ti4n95b2qmwz11d.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.3tuea10dal372xyo.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4ba05rh2g7jfroe3.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4szdyytrqp4db85e.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.4wgebc7bzz9qqh9q.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.clyqcs93aridhmz.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.eymduzyo3x0vuha.rcgu.o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424.92mwa8moj4bd976.rcgu.o" "-Wl,--as-needed" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\debug\\deps" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp-wifi-sys-8b20ad09368be88d\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp32-hal-c193d42e30ee7e61\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp-hal-common-0291b71a3c0a8705\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\esp32-8425ed446dd1dfa3\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\xtensa-lx-833d551610d3c712\\out" "-L" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\build\\xtensa-lx-rt-fad6f9f2fe77c11b\\out" "-L" "C:\\Users\\Olaf\\scoop\\persist\\rustup-msvc\\.rustup\\toolchains\\esp\\lib\\rustlib\\xtensa-esp32-none-elf\\lib" "-Wl,-Bstatic" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_alloc-7a18a8bc1e9c1a16.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_wifi-59cc4053dbb9d2cc.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblibm-f412bec360b75524.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_io-a11d11f01d50d33e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libsmoltcp-5337ec9fc4f58151.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitflags-66545340898b2d28.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libmanaged-dc60188699462cce.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_svc-21c8b1364dba3891.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libserde-4145623200dd1b1c.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libno_std_net-83ae1e246a640dac.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnum_traits-1f9e676721e6f32c.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libenumset-b49843d5d6158ccb.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libatomic_polyfill-fa4e9b7df58a1ce0.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libheapless-fbbf0ee7ccf78ebd.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libhash32-d6b6dbbc5b01d8d8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbyteorder-3661cda5f6a44287.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_wifi_sys-7a9cb2427d51760e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblinked_list_allocator-e93d1b24a44fd233.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp32_hal-bb25ebe35e864c4e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_hal_common-5c15ec5f8e1eb5d6.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_io-4f6b867de79caaa6.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitfield-990d0c2feb7c831a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbitflags-1b410470f2224139.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcfg_if-0fd6a78eafaec43f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp32-782f40482039ea4e.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libvcell-43d36fccaf7fce4b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libstrum-83eaea363fd9d9a7.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_dma-75f15787eb784440.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libstable_deref_trait-fce22da1ffb4221b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libfugit-364d17a013a80da8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libgcd-246ec4dd56afd450.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libembedded_hal-65a9dc812ffdb2a9.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libvoid-ff355308b5083ba0.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnb-afce8c51d908ad8f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libnb-d89384f43eeb6de9.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libxtensa_lx_rt-d143951759fd978a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libr0-555c4527a92e0245.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libxtensa_lx-a7e54df6f2b1e2e8.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libspin-45bb07b6a0bf98ee.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblock_api-3124799a0c2bccdd.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libscopeguard-a8613ba8f311444a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libmutex_trait-8c3d9a55f00eb843.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libbare_metal-efa2b4ae0af6b56a.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_backtrace-ad8b19c56c9384b2.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libesp_println-e2b09142032fb05f.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcritical_section-15cfe0f4c5987ae5.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liblog-7afd8e7f1ada38de.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\liballoc-b83b4f40532317de.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\librustc_std_workspace_core-d5887c39b006917b.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcore-20cc3db7174822c3.rlib" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\libcompiler_builtins-a6abaaf812b88ac3.rlib" "-Wl,-Bdynamic" "-lbtdm_app" "-lcoexist" "-lcore" "-lespnow" "-lmesh" "-lnet80211" "-lphy" "-lpp" "-lrtc" "-lsmartconfig" "-lwapi" "-lwpa_supplicant" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "C:\\Users\\Olaf\\scoop\\persist\\rustup-msvc\\.rustup\\toolchains\\esp\\lib\\rustlib\\xtensa-esp32-none-elf\\lib" "-o" "C:\\Users\\Olaf\\src\\\esp32-test\\target\\xtensa-esp32-none-elf\\debug\\deps\\esp32_test-80f34878350df424" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "-Tlinkall.x" "-Trom_functions.x" "-nostartfiles"
C:\Users\Olaf\scoop\persist\rustup-msvc\.rustup\toolchains\esp\xtensa-esp-elf\esp-13.2.0_20230928\xtensa-esp-elf\bin/xtensa-esp-elf-ld.exe: 
          cannot open linker script file linkall.x: No such file or directory
          collect2.exe: error: ld returned 1 exit status

EDIT: It would appear that there is a linkall.x in cargo's crate registry below esp32-hal-0.16.0/ld/.
But that folder is not among the linker search directories.

Any idea what might be wrong here or any pointers how to debug this?

Thanks a lot,
Olaf

@SergioGasquez
Copy link
Member

I would recommend trying to install Rust from the official website, as using package managers sometimes gives some troubles. If you are targeting an esp32, which is Xtensa based, you don't need nightly toolchain. See https://esp-rs.github.io/book/installation/riscv-and-xtensa.html

@oleid
Copy link
Author

oleid commented Nov 6, 2023

I would recommend trying to install Rust from the official website, as using package managers sometimes gives some troubles. If you are targeting an esp32, which is Xtensa based, you don't need nightly toolchain. See https://esp-rs.github.io/book/installation/riscv-and-xtensa.html

Okay, I tried that. I

  • uninstalled rustup-msvc via scoop and deleted any remaining folder
  • Installed rustup and rust-stable via official sources
  • Installed espup and ran espup install
  • Cleaned the existing build and ran cargo build.

Sadly, it doesn't change anything:

  = note: C:/Users/Olaf/.rustup/toolchains/esp/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld.exe: 
cannot open linker script file linkall.x: No such file or directory
          collect2.exe: error: ld returned 1 exit status

@oleid
Copy link
Author

oleid commented Nov 6, 2023

Ah, I got it! Once I realized that the linker script got copied by esp32-hal's build script to the target out folder, I noticed that folder containing the rust project included an umlaut! Apparently gcc somehow doesn't like a path containing umlauts on windows (doh!).

It might be possible that this is an windows powershell encoding issue like here:
https://www.reddit.com/r/rust/comments/we4y3p/why_utf8_characters_get_broken_when_piped_in/

I think I'm going back to Linux ;)

So should we document somewhere?

@SergioGasquez SergioGasquez changed the title Cannot open linker script file linkall.x [Windows]: Cannot open linker script file linkall.x due to umlauts in project path Nov 7, 2023
@SergioGasquez
Copy link
Member

Oh! Glad you found the issue, thanks for sharing the solution, just updated the title so any users that looks for the error can check the solution! Thanks again for the feedback!

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants