From 1a1aa07019145de16833327be8c5afa855c18135 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 16 May 2024 15:44:25 +0800 Subject: [PATCH] remove cargo-xbuild, fix nix build --- artiq/firmware/Cargo.lock | 229 +++++++++++++++++++++++++-- artiq/firmware/bootloader/Cargo.toml | 19 ++- artiq/firmware/bootloader/Makefile | 2 - artiq/firmware/ksupport/Makefile | 2 - artiq/firmware/libboard_misoc/lib.rs | 1 + artiq/firmware/libeh/Cargo.toml | 3 +- artiq/firmware/runtime/Cargo.toml | 2 +- artiq/firmware/runtime/Makefile | 2 - artiq/firmware/satman/Makefile | 2 - flake.nix | 7 - 10 files changed, 233 insertions(+), 36 deletions(-) diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index f4bd9b88a..01d482c21 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -1,10 +1,42 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] -name = "aho-corasick" -version = "0.7.18" +name = "addr2line" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli", + "object", + "rustc-demangle", + "smallvec", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289" + +[[package]] +name = "aho-corasick" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -24,9 +56,9 @@ dependencies = [ [[package]] name = "bit_field" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" @@ -66,12 +98,26 @@ dependencies = [ name = "bootloader" version = "0.0.0" dependencies = [ + "addr2line", "board_misoc", "build_misoc", "byteorder", + "cc", + "compiler_builtins", "crc", + "dlmalloc", + "fortanix-sgx-abi", + "getopts", + "hashbrown", + "hermit-abi", + "libc 0.2.79", + "memchr", + "miniz_oxide 0.4.0", "riscv", + "rustc-demangle", "smoltcp", + "unicode-width", + "wasi", ] [[package]] @@ -92,9 +138,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.70" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" [[package]] name = "cfg-if" @@ -114,6 +160,15 @@ version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3748f82c7d366a0b4950257d19db685d4958d2fa27c6d164a3f069fec42b748b" +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "crc" version = "1.8.1" @@ -123,12 +178,30 @@ dependencies = [ "build_const", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "cslice" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f8cb7306107e4b10e64994de6d3274bd08996a7c1322a27b86482392f96be0a" +[[package]] +name = "dlmalloc" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332570860c2edf2d57914987bf9e24835425f75825086b6ba7d1e6a3e4f1f254" +dependencies = [ + "libc 0.2.79", +] + [[package]] name = "dyld" version = "0.0.0" @@ -137,7 +210,6 @@ version = "0.0.0" name = "eh" version = "0.0.0" dependencies = [ - "compiler_builtins", "cslice", "libc 0.1.0", "unwind", @@ -160,12 +232,71 @@ dependencies = [ "synstructure", ] +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "miniz_oxide 0.7.3", +] + +[[package]] +name = "fortanix-sgx-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56c422ef86062869b2d57ae87270608dc5929969dd130a6e248979cf4fb6ca6" + [[package]] name = "fringe" version = "1.2.1" source = "git+https://git.m-labs.hk/M-Labs/libfringe.git?rev=3ecbe5#3ecbe53f7644b18ee46ebd5b2ca12c9cbceec43a" dependencies = [ - "libc 0.2.101", + "libc 0.2.79", +] + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "gimli" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" +dependencies = [ + "fallible-iterator", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" +dependencies = [ + "ahash", +] + +[[package]] +name = "hermit-abi" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +dependencies = [ + "libc 0.2.79", ] [[package]] @@ -206,9 +337,9 @@ version = "0.1.0" [[package]] name = "libc" -version = "0.2.101" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" +checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" [[package]] name = "log" @@ -248,9 +379,37 @@ checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" [[package]] name = "memchr" -version = "2.4.1" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + +[[package]] +name = "miniz_oxide" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" +dependencies = [ + "adler 0.2.3", +] + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler 1.0.2", +] + +[[package]] +name = "object" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +dependencies = [ + "flate2", + "wasmparser", +] [[package]] name = "proto_artiq" @@ -274,9 +433,9 @@ checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" [[package]] name = "regex" -version = "1.5.4" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "2a26af418b574bd56588335b3a3659a65725d4e636eb1016c2f9e3b38c7cc759" dependencies = [ "aho-corasick", "memchr", @@ -285,9 +444,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "riscv" @@ -335,6 +494,12 @@ dependencies = [ "unwind_backtrace", ] +[[package]] +name = "rustc-demangle" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232" + [[package]] name = "rustc_version" version = "0.2.3" @@ -372,6 +537,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "smoltcp" version = "0.8.2" @@ -383,6 +554,12 @@ dependencies = [ "managed 0.8.0", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "syn" version = "0.11.11" @@ -413,6 +590,12 @@ dependencies = [ "syn", ] +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + [[package]] name = "unicode-xid" version = "0.0.4" @@ -434,3 +617,15 @@ dependencies = [ "libc 0.1.0", "unwind", ] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasmparser" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6" diff --git a/artiq/firmware/bootloader/Cargo.toml b/artiq/firmware/bootloader/Cargo.toml index ac0df1001..58cf68e33 100644 --- a/artiq/firmware/bootloader/Cargo.toml +++ b/artiq/firmware/bootloader/Cargo.toml @@ -13,8 +13,25 @@ path = "main.rs" build_misoc = { path = "../libbuild_misoc" } [dependencies] -byteorder = { version = "1.0", default-features = false } +byteorder = { version = "=1.4.3", default-features = false } crc = { version = "1.7", default-features = false } board_misoc = { path = "../libboard_misoc", features = ["uart_console", "smoltcp"] } smoltcp = { version = "0.8.2", default-features = false, features = ["medium-ethernet", "proto-ipv4", "proto-ipv6", "socket-tcp"] } riscv = { version = "0.6.0", features = ["inline-asm"] } + +# insanity required by using cargo build-std over xbuild with nix +[dev-dependencies] +getopts = "=0.2.21" +libc = "=0.2.79" +unicode-width = "=0.1.8" +addr2line = "=0.14.0" +memchr = "=2.3.4" +hashbrown = "=0.9.0" +miniz_oxide = "=0.4.0" +rustc-demangle = "=0.1.18" +hermit-abi = "=0.1.17" +dlmalloc = "=0.2.1" +wasi = "=0.9.0" +fortanix-sgx-abi = "=0.3.3" +cc = "=1.0.60" +compiler_builtins = "=0.1.39" \ No newline at end of file diff --git a/artiq/firmware/bootloader/Makefile b/artiq/firmware/bootloader/Makefile index 82baef3eb..032f6df8c 100644 --- a/artiq/firmware/bootloader/Makefile +++ b/artiq/firmware/bootloader/Makefile @@ -3,8 +3,6 @@ include $(MISOC_DIRECTORY)/software/common.mak RUSTFLAGS += -Cpanic=abort -export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot - all:: bootloader.bin .PHONY: $(RUSTOUT)/libbootloader.a diff --git a/artiq/firmware/ksupport/Makefile b/artiq/firmware/ksupport/Makefile index 7a7e26d85..ff73b4b65 100644 --- a/artiq/firmware/ksupport/Makefile +++ b/artiq/firmware/ksupport/Makefile @@ -14,8 +14,6 @@ LDFLAGS += --eh-frame-hdr \ RUSTFLAGS += -Cpanic=unwind -export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot - all:: ksupport.elf .PHONY: $(RUSTOUT)/libksupport.a diff --git a/artiq/firmware/libboard_misoc/lib.rs b/artiq/firmware/libboard_misoc/lib.rs index 7ba835dcf..4374a44f9 100644 --- a/artiq/firmware/libboard_misoc/lib.rs +++ b/artiq/firmware/libboard_misoc/lib.rs @@ -1,5 +1,6 @@ #![no_std] #![feature(llvm_asm)] +#![feature(asm)] extern crate byteorder; #[cfg(feature = "log")] diff --git a/artiq/firmware/libeh/Cargo.toml b/artiq/firmware/libeh/Cargo.toml index 6998fcd35..3d6837df0 100644 --- a/artiq/firmware/libeh/Cargo.toml +++ b/artiq/firmware/libeh/Cargo.toml @@ -10,5 +10,4 @@ path = "lib.rs" [dependencies] cslice = { version = "0.3" } libc = { path = "../libc" } -unwind = { path = "../libunwind" } -compiler_builtins = "=0.1.39" # A dependency of alloc, libeh doesn't need it +unwind = { path = "../libunwind" } \ No newline at end of file diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index 16477707b..d0223a47c 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -17,7 +17,7 @@ failure = { version = "0.1", default-features = false } failure_derive = { version = "0.1", default-features = false } byteorder = { version = "1.0", default-features = false } cslice = { version = "0.3" } -log = { version = "0.4", default-features = false } +log = { version = "=0.4.14", default-features = false } managed = { version = "^0.7.1", default-features = false, features = ["alloc", "map"] } dyld = { path = "../libdyld" } eh = { path = "../libeh" } diff --git a/artiq/firmware/runtime/Makefile b/artiq/firmware/runtime/Makefile index 0427d763f..f7914e85d 100644 --- a/artiq/firmware/runtime/Makefile +++ b/artiq/firmware/runtime/Makefile @@ -10,8 +10,6 @@ LDFLAGS += \ RUSTFLAGS += -Cpanic=unwind -export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot - all:: runtime.bin runtime.fbi .PHONY: $(RUSTOUT)/libruntime.a diff --git a/artiq/firmware/satman/Makefile b/artiq/firmware/satman/Makefile index 82e65d730..41f1f961a 100644 --- a/artiq/firmware/satman/Makefile +++ b/artiq/firmware/satman/Makefile @@ -5,8 +5,6 @@ LDFLAGS += -L../libbase RUSTFLAGS += -Cpanic=abort -export XBUILD_SYSROOT_PATH=$(BUILDINC_DIRECTORY)/../sysroot - all:: satman.bin satman.fbi .PHONY: $(RUSTOUT)/libsatman.a diff --git a/flake.nix b/flake.nix index 9cd1ac889..9b3fd2c58 100644 --- a/flake.nix +++ b/flake.nix @@ -42,10 +42,6 @@ cargo = rust; }); - cargo-xbuild = pkgs.cargo-xbuild.overrideAttrs(oa: { - postPatch = "substituteInPlace src/sysroot.rs --replace 2021 2018"; - }); - vivadoDeps = pkgs: with pkgs; let # Apply patch from https://github.com/nix-community/nix-environments/pull/54 # to fix ncurses libtinfo.so's soname issue @@ -197,7 +193,6 @@ nativeBuildInputs = [ (pkgs.python3.withPackages(ps: [ migen misoc (artiq.withExperimentalFeatures experimentalFeatures) ps.packaging ])) rust - cargo-xbuild pkgs.llvmPackages_14.clang-unwrapped pkgs.llvm_14 pkgs.lld_14 @@ -372,7 +367,6 @@ buildInputs = [ (packages.x86_64-linux.python3-mimalloc.withPackages(ps: with packages.x86_64-linux; [ migen misoc ps.paramiko microscope ps.packaging ] ++ artiq.propagatedBuildInputs)) rust - cargo-xbuild pkgs.llvmPackages_14.clang-unwrapped pkgs.llvm_14 pkgs.lld_14 @@ -395,7 +389,6 @@ buildInputs = [ (pkgs.python3.withPackages(ps: with packages.x86_64-linux; [ migen misoc artiq ps.packaging ])) rust - cargo-xbuild pkgs.llvmPackages_14.clang-unwrapped pkgs.llvm_14 pkgs.lld_14