rust-embedded / book

Documentation on how to use the Rust Programming Language to develop firmware for bare metal (microcontroller) devices
https://docs.rust-embedded.org/book/
Apache License 2.0
1.08k stars 173 forks source link

linking failed when using own svd2rust library #349

Closed egvhauwa closed 1 year ago

egvhauwa commented 1 year ago

I get the error below when I use my svd2rust library. When I remove the code that uses the library, the code compiles.

Repository: https://github.com/egvhauwa/intro-led-rust

error: linking with rust-lld failed: exit code: 1 | = note: "rust-lld" "-flavor" "gnu" "C:\Users\ENZOVA~1.DEK\AppData\Local\Temp\rustc7SKy0Z\symbols.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.107qidsb87net2ym.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.166hd22af1lea91j.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.222knjjgyxzhdgd2.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.2h7hh70zypks6bs7.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.3dhhc93hclabga48.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.3q1g227s53qq6dth.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.4xeydgrnd51ldco0.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.52d1d4fugdtdy9bi.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.56mwbtae2zb67jej.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.56qxprl49vdkwtpy.rcgu.o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.jrtbjs75ua3t6k9.rcgu.o" "--as-needed" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\debug\deps" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\build\intro-led-rust-8b331882248a7490\out" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\build\cortex-m-9a4c8a745d9efe17\out" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\build\cortex-m-rt-cf5715289b40348f\out" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\build\cortex-m-semihosting-4da40dbbe8ee0732\out" "-L" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\build\mk02f12810-ce3a462be28b1f32\out" "-L" "C:\Users\enzo.vanhauwaert.DEKIMO\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\thumbv7em-none-eabihf\lib" "-Bstatic" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libmk02f12810-363f6f57523e53ba.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libcritical_section-75c8aa882143c662.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libcortex_m_semihosting-8b55e7515a96ba59.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libcortex_m_rt-e825a2285b31facf.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libr0-5a8f8d4c1f6528ae.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libcortex_m-86295d6203a00936.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libcortex_m-260591e45b952f4b.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libembedded_hal-6d453b45213d361f.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libvoid-dd5a813dc78d4354.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libnb-998521fdd48422d9.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libnb-d3afa22d5c73078a.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libvolatile_register-7a95cb05e9411535.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libvcell-4f0e04583a475f8d.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libbare_metal-7d15a59517178156.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libaligned-db532be6a8f2b822.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libas_slice-b8cf36af4b412cd4.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libstable_deref_trait-20d6c991d0dc1874.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libgeneric_array-a62cbc679da0a551.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libgeneric_array-d51015ddae162c9e.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libgeneric_array-e3f90a260701731c.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libtypenum-33973e7468cf3846.rlib" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\libpanic_halt-e829a3e41b1876bd.rlib" "C:\Users\enzo.vanhauwaert.DEKIMO\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\thumbv7em-none-eabihf\lib\librustc_std_workspace_core-9f38702c0acf8b26.rlib" "C:\Users\enzo.vanhauwaert.DEKIMO\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\thumbv7em-none-eabihf\lib\libcore-0d33aac1a85e495f.rlib" "C:\Users\enzo.vanhauwaert.DEKIMO\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\thumbv7em-none-eabihf\lib\libcompiler_builtins-16cc2a5f3bf3857d.rlib" "-Bdynamic" "--eh-frame-hdr" "-z" "noexecstack" "-L" "C:\Users\enzo.vanhauwaert.DEKIMO\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\thumbv7em-none-eabihf\lib" "-o" "C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f" "--gc-sections" "--nmagic" "-Tlink.x" = note: rust-lld: warning: section type mismatch for .got

:(.got): SHT_PROGBITS output section .got: SHT_NOBITS
      rust-lld: warning: section type mismatch for .got.plt
      >>> <internal>:(.got.plt): SHT_PROGBITS
      >>> output section .got: SHT_NOBITS

      rust-lld: warning: section type mismatch for .got
      >>> <internal>:(.got): SHT_PROGBITS
      >>> output section .got: SHT_NOBITS

      rust-lld: error: undefined symbol: _critical_section_1_0_acquire
      >>> referenced by lib.rs:180 (C:\Users\enzo.vanhauwaert.DEKIMO\.cargo\registry\src\github.com-1ecc6299db9ec823\critical-section-1.1.1\src/lib.rs:180)
      >>>               C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.56mwbtae2zb67jej.rcgu.o:(critical_section::with::h7653414f0f66dd48)

      rust-lld: error: undefined symbol: _critical_section_1_0_release
      >>> referenced by lib.rs:197 (C:\Users\enzo.vanhauwaert.DEKIMO\.cargo\registry\src\github.com-1ecc6299db9ec823\critical-section-1.1.1\src/lib.rs:197)
      >>>               C:\Projects\introductie_ledsturing_rust\intro-led-rust\target\thumbv7em-none-eabihf\debug\deps\intro_led_rust-178ee085e432991f.jrtbjs75ua3t6k9.rcgu.o:(core::ptr::drop_in_place$LT$critical_section..with..Guard$GT$::hf6db5a9fad5e3eed)

error: could not compile intro-led-rust due to previous error