Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projucer Linux Makefile Linking error: undefined reference to symbol #499

Closed
fbosio opened this issue Mar 8, 2019 · 32 comments
Closed

Projucer Linux Makefile Linking error: undefined reference to symbol #499

fbosio opened this issue Mar 8, 2019 · 32 comments

Comments

@fbosio
Copy link

fbosio commented Mar 8, 2019

Hi! I created a simple GUI project in Projucer in my Ubuntu 18.10 64 bits system.

When trying to compile such project using make, I got

Linking Juce_GUI_Test - App /usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0' /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:96: build/Juce_GUI_Test] Error 1

I had to add the following flags to the JUCE_LDFLAGS macro in the Makefile in order to make it work:
-lpng16 -lz -ljpeg -lFLAC -logg -lvorbis -lvorbisenc -lvorbisfile

The workaround is achieved specifically following these steps:

  1. Open the Makefile in any text editor you like.
  2. Go to line 44, the line JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -fvisibility=hidden -lGL -ldl -lpthread -lrt $(LDFLAGS) should appear.
  3. Add the flags before $(LDFLAGS) so now line 44 should be JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl x11 xext xinerama webkit2gtk-4.0 gtk+-x11-3.0) -lGL -ldl -lpthread -lrt -lpng16 -lz -ljpeg -lFLAC -logg -lvorbis -lvorbisenc -lvorbisfile $(LDFLAGS).
  4. Now compilation does work after running make.

I think that it has something to do with function
StringArray getLinkerFlags (const BuildConfiguration& config) const
of the jucer_ProjectExport_Make files of the repository.

Hope it helps!

@fbosio
Copy link
Author

fbosio commented Mar 9, 2019

Workaround Number 2 (equivalent)

Just write -lpng16 -lz -ljpeg -lFLAC -logg -lvorbis -lvorbisenc -lvorbisfile in the Extra Linker Flags field. It can be found in the Linux Makefile specific settings.

I find this workaround more convenient, since Prejuce will make these flags persistent. Hope it helps!

@McMartin
Copy link
Contributor

McMartin commented Mar 9, 2019

JUCE contains libpng and builds it as part of juce_graphics in juce_PNGLoader.cpp, so it doesn't make much sense to get such linker error... 🤔

I guess we need to make the linker output more verbose to see what other libraries might be pulling the system libpng and creating conflicts with the one from JUCE.

@fbosio
Copy link
Author

fbosio commented Mar 9, 2019

Hi @McMartin thanks for your answer! I do agree, it's kinda weird, but now I'm thinking that I installed Projucer from the Ubuntu repositories, so maybe my Projucer is out of date..?

If I run this command in a Linux terminal
Projucer --help 2>&1 > /dev/null | grep Build
the result is
Projucer 5.3.2 --- Build date: May 14 2018
but the newest version is 5.4.3, so.. my bad!!

I'm going to compile Projucer from the last sources, and check if the error remains there.

@fbosio
Copy link
Author

fbosio commented Mar 9, 2019

Nope... just crashed again..
Linking NewProject - App /usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0' /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [Makefile:97: build/NewProject] Error 1

workaround is the same here: adding the linker flags manually solves the problem.

@McMartin
Copy link
Contributor

McMartin commented Mar 11, 2019

Hold on... You were able to build Projucer, but failed to build a new GUI Application? That again doesn't make much sense...

I installed Ubuntu 18.10 in a VM (VirtualBox) and I built successfully both Projucer and a new GUI Application. I guess we really need to dig into what the linker is doing on your machine.

Please run the following:

$ cd JUCE/extras/Projucer/Builds/LinuxMakefile
$ rm build/Projucer
$ V=1 make > link-Projucer.txt

and then attach link-Projucer.txt to a new comment (for reference, mine is here: link-Projucer.txt).

Please also remove the extra linker flags that you added manually from NewProject, try to build it:

$ cd NewProject/Builds/LinuxMakefile
$ rm build/NewProject
$ V=1 make > link-NewProject.txt

and then attach link-NewProject.txt to the same comment (for reference, mine is here: link-NewProject.txt).

@fbosio
Copy link
Author

fbosio commented Mar 11, 2019

Hallo!

