-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build fails on 1.66 nightly (Linux) #1
Comments
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
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHV3W44WMXHZTSKOUYDOQLWBJAUBANCNFSM6AAAAAAQ3FY7LU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
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
> <#1>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABHV3W44WMXHZTSKOUYDOQLWBJAUBANCNFSM6AAAAAAQ3FY7LU>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
Thanks, and i'm by no means a CS person :). I'm from the MSF world, and we can run beacons in meterpreter now. |
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. |
Build fails from In this screenshot, the first try is using I'm very much confused. |
Ok. Apparently |
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
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHV3W52N4KD3BJGFZ6C4NLWY4V6HANCNFSM6AAAAAAQ3FY7LU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Ok. I managed to successfully compile everything on latest rust version and latest 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: And added these lines to the [tasks.build]
toolchain = "nightly"
install_crate = { rustup_component_name = "rust-src" } The fix for the Can I PR those changes? |
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
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHV3W3SAV6DCCMEF36KRL3WY7FRLANCNFSM6AAAAAAQ3FY7LU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
PR Created: #2 |
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 <#2>
—
Reply to this email directly, view it on GitHub
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHV3WZMADZSWWZ5HRDABTDWZGC2JANCNFSM6AAAAAAQ3FY7LU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Builds in Linux seem to require
-Zbuild-std
which in turn appears to break the linker script:Build environment is Arch, MinGW 12.2.
The text was updated successfully, but these errors were encountered: