how can i compile against zlib system library


i want to compile helm[1] for Fedora 29, but i want to compile it against the zlib system library.
I changed the following in the source code:

# use system library zlib
rm -rf ./JUCE/modules/juce_core/zip/zlib/zlib.h
sed -i 's|#define JUCE_INCLUDE_ZLIB_CODE 1|#define JUCE_INCLUDE_ZLIB_CODE 0|' JUCE/modules/juce_core/juce_core.h
sed -i 's|#include "../../../juce_core/zip/zlib/zlib.h"|#include "zlib.h"|' JUCE/modules/juce_graphics/image_formats/pnglib/pngstruct.h

but the compilation fails with this errors:

../../../JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h:1915:14: required from here
../../../JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h:969:24: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of non-trivially copyable type 'class juce::PixelAlpha'; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
memcpy (dest, src, (size_t) (width * srcStride));
In file included from ../../../JUCE/modules/juce_graphics/juce_graphics.h:112,
from ../../../JUCE/modules/juce_gui_basics/juce_gui_basics.h:57,
from ../../../JUCE/modules/juce_gui_basics/juce_gui_basics.cpp:45,
from ../../JuceLibraryCode/include_juce_gui_basics.cpp:9:
../../../JUCE/modules/juce_graphics/colour/juce_PixelFormats.h:617:17: note: 'class juce::PixelAlpha' declared here
class JUCE_API PixelAlpha
make[1]: Leaving directory '/home/martin/rpmbuild/BUILD/helm-abdedd527e6e1cf86636f0f1e8a3e75b06ed166a/standalone/builds/linux'
make: *** [Makefile:79: standalone] Error 2

[1] <a href="" title=""></a>



Re: how can i compile against zlib system library

By Jerry James at 01/18/2019 - 11:33

On Fri, Jan 18, 2019 at 2:51 AM Martin Gansser <martin. ... at gmail dot com> wrote:
Make that <zlib.h>; i.e., use angle brackets instead of quote marks.

That isn't an error. It is a warning. Search through your build logs
for "error:" and you will see the real problem:

error: invalid conversion from
'juce::pnglibNamespace::png_const_bytep' {aka 'const unsigned char*'}
to 'juce::zlibNamespace::Bytef*' {aka 'unsigned char*'} [-fpermissive]

As J.Scheurich noted, you can work around that with -fpermissive. But
notice that this error is being encountered while building a bundled
version of libpng. You'll want to use the system libpng instead.
Also, in a parallel directory,
JUCE/modules/juce_graphics/image_formats/jpglib, there is a bundled
libjpeg. You should use the system libjpeg-turbo (I think) instead.
See if unbundling those libraries fixes the build for you.


Re: how can i compile against zlib system library

By Martin Gansser at 01/18/2019 - 16:59

i tried to unbundle zlib, png and jpeg, but the compilation fails [1]

[1] <a href="" title=""></a>
[2] <a href="" title=""></a>


Re: how can i compile against zlib system library

By =?iso-8859-1?q?... at 01/18/2019 - 17:21

Martin Gansser wrote:
The first error is a conflict between the system JPEG library and the
bundled JPEG library, so it looks like you need to do more to unbundle
it completely.

Björn Persson

Re: how can i compile against zlib system library

By Dominik 'Rathan... at 01/18/2019 - 17:44

On Friday, 18 January 2019 at 22:21, Björn Persson wrote:
I'd suggest rm -rf'ing the bundled code in %prep and fixing up any
compilation failures.


Re: how can i compile against zlib system library

By J. Scheurich at 01/18/2019 - 08:41

I added in helm/standalone/builds/linux/Makefile
JUCE_CXXFLAGS += ... -fpermissive
JUCE_LDFLAGS +=  ... -lz ....

and the error you told about vanished - but the rpm do not completed 8-(

so long