Here is my link-NewProject.txt file, and here my link-Projucer.txt.

Vielen Dank für deine Hilfe! ;)

@McMartin
Copy link
Contributor

Now I'm ever more confused... Your link-NewProject.txt doesn't contain any error, it seems to have worked flawlessly.
Did you find a solution? Or did it fix itself?

@fbosio
Copy link
Author

fbosio commented Mar 11, 2019

Oh that's because V=1 make > link-NewProject.txt redirects just stdout, it doesn't redirect stderr, so compilation errors didn't appear when I compiled the project. Sorry.

Now I run make V=1 > 'link-NewProject.txt' 2>&1 and
link-NewProject.txt has now the libpng error printed on it. Hope that's useful!

@McMartin
Copy link
Contributor

that's because V=1 make > link-NewProject.txt redirects just stdout, it doesn't redirect stderr, so compilation errors didn't appear when I compiled the project.

OMG, I'm an idiot 🤦‍♂️ Sorry about that 😅

Please run the following now:

$ cd NewProject/Builds/LinuxMakefile
$ rm -f build/NewProject
$ LDFLAGS=--verbose make 2> link-NewProject-verbose.txt

and then attach link-NewProject-verbose.txt to a new comment (for reference, mine is here:
link-NewProject-verbose.txt)

@fbosio
Copy link
Author

fbosio commented Mar 11, 2019

OMG, I'm an idiot Sorry about that

I beg to differ! You're helping me after all.

Please run the following now:

$ cd NewProject/Builds/LinuxMakefile
$ rm -f build/NewProject
$ LDFLAGS=--verbose make 2> link-NewProject-verbose.txt

and then attach link-NewProject-verbose.txt to a new comment (for reference, mine is here:
link-NewProject-verbose.txt)

Done, here is my result:
link-NewProject-verbose.txt

@McMartin
Copy link
Contributor

McMartin commented Mar 12, 2019

Nothing interesting in our link-NewProject-verbose.txt files... Let's get even more output!

Please run the following:

$ cd NewProject/Builds/LinuxMakefile
$ rm -f build/NewProject
$ LDFLAGS="-Wl,--verbose" make > link-NewProject-linker-verbose.txt

and then you know the drill (for reference: link-NewProject-linker-verbose.txt).

@fbosio
Copy link
Author

fbosio commented Mar 12, 2019

This one is much longer... 587 lines! :O

link-NewProject-linker-verbose.txt

@McMartin
Copy link
Contributor

This one is much longer... 587 lines! :O

That's actually too short. Your file stops with

found libpng16.so.16 at //usr/lib/x86_64-linux-gnu/libpng16.so.16

but mine goes on and reaches 1275 lines.

This seems to mean that something is wrong with the system libpng.

Here is what I did to get more information about libpng on my system:

$ file /usr/lib/x86_64-linux-gnu/libpng16.so.16
/usr/lib/x86_64-linux-gnu/libpng16.so.16: symbolic link to libpng16.so.16.34.0

$ file /usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0 
/usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=43a5f6bb7bbf19435f6079791c00a658af01b07d, stripped

$ nm -D /usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0 | grep png_set_sBIT
000000000001db60 T png_set_sBIT

Please run the same commands (you might have to adapt libpng16.so.16.34.0 to match the exact version on your system) and let me know what you get.

@fbosio
Copy link
Author

fbosio commented Mar 13, 2019

$ apt show libpng16-16 | grep Version
Version: 1.6.34-2

$ file /usr/lib/x86_64-linux-gnu/libpng16.so.16
/usr/lib/x86_64-linux-gnu/libpng16.so.16: symbolic link to libpng16.so.16.34.0

$ file /usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0 
/usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=43a5f6bb7bbf19435f6079791c00a658af01b07d, stripped

$ nm -D /usr/lib/x86_64-linux-gnu/libpng16.so.16.34.0 | grep png_set_sBIT
000000000001db60 T png_set_sBIT

@McMartin
Copy link
Contributor

McMartin commented Mar 13, 2019

This seems to mean that something is wrong with the system libpng.

Well, I was wrong.

If you don't mind, let's try the nuclear solution (:warning: it will produce a very big file: 184 476 lines, 20 MB):

