rust_bof icon indicating copy to clipboard operation
rust_bof copied to clipboard

Build fails on 1.66 nightly (Linux)

Open sempervictus opened this issue 2 years ago • 13 comments

Builds in Linux seem to require -Zbuild-std which in turn appears to break the linker script:

[cargo-make] INFO - Running Task: generate-linker-script
[cargo-make] INFO - Execute Command: "cargo" "build" "-p" "rustbof" "--target" "i686-pc-windows-gnu" "--release" "-Zbuild-std"
  Downloaded unicode-width v0.1.10
  Downloaded compiler_builtins v0.1.79
  Downloaded libc v0.2.131
  Downloaded 3 crates (779.4 KB) in 0.30s
   Compiling compiler_builtins v0.1.79
   Compiling core v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.131
   Compiling cc v1.0.73
   Compiling std v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling windows_i686_gnu v0.33.0
   Compiling paste v1.0.9
   Compiling unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling rustc-std-workspace-core v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling cfg-if v1.0.0
   Compiling rustc-demangle v0.1.21
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
   Compiling std_detect v0.1.5 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling hashbrown v0.12.3
   Compiling proc_macro v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro)
   Compiling windows-sys v0.33.0
   Compiling bofhelper v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofhelper)
   Compiling bofalloc v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofalloc)
   Compiling bofentry v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofentry)
   Compiling rustbof v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/rustbof)
    Finished release [optimized] target(s) in 16.62s
[cargo-make] INFO - Running Task: combine-objs
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x894): multiple definition of `__rdl_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8a3): first defined here
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x89b): multiple definition of `__rg_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8aa): first defined here
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0xa): multiple definition of `__rust_alloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x28): first defined here
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x29): multiple definition of `__rust_dealloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x47): first defined here
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x48): multiple definition of `__rust_realloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x66): first defined here
...
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1d8eb): multiple definition of `rust_begin_unwind'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19c31): first defined here
i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1dc87): multiple definition of `rust_panic'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19fc3): first defined here
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

Build environment is Arch, MinGW 12.2.

sempervictus avatar Oct 03 '22 02:10 sempervictus

There's nearly a 100% chance this won't work on the latest cobalt strike and I don't have a newer copy to test against. That being said, you need to install std for both targets via rustup target install

If that doesn't work then 🤷

-w

On Sun, Oct 2, 2022, 10:32 PM RageLtMan @.***> wrote:

Builds in Linux seem to require -Zbuild-std which in turn appears to break the linker script:

[cargo-make] INFO - Running Task: generate-linker-script[cargo-make] INFO - Execute Command: "cargo" "build" "-p" "rustbof" "--target" "i686-pc-windows-gnu" "--release" "-Zbuild-std" Downloaded unicode-width v0.1.10 Downloaded compiler_builtins v0.1.79 Downloaded libc v0.2.131 Downloaded 3 crates (779.4 KB) in 0.30s Compiling compiler_builtins v0.1.79 Compiling core v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core) Compiling libc v0.2.131 Compiling cc v1.0.73 Compiling std v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std) Compiling windows_i686_gnu v0.33.0 Compiling paste v1.0.9 Compiling unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind) Compiling rustc-std-workspace-core v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core) Compiling alloc v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc) Compiling cfg-if v0.1.10 Compiling cfg-if v1.0.0 Compiling rustc-demangle v0.1.21 Compiling rustc-std-workspace-alloc v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc) Compiling panic_abort v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort) Compiling panic_unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind) Compiling std_detect v0.1.5 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect) Compiling hashbrown v0.12.3 Compiling proc_macro v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro) Compiling windows-sys v0.33.0 Compiling bofhelper v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofhelper) Compiling bofalloc v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofalloc) Compiling bofentry v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofentry) Compiling rustbof v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/rustbof) Finished release [optimized] target(s) in 16.62s[cargo-make] INFO - Running Task: combine-objs i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x894): multiple definition of __rdl_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8a3): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x89b): multiple definition of __rg_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8aa): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0xa): multiple definition of __rust_alloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x28): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x29): multiple definition of __rust_dealloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x47): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x48): multiple definition of __rust_realloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x66): first defined here ... i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1d8eb): multiple definition of rust_begin_unwind'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19c31): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1dc87): multiple definition of `rust_panic'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19fc3): first defined here[cargo-make] ERROR - Error while executing command, exit code: 1[cargo-make] WARN - Build Failed.

Build environment is Arch, MinGW 12.2.

— Reply to this email directly, view it on GitHub https://github.com/wumb0/rust_bof/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHV3W44WMXHZTSKOUYDOQLWBJAUBANCNFSM6AAAAAAQ3FY7LU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wumb0 avatar Oct 03 '22 10:10 wumb0

Actually, I re-read this. You're trying to include std, which is not supported. This only supports core and alloc. Try -Zbuild-std=core if you're going to try to use build-std at all, but I'm not even sure that will work.

-j

On Mon, Oct 3, 2022 at 6:20 AM Jaime Geiger @.***> wrote:

There's nearly a 100% chance this won't work on the latest cobalt strike and I don't have a newer copy to test against. That being said, you need to install std for both targets via rustup target install

If that doesn't work then 🤷

-w

On Sun, Oct 2, 2022, 10:32 PM RageLtMan @.***> wrote:

Builds in Linux seem to require -Zbuild-std which in turn appears to break the linker script:

[cargo-make] INFO - Running Task: generate-linker-script[cargo-make] INFO - Execute Command: "cargo" "build" "-p" "rustbof" "--target" "i686-pc-windows-gnu" "--release" "-Zbuild-std" Downloaded unicode-width v0.1.10 Downloaded compiler_builtins v0.1.79 Downloaded libc v0.2.131 Downloaded 3 crates (779.4 KB) in 0.30s Compiling compiler_builtins v0.1.79 Compiling core v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core) Compiling libc v0.2.131 Compiling cc v1.0.73 Compiling std v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std) Compiling windows_i686_gnu v0.33.0 Compiling paste v1.0.9 Compiling unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind) Compiling rustc-std-workspace-core v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core) Compiling alloc v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc) Compiling cfg-if v0.1.10 Compiling cfg-if v1.0.0 Compiling rustc-demangle v0.1.21 Compiling rustc-std-workspace-alloc v1.99.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc) Compiling panic_abort v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort) Compiling panic_unwind v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind) Compiling std_detect v0.1.5 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect) Compiling hashbrown v0.12.3 Compiling proc_macro v0.0.0 (/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro) Compiling windows-sys v0.33.0 Compiling bofhelper v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofhelper) Compiling bofalloc v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofalloc) Compiling bofentry v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/libs/bofentry) Compiling rustbof v0.1.0 (/opt/code/CPP/Cobalt/rust_bof/rustbof) Finished release [optimized] target(s) in 16.62s[cargo-make] INFO - Running Task: combine-objs i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x894): multiple definition of __rdl_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8a3): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/alloc-c1376b3f5d68bdf1.o:alloc.982fc090-cgu:(.text+0x89b): multiple definition of __rg_oom'; target/i686-pc-windows-gnu/release/deps/alloc-74afa7004456a0da.o:alloc.0a9fc5a7-cgu:(.text+0x8aa): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0xa): multiple definition of __rust_alloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x28): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x29): multiple definition of __rust_dealloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x47): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/bofalloc-98ec48f3d7d861fd.o:bofalloc.2293be5f-:(.text+0x48): multiple definition of __rust_realloc'; target/i686-pc-windows-gnu/release/deps/bofalloc-3814d15b5ff5eacd.o:bofalloc.95ebbabd-:(.text+0x66): first defined here ... i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1d8eb): multiple definition of rust_begin_unwind'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19c31): first defined here i686-w64-mingw32-ld: target/i686-pc-windows-gnu/release/deps/std-9e8e3aeab9a462de.o:std.f1feb203-cgu.0:(.text+0x1dc87): multiple definition of `rust_panic'; target/i686-pc-windows-gnu/release/deps/std-44868e07d57d2f0e.o:std.3d4f0bca-cgu.0:(.text+0x19fc3): first defined here[cargo-make] ERROR - Error while executing command, exit code: 1[cargo-make] WARN - Build Failed.

