< 返回版块

liuxc0116 发表于 2021-08-31 11:36

下面是从可执行文件中截取的一段。里面包含大量的文件名和字符串。这些文件名占用很多空间。请问如何不让这个文件名编译到可执行文件中?

library/core/src/fmt/mod.rs^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^A^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^B^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^D^D^D^D^D^@^@^@^@^@^@^@^@^@^@^@attempted to index str up to maximum usizelibrary/core/src/str/pattern.rs^@library/core/src/str/lossy.rsassertion failed: broken.is_empty()EmptyParseIntErrorInvalidDigitPosOverflowNegOverflowUtf8Errorvalid_up_toerror_len.debug_str_offsets.debug_str.debug_rnglists.debug_ranges.debug_line_str.debug_line.debug_info.debug_addr.debug_abbrevassertion failed: src.len() == dst.len()assertion failed: edge.height == self.height - 1assertion failed: idx < CAPACITY/rustc/a15f484b918a4533ad633ea903ccce82910af342/library/alloc/src/collections/btree/node.rs/rustc/a15f484b918a4533ad633ea903ccce82910af342/library/alloc/src/collections/btree/map/entry.rs/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/gimli-0.23.0/src/read/abbrev.rsJimI am hello world
^@^@^@^@^@^@^@^@^@^@^@^@^@Invalid archive member headerInvalid archive terminatorInvalid archive member sizeArchive member size is too large^@^@^@Invalid archive extended name offsetInvalid archive extended name length::@*&<>(,/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.18/src/legacy.rs?[]::{closure#}, _-false...!f64f32usizeu64u32u16u8isizei64i32i16i8()str/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.18/src/v0.rs0x' const ; >  +  = Cunsafe " fn(punycode{.llvm.^@^@^@^@^@^@^@^@^@^@/Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.18/src/lib.rsAccessErroruse of std::thread::current() is not possible after the thread's local data has been destroyedalready mutably borrowedcalled `Option::unwrap()` on a `None` valuelibrary/std/src/sys_common/thread_info.rsthread name may not contain interior null bytesfailed to generate unique thread ID: bitspace exhausted^@^@^@»±°<^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@§«ª2^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@called `Result::unwrap()` on an `Err` valuelibrary/std/src/sys/unix/mutex.rsOsmessageCustomerrorUnexpectedEofConnectionRefusedConnectionResetConnectionAbortedNotConnectedAddrInUseBrokenPipeAlreadyExistsWouldBlockInvalidInputInvalidDataWriteZeroInterruptedOtherstrerror_r failurelibrary/std/src/sys/unix/os.rslibrary/std/src/ffi/c_str.rslibrary/std/src/thread/mod.rscannot access a Thread Local Storage value during or after destruction^@^@^@^@^@^@rwlock maximum reader count exceededrwlock read lock would result in deadlockfatal runtime error:
thread panicked while panicking. aborting.
RUST_BACKTRACE<unnamed>formatter errorfailed to write whole bufferlibrary/std/src/io/mod.rsnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

评论区

写评论
uno 2021-09-01 10:02

试试

[profile.release]
panic = "abort"
作者 liuxc0116 2021-08-31 15:26

谢谢回答,之前使用过strip -s,可执行文件里的文件名还是没有剥离。发现有些文件使用println!("some string")打印信息。"some string"和这个文件的文件名就会带到可执行文件里。

--
👇
sunnyregion: strip -s rust编译的执行程序

sunnyregion 2021-08-31 13:34

strip -s rust编译的执行程序

1 共 3 条评论, 1 页