fcorbelli / zpaqfranz

Deduplicating archiver with encryption and paranoid-level tests. Swiss army knife for the serious backup and disaster recovery manager. Ransomware neutralizer. Win/Linux/Unix
MIT License
275 stars 25 forks source link

How to use this on Linux ?? #44

Closed se7uh closed 1 year ago

se7uh commented 1 year ago

i'm trying to run code without compile, i got this error :

--❯ ./zpaqfranz.cpp
./zpaqfranz.cpp: line 1: /bin: Is a directory
./zpaqfranz.cpp: line 2: __: command not found
./zpaqfranz.cpp: line 3: _____: command not found
./zpaqfranz.cpp: line 3: _: command not found
./zpaqfranz.cpp: line 4: syntax error near unexpected token `|'
./zpaqfranz.cpp: line 4: `          |_  / '_ \ / _` |/ _` | |_| '__/ _` | '_ \|_  /'

but, when i try to compile it. I always get this error (i have done trying compile it with gcc, g++ and clang, and the error is same)

zpaqfranz.cpp: In function ‘size_t compress_parents_parallel(const uint8_t*, size_t, const uint32_t*, uint8_t, uint8_t*)’:
zpaqfranz.cpp:10763:17: warning: ‘void* memcpy(void*, const void*, size_t)’ writing 32 bytes into a region of size 8 overflows the destination [-Wstringop-overflow=]
10763 |           memcpy(&out+(parents_array_len * BLAKE3_OUT_LEN),
      |           ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10764 |            &child_chaining_values+(2 * parents_array_len * BLAKE3_OUT_LEN),
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10765 |            BLAKE3_OUT_LEN); /// FAKE COMPILER WARNING
      |            ~~~~~~~~~~~~~~~
zpaqfranz.cpp:10744:50: note: destination object ‘out’ of size 8
10744 |                                         uint8_t *out) {
      |                                         ~~~~~~~~~^~~
fcorbelli commented 1 year ago

You really need to compile the .cpp into an executable (statically linked or not), before you can run The "usual" way is by something like that

g++ -O3 -Dunix zpaqfranz.cpp  -pthread -o zpaqfranz -static

Or (if you have LLVM instead of gcc)

clang++ -O3 -Dunix zpaqfranz.cpp  -pthread -o zpaqfranz -static

Please note: you are compiling "zpaqfranz.cpp" into "zpaqfranz" (without .cpp) Then you can run (without .cpp)

./zpaqfranz

What, exactly, "kind" of Linux you are using? You get a warning, not an error In fact a FAKE warning (as I write into the comment /// FAKE COMPILER WARNING) due to a bugged compiler (yes, compilers have bugs too)

se7uh commented 1 year ago

Thanks it works

fcorbelli commented 1 year ago

Please leave a review on sourceforge, then :)

PS if you made something like

cp ./zpaqfranz /bin/zpaqfranz
cp ./zpaqfranz /bin/dir

you not need, anymore, the "./zpaqfranz", but a "straight" zpaqfranz or dir