rdbo / libmem

Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)
GNU Affero General Public License v3.0
830 stars 101 forks source link

rust build fails #216

Closed sk337 closed 6 months ago

sk337 commented 6 months ago

when i try to build using rust i get the following error

error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/sk337/.rbenv/bin:/home/sk337/.juliaup/bin:/home/sk337/.local/share/pnpm:/home/sk337/.bun/bin:/home/sk337/.nvm/versions/node/v22.1.0/bin:/home/sk337/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/sk337/.local/bin:/home/sk337/Projects/rust/nomad/target/release:/home/sk337/Downloads/patcher" VSLANG="1033" "cc" "-m64" "/tmp/rustc34OTHM/symbols.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.1j3t922on6jr35oz.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.1mm0d6z7t93gb7i4.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.21354qstr1fgel7o.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.2g06raonph333b8h.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.2ibuuergijd2mkgk.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.32azwfmpmvj5azj5.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.3fkaie5jy0tik2b6.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.42rq8koyar09hddx.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.4e6mc2jk489qmol.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.4q9x7zdl5py71sgs.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.4xl7800jn2lqm9pa.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.4zjee3qwc9zeh3a7.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.56fnlhc4zbd0tjcs.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.5z43mq0zb12c5ww.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.8ddutpys874xsxt.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.po1vad218x715o6.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.rmtxrfsn6wh8zc1.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.tin6kjy9lsyq2tl.rcgu.o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13.38wy59b1wjeoqmaa.rcgu.o" "-Wl,--as-needed" "-L" "/home/sk337/Projects/rust/rustHack/target/debug/deps" "-L" "/usr/lib" "-L" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/sk337/Projects/rust/rustHack/target/debug/deps/liblibmem-370b3af7bb31a56a.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-d2ef02247056996e.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-fde67f6c4eccaa42.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-2549d0ec992a5666.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-bb9bfc0931d5cad0.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-7c0b91fdc4adc2c5.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-6ec164769e6c2957.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-95326caaef561554.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-704dba0df3717bb7.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-5f0117cb69112303.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-7a95907f1ed0cea5.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-d4aa666f8242aefc.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-9abec8861e966bc7.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-863ac378b60eeb30.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-fc8aa5b7d220f0a9.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-0cc850f1e941238d.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-f7b445210e88e768.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-f37052492751c579.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-fd15ec7f305d48e7.rlib" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d700583125da6701.rlib" "-Wl,-Bdynamic" "-llibmem" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/sk337/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/sk337/Projects/rust/rustHack/target/debug/deps/exploit-1fbdd7a895883e13" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find -llibmem: No such file or directory
          collect2: error: ld returned 1 exit status

error: could not compile `exploit` (bin "exploit") due to 1 previous error
sk337 commented 6 months ago

my etc/os-release

NAME="Fedora Linux"
VERSION="39 (Workstation Edition)"
ID=fedora
VERSION_ID=39
VERSION_CODENAME=""
PLATFORM_ID="platform:f39"
PRETTY_NAME="Fedora Linux 39 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:39"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=39
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=39
SUPPORT_END=2024-11-12
VARIANT="Workstation Edition"
VARIANT_ID=workstation
rdbo commented 6 months ago

The current version on crates.io assumes you have libmem already installed in your system The new bindings from master will fetch and link libmem automatically for you, but I haven't finished v5.0 yet If you wanna use the older version while v5.0 doesn't come out, you can download libmem from: https://github.com/rdbo/libmem/releases/tag/4.4.0 and put the liblibmem.so file in your /usr/local/lib or /usr/lib

sk337 commented 6 months ago

should i set it to have special perms

rdbo commented 6 months ago

@sk337 as long as it's readable by any user, should be fine. Normally it would be chown root:root liblibmem.so && chmod 664 liblibmem.so

sk337 commented 6 months ago

now it is sayin it cant be found

sk337 commented 6 months ago
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/narco`
target/debug/narco: error while loading shared libraries: liblibmem.so: cannot open shared object file: No such file or directory
rdbo commented 6 months ago
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/narco`
target/debug/narco: error while loading shared libraries: liblibmem.so: cannot open shared object file: No such file or directory

Your system is probably not looking at /usr/local/lib You can do one of the following

export LD_LIBRARY_PATH="/usr/local/bin"
cargo run

or install at /usr/lib

sk337 commented 6 months ago

thanks that did the trick