$ cd NewProject/Builds/LinuxMakefile
$ rm -f build/NewProject
$ LDFLAGS="-Wl,-M" make > link-NewProject-map.txt

(for reference: link-NewProject-map.txt)

@fbosio
Copy link
Author

fbosio commented Mar 13, 2019

Ok, I passed the print map -M option to the linker, but just when I expected a big heavy-duty radioactive file, I got this tiny, light, standard Hydrogen-like monatomic one:

link-NewProject-map.txt

Again, thank you very much for the interest! We'll get to the bottom of this! (Er, at this rate.. probably you'll do it first..)

@McMartin
Copy link
Contributor

McMartin commented Mar 14, 2019

I don't understand why passing -Wl,-M didn't output the link map... But let's try something else.

Please run the following commands:

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.2.0-7ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)
$ ld -V
GNU ld (GNU Binutils for Ubuntu) 2.31.1
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   elf_iamcu
   elf_l1om
   elf_k1om
   i386pep
   i386pe
$ cd NewProject/Builds/LinuxMakefile

$ rm -f build/NewProject
$ LDFLAGS="-Wl,--trace-symbol=png_set_sBIT" make
Linking NewProject - App
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: definition of png_set_sBIT

$ rm -f build/NewProject
$ LDFLAGS="-Wl,--trace-symbol=png_set_sBIT@@PNG16_0" make
Linking NewProject - App
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: definition of png_set_sBIT@@PNG16_0

@fbosio
Copy link
Author

fbosio commented Mar 16, 2019

Hi! Sorry about the delay.

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.2.0-7ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)
$ ld -V
GNU ld (GNU Binutils for Ubuntu) 2.31.1
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   elf_iamcu
   elf_l1om
   elf_k1om
   i386pep
   i386pe
$ LDFLAGS="-Wl,--trace-symbol=png_set_sBIT" make
Compiling MainComponent.cpp
Compiling Main.cpp
Compiling include_juce_audio_basics.cpp
Compiling include_juce_audio_devices.cpp
Compiling include_juce_audio_formats.cpp
Compiling include_juce_audio_processors.cpp
Compiling include_juce_core.cpp
Compiling include_juce_cryptography.cpp
Compiling include_juce_data_structures.cpp
Compiling include_juce_events.cpp
Compiling include_juce_graphics.cpp
Compiling include_juce_gui_basics.cpp
Compiling include_juce_gui_extra.cpp
Compiling include_juce_opengl.cpp
Linking NewProject - App
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: reference to png_set_sBIT
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: definition of png_set_sBIT
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:97: build/NewProject] Error 1
$ LDFLAGS="-Wl,--trace-symbol=png_set_sBIT" make
Linking NewProject - App
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: reference to png_set_sBIT
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: definition of png_set_sBIT
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:97: build/NewProject] Error 1

@McMartin
Copy link
Contributor

I don't have

/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: reference to png_set_sBIT

when I build with LDFLAGS="-Wl,--trace-symbol=png_set_sBIT", which seems to mean that include_juce_graphics_f817e147.o needs that symbol on your machine, but not on mine. So let's have a look at what is inside include_juce_graphics_f817e147.o.

Please run the following:

$ rm build/intermediate/Debug/include_juce_graphics_f817e147.*
$ make
Compiling include_juce_graphics.cpp
Linking NewProject - App
$ nm build/intermediate/Debug/include_juce_graphics_f817e147.o > nm-include_juce_graphics_f817e147.txt

and then attach nm-include_juce_graphics_f817e147.txt to a new comment (mine for reference:
nm-include_juce_graphics_f817e147.txt)

@fbosio
Copy link
Author

fbosio commented Mar 17, 2019

$ rm build/intermediate/Debug/include_juce_graphics_f817e147.* && make 
Compiling include_juce_graphics.cpp
Linking NewProject - App
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:97: build/NewProject] Error 1

and then
nm-include_juce_graphics_f817e147.txt

@McMartin
Copy link
Contributor

McMartin commented Mar 17, 2019

The 2 include_juce_graphics_f817e147.o files seem indeed quite different... Let's have a look at what the preprocessor does:

