mtytel / helm

Helm - a free polyphonic synth with lots of modulation
http://tytel.org/helm
GNU General Public License v3.0
2.38k stars 203 forks source link

Compile error using libpng >= 1.5 #76

Closed chaot4 closed 8 years ago

chaot4 commented 8 years ago

I get the following compile error when trying to compile (current master branch) helm under Arch Linux using libpng 1.6.21-1:

Compiling juce_graphics.cpp
In file included from ../../../JUCE/modules/juce_graphics/juce_graphics.cpp:129:0:
../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp: In function ‘void juce::PNGHelpers::errorCallback(juce::pnglibNamespace::png_structp, juce::pnglibNamespace::png_const_charp)’:
../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp:323:31: error: invalid use of incomplete type ‘juce::pnglibNamespace::png_struct {aka struct juce::pnglibNamespace::png_struct_def}’
         longjmp (*(jmp_buf*) p->error_ptr, 1);
                               ^
In file included from ../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp:289:0,
                 from ../../../JUCE/modules/juce_graphics/juce_graphics.cpp:129:
/usr/include/png.h:459:16: note: forward declaration of ‘juce::pnglibNamespace::png_struct {aka struct juce::pnglibNamespace::png_struct_def}’
 typedef struct png_struct_def png_struct;
                ^
In file included from ../../../JUCE/modules/juce_graphics/juce_graphics.cpp:129:0:
../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp: In function ‘juce::Image juce::PNGHelpers::readImage(juce::InputStream&, juce::pnglibNamespace::png_structp, juce::pnglibNamespace::png_infop)’:
../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp:446:101: error: invalid use of incomplete type ‘juce::pnglibNamespace::png_info {aka struct juce::pnglibNamespace::png_info_def}’
                 return createImageFromData ((colorType & PNG_COLOR_MASK_ALPHA) != 0 || pngInfoStruct->num_trans > 0,
                                                                                                     ^
In file included from ../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp:289:0,
                 from ../../../JUCE/modules/juce_graphics/juce_graphics.cpp:129:
/usr/include/png.h:473:16: note: forward declaration of ‘juce::pnglibNamespace::png_info {aka struct juce::pnglibNamespace::png_info_def}’

If I understand correctly this is due to a new version of libpng (http://stackoverflow.com/questions/10507610/libpng-1-5-10-error-dereferencing-pointer-to-incomplete-type). It also is reproducable in openSUSE (Tumbleweed).

If you need more information then tell me. :)

mtytel commented 8 years ago

durn. looking into this.

ycollet commented 8 years ago

This same bug happens under Fedora 23.

mtytel commented 8 years ago

So this was caused when i switched from using the included juce version of libpng to the libpng that's on the build system. In the Makefile if you switch JUCE_INCLUDE_PNGLIB_CODE=0 to JUCE_INCLUDE_PNGLIB_CODE=1, then it should build libpng into helm so there's no more problem.

I switched to the build system libpng because I was trying to package helm as a debian package and they require that i used installed versions of libraries instead of building them into the binaries.

Still not sure how to resolve this though..

mtytel commented 8 years ago

Alright I'm statically linking again so this should be fixed. Need to figure out how to dynamically link in libpng eventually to appease the debian folks.