Build environment is Arch, MinGW 12.2.

— Reply to this email directly, view it on GitHub https://github.com/wumb0/rust_bof/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHV3W44WMXHZTSKOUYDOQLWBJAUBANCNFSM6AAAAAAQ3FY7LU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wumb0 avatar Oct 03 '22 21:10 wumb0

Thanks, and i'm by no means a CS person :). I'm from the MSF world, and we can run beacons in meterpreter now. Will try that this evening. Thank you

sempervictus avatar Oct 04 '22 00:10 sempervictus

No such luck:

$ cargo +nightly make
[cargo-make] INFO - cargo make 0.36.1
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: generate-linker-script
[cargo-make] INFO - Execute Command: "cargo" "build" "-p" "rustbof" "--target" "i686-pc-windows-gnu" "--release" "-Zbuild-std=core"
   Compiling windows_i686_gnu v0.33.0
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not support the standard library
  = note: `std` is required by `windows_i686_gnu` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `windows_i686_gnu` due to previous error
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

same without trying to build it at all:

$ cargo +nightly make
[cargo-make] INFO - cargo make 0.36.1
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: default
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: generate-linker-script
[cargo-make] INFO - Execute Command: "cargo" "build" "-p" "rustbof" "--target" "i686-pc-windows-gnu" "--release"
   Compiling windows_i686_gnu v0.33.0
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not support the standard library
  = note: `std` is required by `windows_i686_gnu` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `windows_i686_gnu` due to previous error
[cargo-make] ERROR - Error while executing command, exit code: 101
[cargo-make] WARN - Build Failed.

sempervictus avatar Oct 04 '22 01:10 sempervictus

Build fails from master with the latest nightly toolchains, and even when using rustc version 1.61 installing the nightly-2022-03-01 toolchains which are the latest ones from the last commit. I've spent the past 3-4 hours trying to get this to compile, thinking it might be something I missed (well, probably). But I figured out that when using cargo make it shows that windows-sys (the library used for the windows bindings, doesn't support no_std which is quite confusing since this project uses no_std. When compiled directly using cargo build -Zbuild-std all object files get compiled successfully, however the build tasks in the make file don't get ran (obviously.)

image

In this screenshot, the first try is using cargo make, windows_x86_64_gnu doesn't compile due to the no no_std support. however, on the second try, using directly the cargo command it does successfully compile.

I'm very much confused.

b1scoito avatar Feb 23 '23 08:02 b1scoito

Ok. Apparently cargo make looks for a Makefile.toml (with an uppercase letter "M") and the file on the directory is makefile.toml so I had to specify the makefile like so: cargo make --makefile makefile.toml, after that, everything compiled. But I got another error, multiple definitions on ld, by adding the argument --allow-multiple-definition to the ld command on the makefile, it won't report those errors as fatal, and will just ignore them. With this, I was able to successfully compile everything.

b1scoito avatar Feb 23 '23 09:02 b1scoito

Well, adding --allow-multiple-definition did not seem like the solution (and it seems a pretty bad idea too), COFFLoader doesn't run the generated BOFs, any ideas on what might be happening here?

image

b1scoito avatar Feb 23 '23 09:02 b1scoito

Make sure to run cargo clean before building it. It looks like the .o for the stdlib is still hanging out in deps as well as some other potentially conflicting deps. Let me now if that changes anything. Thanks for using the project, I hope you can get it working.

On Thu, Feb 23, 2023 at 4:39 AM biscoito @.***> wrote:

Well, adding --allow-multiple-definition did not seem like the solution (and it seems a pretty bad idea too), COFFLoader doesn't run the generated BOFs, any ideas on what might be happening here?

[image: image] https://user-images.githubusercontent.com/17802984/220870518-5aeb6b69-f168-47a4-bf67-b411bb36a2ed.png

— Reply to this email directly, view it on GitHub https://github.com/wumb0/rust_bof/issues/1#issuecomment-1441453560, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHV3W52N4KD3BJGFZ6C4NLWY4V6HANCNFSM6AAAAAAQ3FY7LU . You are receiving this because you commented.Message ID: @.***>

wumb0 avatar Feb 23 '23 12:02 wumb0

Still gives me the same errors on combine-objs after cargo make --makefile makefile.toml clean and cargo clean.

.o files for stdlib are present because otherwise it wouldn't compile, as windows-sys doesn't support no_std apparently, I had to append -Zbuild-std on the build task for it to compile. That's so weird.

When it's ran on a newly-installed toolchain, it'll show this error: image

b1scoito avatar Feb 23 '23 19:02 b1scoito

Ok. I managed to successfully compile everything on latest rust version and latest windows-sys version.

I'm using this Dockerfile for compilation on Windows:

FROM rust:latest

WORKDIR /app

RUN apt update; apt upgrade -y 
RUN apt install -y g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-i686 gcc-mingw-w64-i686

RUN rustup toolchain install nightly-x86_64-unknown-linux-gnu
RUN rustup toolchain install nightly-x86_64-pc-windows-gnu
RUN rustup toolchain install nightly-i686-pc-windows-gnu
RUN rustup default nightly

RUN cargo install cargo-make

CMD ["cargo", "make", "--makefile", "makefile.toml"]

Running with: docker run --rm -v ...\dev\rust_bof:/app rust_cross_compile/windowscustom

And added these lines to the makefile.toml:

[tasks.build]
toolchain = "nightly"
install_crate = { rustup_component_name = "rust-src" }

The fix for the no_std build was upgrading the windows-sys version to latest, which apparently supports no_std fully.

Can I PR those changes?

b1scoito avatar Feb 23 '23 20:02 b1scoito

PR welcome, sure. See if you can change the case of the makefile, too. Thanks!

On Thu, Feb 23, 2023 at 3:59 PM biscoito @.***> wrote:

Ok. I managed to successfully compile everything on latest rust version.

I'm using this Dockerfile for compilation on Windows:

FROM rust:latest WORKDIR /app RUN apt update; apt upgrade -y RUN apt install -y g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-i686 gcc-mingw-w64-i686 RUN rustup toolchain install nightly-x86_64-unknown-linux-gnuRUN rustup toolchain install nightly-x86_64-pc-windows-gnuRUN rustup toolchain install nightly-i686-pc-windows-gnuRUN rustup default nightly RUN cargo install cargo-make CMD ["cargo", "make", "--makefile", "makefile.toml"]

Running with: docker run --rm -v ...\dev\rust_bof:/app rust_cross_compile/windowscustom

And added these lines to the makefile.toml:

[tasks.build]toolchain = "nightly"install_crate = { rustup_component_name = "rust-src" }

The fix for the no_std build was upgrading the windows-sys version to latest, which apparently supports no_std fully.

Can I PR those changes?

— Reply to this email directly, view it on GitHub https://github.com/wumb0/rust_bof/issues/1#issuecomment-1442422794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHV3W3SAV6DCCMEF36KRL3WY7FRLANCNFSM6AAAAAAQ3FY7LU . You are receiving this because you commented.Message ID: @.***>

wumb0 avatar Feb 24 '23 14:02 wumb0

PR Created: #2 I commited the makefile with the uppercase letter M but it doesn't appear to have worked, strange.

b1scoito avatar Feb 25 '23 04:02 b1scoito

Awesome, will review and approve soon. Thank you for your patience and help.

-J

On Fri, Feb 24, 2023, 11:27 PM biscoito @.***> wrote:

PR Created: #2 https://github.com/wumb0/rust_bof/pull/2

— Reply to this email directly, view it on GitHub https://github.com/wumb0/rust_bof/issues/1#issuecomment-1444987367, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHV3WZMADZSWWZ5HRDABTDWZGC2JANCNFSM6AAAAAAQ3FY7LU . You are receiving this because you commented.Message ID: @.***>

wumb0 avatar Feb 25 '23 13:02 wumb0