Page 2 of 2

Re: Is PB using zlib?

Posted: Fri Apr 01, 2022 12:09 pm
by BarryG
Caronte3D wrote: Fri Apr 01, 2022 11:43 amwe used PB6 in a complex commercial product with no problem and no source code changes.
I haven't had to change my source when switching from 5.73 to 6.00 either. It all works great!

Re: Is PB using zlib?

Posted: Fri Apr 01, 2022 12:20 pm
by Kukulkan
Does someone of you also create libraries? In the changelog thread it says that it only supports 32Bit DLL yet. At least, it does not mention it anywhere else until today...

We compile .DLL/.DYLIB and .SO for our backend. It is mandatory for our products.

To be honest, I have not yet tried. I'm very busy this week (also because of the zlib thing, which also affects other parts of our products, not only PureBasic related).

Re: Is PB using zlib?

Posted: Fri Apr 01, 2022 5:30 pm
by skywalk
I had to change small things like ASM Procedures and Macros for DataSection labels.
But my app's worked in v6b3+.

I understand your hesitance for product release with a beta, but Fred said v6 is nearly final.
Selfishly, I want the updates for SQLite(bug fixes) and zlib(security) applied to v6.
v573 patching of zlib does make sense if time allows.

Hopefully, in future v6.x, we can address these random updates with static C lib importing at our own pace.

Re: Is PB using zlib?

Posted: Sun Apr 03, 2022 7:45 am
by akee
Fred wrote: Fri Apr 01, 2022 10:50 am I will update it for next beta.
Hey Fred, Remember to add a PackEntryDate() to the library. This will be very useful to update the data inside the archive. Thanks.

Re: Is PB using zlib?

Posted: Mon Apr 04, 2022 4:35 am
by idle
fryquez wrote: Fri Apr 01, 2022 8:22 am is there a problem with MinGW compiled libs?

https://www.mediafire.com/file/yfpuzmji ... 2.zip/file
Sorry I missed your post, that works fine with mingw32 / Clang 13 build. :D


@Kukulkan
It's easy to build to build with with cmake and mingw then drop them into
"C:\Program Files\PureBasic\PureLibraries\Windows\Libraries\zlib.lib"

If you don't have mingw32, clang and cmake or the gui cmake It's worth installing as you can also use clang with c backend. (when you up grade to pb 6)
Build tools required for windows builds cmake and mingw64
cmake
https://cmake.org/download/

mingw64
Info https://www.mingw-w64.org/downloads/#llvm-mingw
Available versions info https://github.com/mstorsjo/llvm-mingw/releases
Direct download link https://github.com/mstorsjo/llvm-mingw/ ... x86_64.zip

install to c:\
then add to the PATH environment variable ;type env in windows search
C:\llvm-mingw-20211002-msvcrt-x86_64
C:\llvm-mingw-20211002-msvcrt-x86_64\bin
C:\llvm-mingw-20211002-msvcrt-x86_64\include

Get the zlib source
https://github.com/madler/zlib
extract to where ever E:\
run cmd.exe
make a folder called build and cd into and run cmake
E:\zlib-master> mkdir build
E:\zlib-master> cd build
E:\zlib-master\build> cmake -G="MinGW Makefiles"
E:\zlib-master\build> mingw32-make
test should say 1.2.12

Code: Select all

UseZipPacker()  

ImportC "" 
  zlibVersion()
EndImport 

Debug PeekS(zlibVersion(),-1,#PB_UTF8) ;1.2.12 

Re: Is PB using zlib?

Posted: Mon Apr 04, 2022 1:39 pm
by skywalk
Whoa! I just saw this post.
I was using visual studio to compile sources.
I just need to install mingw and that is compatible with PB ImportC for 32 and 64 bit?
Does the PB v6 folder have these compilers already?

Re: Is PB using zlib?

Posted: Mon Apr 04, 2022 8:45 pm
by idle
If you follow the links and instructions it should work. I was hoping fryquez would elaborate on his set up and build instructions.
He has compiled both but I know some people will need to build it themselves.
I haven't done 32bit version yet.

Using mingw with clang isn't the magic bullet but it's often much easier to get a build working on windows and Linux. static libs on windows are a nightmare because of the changes Microsoft keep doing to the c runtime and fred uses an old version because he likes its small size and backward compatibility.

Re: Is PB using zlib?

Posted: Tue Apr 05, 2022 8:26 am
by fryquez
Well, it's really super easy with MinGW. I also use the llvm-mingw idle posted. You don't have to install any think to build zlib.

Download and unpack zlib-1.2.12 and llvm-mingw-20220323-msvcrt-i686.
In zlib-1.2.12 folder open a Comment Prompt and set PATH environment:

Code: Select all

set PATH=X:\llvm-mingw-20220323-msvcrt-i686\bin;%PATH%
then build it with

Code: Select all

mingw32-make -fwin32/Makefile.gcc
You get the libz.a you can rename and copy into you PB installation as \PureLibraries\Windows\Libraries\zlib.lib

Re: Is PB using zlib?

Posted: Tue Apr 05, 2022 9:24 am
by Kukulkan
I just wonder, if it is that easy, why Fred is not making a new release in the LTS branch? This is what LTS is for...

Re: Is PB using zlib?

Posted: Tue Apr 05, 2022 4:09 pm
by Fred
The 6.00 will be the new LTS. The 5.70 was released 2nd January 2019, which is now 3 years old (we support LTS 2 years).

Re: Is PB using zlib?

Posted: Tue Apr 05, 2022 6:08 pm
by skywalk
fryquez wrote: Tue Apr 05, 2022 8:26 amthen build it with

Code: Select all

mingw32-make -fwin32/Makefile.gcc
You get the libz.a you can rename and copy into you PB installation as \PureLibraries\Windows\Libraries\zlib.lib
Ok, this seems easy!
Curious why the output file has `.a` extension?
Does this mean ASCII instead of UNICODE? Or some other meaning?

Re: Is PB using zlib?

Posted: Tue Apr 05, 2022 8:43 pm
by idle
The .a extension is for static libs the .lib extension is for import libraries to dll but windows just uses .lib for both.

Re: Is PB using zlib?

Posted: Wed Apr 06, 2022 8:04 am
by fsw
As Idle said, the .a extension is for static libs, and it stands for archive, because it's an archive of object files,
On Unix, Linux, BSD and macOS there is the ar command to add or remove object files from an archive.
It probably comes with the C compilers (on macOS when you install Xcode).
So, if a C compiler is installed on Windows it will bring the ar app along, ready to be used...

Re: Is PB using zlib?

Posted: Sat Apr 09, 2022 1:11 am
by GoodNPlenty
zlib before 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.

https://nvd.nist.gov/vuln/detail/CVE-20 ... ptionTitle

Re: Is PB using zlib?

Posted: Mon Apr 11, 2022 7:25 am
by Kukulkan
GoodNPlenty wrote: Sat Apr 09, 2022 1:11 am zlib before 1.2.12 allows memory corruption when deflating (i.e., when compressing) if the input has many distant matches.

https://nvd.nist.gov/vuln/detail/CVE-20 ... ptionTitle
Right. This is the reason for this thread... :wink: