forensicmatt / libtsk-rs

Wrapper for TSK (Sleuth Kit) Bindings
Apache License 2.0
11 stars 5 forks source link

Build instructions #1

Closed AbdulRhmanAlfaifi closed 3 years ago

AbdulRhmanAlfaifi commented 3 years ago

Hello โœ‹ I am interested in working with libtsk in Rust. This is looking nice ๐Ÿ‘ and I want to try it. I tried to run it but I am facing issues, if there is any building instruction I would appreciate it. Here is what I have done so far:

  1. Install llvm along with llvm-config
  2. Install C++ build tools When I run cargo run it will fail with the following error:
    LINK : fatal error LNK1181: cannot open input file 'libtsk.lib'

    I download the compiled version from sluthkit repo with the same version as the one you added as submodule and added it to the same directory and now it gave me another error:

    = note: libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.we9eyqxgdvfqnbu.rcgu.o) : error LNK2019: unresolved external symbol tsk_img_close referenced in function _ZN62_$LT$tsk..tsk_img..TskImg$u20$as$u20$core..ops..drop..Drop$GT$4drop17h342c96e56bdc2aafE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.we9eyqxgdvfqnbu.rcgu.o) : error LNK2019: unresolved external symbol tsk_vs_close referenced in function _ZN60_$LT$tsk..tsk_vs..TskVs$u20$as$u20$core..ops..drop..Drop$GT$4drop17h1eb3c335509f07a5E
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.we9eyqxgdvfqnbu.rcgu.o) : error LNK2019: unresolved external symbol tsk_fs_close referenced in function _ZN60_$LT$tsk..tsk_fs..TskFs$u20$as$u20$core..ops..drop..Drop$GT$4drop17h2850f2b961e2abe8E
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.we9eyqxgdvfqnbu.rcgu.o) : error LNK2019: unresolved external symbol tsk_fs_file_close referenced in function _ZN69_$LT$tsk..tsk_fs_file..TskFsFile$u20$as$u20$core..ops..drop..Drop$GT$4drop17h0b970db00f19716fE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.1epdkjkgrfnvonhg.rcgu.o) : error LNK2019: unresolved external symbol tsk_img_open_utf8_sing referenced in function _ZN3tsk7tsk_img6TskImg11from_source17h518c928b566e27afE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.1epdkjkgrfnvonhg.rcgu.o) : error LNK2019: unresolved external symbol tsk_error_get referenced in function _ZN3tsk7tsk_img6TskImg11from_source17h518c928b566e27afE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.2kp5f9nihuews155.rcgu.o) : error LNK2001: unresolved external symbol tsk_error_get
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.32g521o04t5f40s1.rcgu.o) : error LNK2001: unresolved external symbol tsk_error_get
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.1bg93o9vx6u758xy.rcgu.o) : error LNK2001: unresolved external symbol tsk_error_get
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.2kp5f9nihuews155.rcgu.o) : error LNK2019: unresolved external symbol tsk_vs_open referenced in function _ZN3tsk6tsk_vs5TskVs3new17h63d7709b487cb9cdE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.40g0vh172be1hmzp.rcgu.o) : error LNK2019: unresolved external symbol tsk_vs_part_get referenced in function _ZN3tsk11tsk_vs_part9TskVsPart3new17h80484a7cc8de94efE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.32g521o04t5f40s1.rcgu.o) : error LNK2019: unresolved external symbol tsk_fs_open_img referenced in function _ZN3tsk6tsk_fs5TskFs3new17h261743faced24584E
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.1bg93o9vx6u758xy.rcgu.o) : error LNK2019: unresolved external symbol tsk_fs_file_open referenced in function _ZN3tsk11tsk_fs_file9TskFsFile9from_path17hd03a2c56148222beE
          libtsk-60c21a2c9abbc537.rlib(tsk-60c21a2c9abbc537.1bg93o9vx6u758xy.rcgu.o) : error LNK2019: unresolved external symbol tsk_fs_file_open_meta referenced in function _ZN3tsk11tsk_fs_file9TskFsFile9from_meta17hc180bdb2fccf8e01E
          <PATH>\libtsk-rs\target\debug\deps\volume_layout.exe : fatal error LNK1120: 11 unresolved externals

    Thanks ๐Ÿ™

forensicmatt commented 3 years ago

So far I have not been able to automate the build processes of libtsk. Its much harder than making the actual bindings. So far, I have had to compile the library separately, then just hard code the path as seen here: https://github.com/forensicmatt/libtsk-rs/blob/b4ae4c622c45eba7dcb068f5850888f99969477f/build.rs#L10

I hope to get this portion automated but I don't know how successful I will be. I have compiled libtsk using VS 2019 but can only get it to compile AND link in Release_NoLibs otherwise I also run into the same issues as you. I think libtsk build files might not be working correctly. I have not used any other build methods. I tried also downloading the precompiled binaries from libtsk, but I could not get the bindings to find the functions in the precompiled .lib. PRs welcome!

AbdulRhmanAlfaifi commented 3 years ago

It worked ! image Thanks ๐Ÿ™

forensicmatt commented 3 years ago

Great! Congrats, you're the first person to use use it!