$ make
make: Nothing to be done for 'all'.
$ rm build/intermediate/Debug/include_juce_graphics_f817e147.o
$ CFLAGS="-save-temps" make
Compiling include_juce_graphics.cpp
Linking NewProject - App
$ ls
build  include_juce_graphics.ii  include_juce_graphics.s  Makefile

then please compress include_juce_graphics.ii and include_juce_graphics.s into a .zip archive and attach that archive to a new comment (mine for reference: include_juce_graphics.zip)

@fbosio
Copy link
Author

fbosio commented Mar 19, 2019

Hi! Sorry for the delay, I had no internet recently.

$ make
Linking NewProject - App
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:97: build/NewProject] Error 1
$ rm build/intermediate/Debug/include_juce_graphics_f817e147.o
$ CFLAGS="-save-temps" make
Compiling include_juce_graphics.cpp
Linking NewProject - App
/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
/usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:97: build/NewProject] Error 1
$ ls                                                                     
 build                                link-NewProject.txt
 include_juce_graphics.ii            'link-NewProject-verbose(mc).txt'
 include_juce_graphics.s              link-NewProject-verbose.txt
 link-NewProject-linker-verbose.txt   Makefile
 link-NewProject-map.txt              nm-include_juce_graphics_f817e147.txt
$ zip include_juce_graphics.zip include_juce_graphics.ii include_juce_graphics.s
  adding: include_juce_graphics.ii (deflated 86%)
  adding: include_juce_graphics.s (deflated 90%)

include_juce_graphics.zip

@McMartin
Copy link
Contributor

Which version of JUCE are you using? I assumed you were using 5.4.3 based on

but the newest version is 5.4.3, so.. my bad!!

I'm going to compile Projucer from the last sources, and check if the error remains there.

But include_juce_graphics.ii clearly shows that you are using an older version.

@fbosio
Copy link
Author

fbosio commented Mar 19, 2019

You're right, that could be certainly the problem. I installed JUCE from Ubuntu repositories (5.3.2) and then downloaded Projucer 5.4.3 from https://shop.juce.com/get-juce/download but I cannot delete JUCE 5.3.2. When I try to do it, I can't compile anything. Sorry for the ignorance! But, does that zip file of the Juce Download Page include a 5.4.3 JUCE compiler with the libraries?

@McMartin
Copy link
Contributor

McMartin commented Mar 19, 2019

I installed JUCE from Ubuntu repositories

It seems that this is the root cause of all your troubles.

I did the following to reproduce:

  • installed the juce-modules-source and juce-tools packages,
  • started the Projucer binary freshly installed,
  • changed Path to JUCE to /usr/share/juce and JUCE Modules to /usr/share/juce/modules in the Global Paths,
  • re-saved my NewProject project
  • and then
    $ cd ~/dev/NewProject/Builds/LinuxMakefile/
    $ make clean
    Cleaning NewProject
    $ make -j4
    Compiling MainComponent.cpp
    Compiling Main.cpp
    Compiling include_juce_audio_devices.cpp
    Compiling include_juce_audio_basics.cpp
    Compiling include_juce_audio_formats.cpp
    Compiling include_juce_audio_processors.cpp
    Compiling include_juce_core.cpp
    Compiling include_juce_cryptography.cpp
    Compiling include_juce_data_structures.cpp
    Compiling include_juce_events.cpp
    Compiling include_juce_graphics.cpp
    Compiling include_juce_gui_basics.cpp
    Compiling include_juce_gui_extra.cpp
    Compiling include_juce_opengl.cpp
    Linking NewProject - App
    /usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
    /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:95: build/NewProject] Error 1
    

The juce-modules-source and juce-tools packages cannot build a default GUI Application. Mystery solved!

When making the juce-modules-source package, its maintainers are making some "small" changes to the JUCE code. For instance, in /usr/share/juce/modules/juce_core/juce_core.h, you can find the following code from line 68 to line 95:

/** Debian specific constants
  - Debian, we don't use embedded libraries
*/
#ifdef JUCE_INCLUDE_ZLIB_CODE
# undef JUCE_INCLUDE_ZLIB_CODE
#endif
#define JUCE_INCLUDE_ZLIB_CODE 0

#ifdef JUCE_INCLUDE_FLAC_CODE
# undef JUCE_INCLUDE_FLAC_CODE
#endif
#define JUCE_INCLUDE_FLAC_CODE 0

#ifdef JUCE_INCLUDE_OGGVORBIS_CODE
# undef JUCE_INCLUDE_OGGVORBIS_CODE
#endif
#define JUCE_INCLUDE_OGGVORBIS_CODE 0

#ifdef JUCE_INCLUDE_JPEGLIB_CODE
# undef JUCE_INCLUDE_JPEGLIB_CODE
#endif
#define JUCE_INCLUDE_JPEGLIB_CODE 0

#ifdef JUCE_INCLUDE_PNGLIB_CODE
# undef JUCE_INCLUDE_PNGLIB_CODE
#endif
#define JUCE_INCLUDE_PNGLIB_CODE 0
/** Debian specifics END

Unfortunately, they didn't change Projucer to make it add the corresponding libraries to the linker flags.

Now you have 2 options:

  • keep using these apt packages, and deal with the fact that you have to specify extra linker flags,
  • stop using these apt packages, and use the JUCE code as written by the JUCE team.

To get the JUCE code without any changes from the Debian Multimedia Maintainers:

  • you can clone this repository (git clone https://github.com/WeAreROLI/JUCE) and then build Projucer from source, or
  • you can use the archive that you can find on https://shop.juce.com/get-juce/download, since it contains both a pre-built binary of Projucer and all the JUCE code.

@fbosio
Copy link
Author

fbosio commented Mar 21, 2019

$ make
Compiling MainComponent.cpp
Compiling Main.cpp
Compiling include_juce_audio_basics.cpp
Compiling include_juce_audio_devices.cpp
Compiling include_juce_audio_formats.cpp
Compiling include_juce_audio_processors.cpp
Compiling include_juce_core.cpp
Compiling include_juce_cryptography.cpp
Compiling include_juce_data_structures.cpp
Compiling include_juce_events.cpp
Compiling include_juce_graphics.cpp
Compiling include_juce_gui_basics.cpp
Compiling include_juce_gui_extra.cpp
Compiling include_juce_opengl.cpp
Linking NewProject - App
$ build/NewProject 
JUCE v5.4.3

Just speechless... Alain, thank you so much!! Very attentive, I'll say that for you!

When making the juce-modules-source package, its maintainers are making some "small" changes to the JUCE code.

I see.

Unfortunately, they didn't change Projucer to make it add the corresopnding libraries to the linker flags.

Any chance of telling them about this?

@McMartin
Copy link
Contributor

Any chance of telling them about this?

First we should check that the problem still exists in the latest version of the package (5.4.1+really5.4.1~repack-3 according to https://tracker.debian.org/pkg/juce). If it does, then I guess we should report it as a bug.

@McMartin
Copy link
Contributor

McMartin commented Mar 21, 2019

Actually, this issue seems to be already known and documented in the README of the package:
https://sources.debian.org/src/juce/5.4.1+really5.4.1~repack-3/debian/README.Debian/#L44-L54

But let's simply ping the maintainer and see what they think.
@umlaeute 👋

@umlaeute
Copy link

if you have problems with the Debian package, you should use the Debian bug-tracker (or Ubuntu's; but I'm not a Ubuntu developer (so i don't follow bug reports there) and the issue really is with the Debian package (as opposed to the same package distributed by any derivative); see [1]), instead of ROLI's issue tracker. reportbug is your friend.

having said that, the reasoning why Projucer was not changed to automatically link dynamically against all libraries that JUCE compiles in is that, i tried to avoid overlinking in the first place (and i haven't really investigated in which libraries are really needed by enabling which feature).

you are welcome to help with resolving the issue (in the apropriate forum):

[1] https://wiki.ubuntu.com/Debian/Bugs

@McMartin
Copy link
Contributor

@umlaeute thanks a lot for chiming in! I'll create a bug on the Debian bug-tracker.

@McMartin
Copy link
Contributor

@fbosio feel free to close this issue now. Have fun using JUCE!

@fbosio
Copy link
Author

fbosio commented Mar 21, 2019

@McMartin @umlaeute I thank both of you! You guys realy helped me a lot!

@fbosio fbosio closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants