Recent

Author Topic: Zstandard for Lazarus, "without" DLL, Windows only  (Read 2192 times)


Fibonacci

  • Sr. Member
  • ****
  • Posts: 419
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #16 on: February 26, 2024, 09:06:36 am »

{$linklib libzstd.a}
{$linklib libgcc.a}
{$linklib libkernel32.a}
{$linklib libucrt.a}

Where are these files from? You compiled them by yourself?

I found good files (except libzstd.a) in MinGW release (winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.7z).

Yep, they are from https://www.mingw-w64.org/downloads/
and libzstd.a like I said I found in Ruby installation and in some old MinGW installation

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #17 on: February 26, 2024, 12:45:12 pm »
Here are good .A files from known places:
http://diecastia.com/_lazarus/zstd_bin.zip

winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.7z
mingw-w64-x86_64-zstd-1.4.4-1-any.pkg.tar.xz

This is LibZSTD version 1.4.4. Not the newest but starting with version 1.4.5 MinGW comes with .A file which requires .DLL.

paule32

  • Full Member
  • ***
  • Posts: 219
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #18 on: February 26, 2024, 12:55:44 pm »
For Information only:
To compress a .DLL which should be included into .EXE,

You can use the Free available .ExE, and .DLL - Packer UPX.
UPX comes with Source Code, so you can inspect the implementation.

You can download UPX on sourceforge.net.

My experiences are, that you can make a 2.500 Byte compressed EXE File from a 5.100 Byte Exe File.
Also near a ratio of 2.2

rvk

  • Hero Member
  • *****
  • Posts: 6171
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #19 on: February 26, 2024, 12:59:03 pm »
My experiences are, that you can make a 2.500 Byte compressed EXE File from a 5.100 Byte Exe File.
With half of the worlds virusscanners tripping over this  ;)

paule32

  • Full Member
  • ***
  • Posts: 219
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #20 on: February 26, 2024, 01:07:47 pm »
yeah.
But you can add a Exception in the Anti-Virus-Setting's.

For me, I use Avast - it check's all new binary Images that are accessed in/to Memory.
If you have created (Avast) a Hash of the binary, the Anti-Virus-Software (Avast) will remember this, and don't pop out/prompt the User with a Message.

Sure, you could do this only for trusted Users (which would be with 100% knowing the Developers of the Original Image).
But, when you are an own Entrepreneur, your Hard Disk Store will say to you: Thank you.

Sure, you need good Memory Sticks plugged into you Computer Sockets - because the binaries will be loaded into Memory before they will be execute...

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #21 on: February 26, 2024, 01:35:29 pm »
I already upxed the DLL before embedding it and on virustotal only 1 antivirus said it's "malicious". All others were fine with it.
The same method but DLL as a resource - 2 antivirus said it's "malicious".

And for LZ4 I made a new post so people can find it:
https://forum.lazarus.freepascal.org/index.php/topic,66391.0.html
« Last Edit: February 26, 2024, 01:46:50 pm by domasz »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2094
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #22 on: February 26, 2024, 01:37:16 pm »
The major antivirus scanners have UPX decompression included while I did prefer in past different executable packers, PECompact and ASPack.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11459
  • FPC developer.
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #23 on: February 26, 2024, 01:47:46 pm »
FPC used UPX a while to compress all binaries, and it was a never ending source of trouble. Antivirus, but also some PE functionality simply not or faulty implemented, trouble with EXE programs that provide traces, resource hackers etc etc.

UPX Antivirus trouble comes in waves. It might be ok for a while, but if you do it for a decade, you will have seen several flare ups.

And in practice all people will put the few MBs of EXEs on a 100GB HD, SSD or flash card anyway. Not worth the trouble.

In the end we simply removed the upx-after-build support from the buildsystem. It was a remnant of pre-2000 MSDOS times with 240MB harddisks anyway. The few people doing retro work can UPX it themselves.

yeah.
But you can add a Exception in the Anti-Virus-Setting's.

Or spend 2 hours with a customer on the phone trying to convince him that you don't work for CIA because "you sent him a virus". And that was 15 years ago, nowadays paranoia and conspiracy theories have been dialed up significantly compared to then.
« Last Edit: February 26, 2024, 01:50:38 pm by marcov »

Fibonacci

  • Sr. Member
  • ****
  • Posts: 419
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #24 on: February 26, 2024, 02:01:54 pm »
This is LibZSTD version 1.4.4. Not the newest but starting with version 1.4.5 MinGW comes with .A file which requires .DLL.

By doing writeln(ZSTD_versionString); you can see the version in my ZIP is 1.5.0, little newer.

Edit: Download newest zstd from official repo:
https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip
go to static, get file libzstd_static.lib, change the name to libzstd.a

And now you have most recent 1.5.5 version 8-)
« Last Edit: February 26, 2024, 02:06:14 pm by Fibonacci »

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #25 on: February 26, 2024, 02:05:51 pm »
By doing writeln(ZSTD_versionString); you can see the version in my ZIP is 1.5.0, little newer.
Yes, but you don't know where exactly that file came from so it's not a good idea to use it.

Fibonacci

  • Sr. Member
  • ****
  • Posts: 419
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #26 on: February 26, 2024, 02:07:37 pm »
Yes, but you don't know where exactly that file came from so it's not a good idea to use it.

Thats rational. But you know what? You included a binary file in the .pas, who knows whats that 8)

domasz

  • Sr. Member
  • ****
  • Posts: 437
Re: Zstandard for Lazarus, "without" DLL, Windows only
« Reply #27 on: February 26, 2024, 02:14:56 pm »
Yes, but you don't know where exactly that file came from so it's not a good idea to use it.

Thats rational. But you know what? You included a binary file in the .pas, who knows whats that 8)
Hah :D It's official DLL but UPXed so anyone can verify :)

Your method worked, thanks! I tried before:
Code: Pascal  [Select][+][-]
  1. {$linklib libzstd_static.lib}
and it didn't work because of wrong header. After renaming the file this works:
Code: Pascal  [Select][+][-]
  1. {$linklib libzstd.a}  


 

TinyPortal © 2005-2018