Is PB using zlib?

Everything else that doesn't fall into one of the other PB categories.
BarryG
Addict
Addict
Posts: 3330
Joined: Thu Apr 18, 2019 8:17 am

Re: Is PB using zlib?

Post 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!
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB using zlib?

Post 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).
User avatar
skywalk
Addict
Addict
Posts: 4003
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Is PB using zlib?

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
akee
Enthusiast
Enthusiast
Posts: 479
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: Is PB using zlib?

Post 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.
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Is PB using zlib?

Post 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 
User avatar
skywalk
Addict
Addict
Posts: 4003
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Is PB using zlib?

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Is PB using zlib?

Post 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.
fryquez
Enthusiast
Enthusiast
Posts: 369
Joined: Mon Dec 21, 2015 8:12 pm

Re: Is PB using zlib?

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB using zlib?

Post 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...
Fred
Administrator
Administrator
Posts: 16687
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Is PB using zlib?

Post 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).
User avatar
skywalk
Addict
Addict
Posts: 4003
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Is PB using zlib?

Post 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?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Is PB using zlib?

Post 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.
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Is PB using zlib?

Post 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...

I am to provide the public with beneficial shocks.
Alfred Hitshock
GoodNPlenty
Enthusiast
Enthusiast
Posts: 108
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: Is PB using zlib?

Post 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
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB using zlib?

Post 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:
Post Reply