Suddenly weird linker errors

linker
#1

Ok, so I have built my app on linux in the past. The last build on linux was 2 days ago.
I used the develop branch of JUCE back then and am also using it now.
When I tried to build my app today, I’m getting a weird linker error that has never occured before. I also tried cleaning the directory first and trying again but no success. Building on windows is completely fine though…

/usr/bin/ld: build/intermediate/Debug/include_juce_graphics_f817e147.o: undefined reference to symbol 'png_set_sBIT@@PNG16_0'
//usr/lib/x86_64-linux-gnu/libpng16.so.16: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:94: recipe for target 'build/CommuniCare_Manager' failed
make: *** [build/CommuniCare_Manager] Error 1

same error with g++ or also gcc (just in case)

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

I’m completely helpless and haven’t found anything useless in the last 2 hours. As I have to deliver the application to my client pretty soon, I would be very thankful about a helping hand.
Thanks in advance

Edit:
Im Using Ubuntu 18.04.1 btw.

Edit 2:
Compiling on Mac also works fine. So it shouldn’t be something in my codebase. Also I’m not using any Linux specific guards. It must have to do with my linux …

Edit 3:
So I read in other forums that such an error could be caused by false linking order. But I’m using the makefile produced by projucer, so there shouldn’t be an issue right? I tried with the official prebuild projucer (to generate a makefile) but to no success…

0 Likes

#4

If you compile using V=1 make then you can see all the compilation commands in full. If you then copy the linking step you can experiment with changing the order of libraries to see if that helps.

When you say that you’re using the develop branch or JUCE then and now, do you mean exactly the same commit?

Have you changed JUCE_INCLUDE_PNGLIB_CODE from it’s default value of 1?

0 Likes

#5

Ok I’ll see where this takes me. Yeah I’m using exactly the same commit. After it didn’t work I tried pulling but I already was on the newest commit. And I haven’t changed any value. I have opened my project in Projucer saved the Project and tried to use the generated makefile. I have also built a clean and fresh Projucer to eliminate any errors there, with no success… I’ll investigate the problem further and then report back

0 Likes

#6

Looks like others have faced the same issue in the past: Trouble compiling JUCE projects in Ubuntu 18.04

Does the solution there help at all?

0 Likes

#7

Hmmm… So I tried making it with V=1 make and it looks normal so far. I also tried to set JUCE_INCLUDE_PNGLIB_CODE to 1 manually, to elminate this error. Still nothing. I am now trying to change the order. Also tried to use the master branch, but to no success …
These are the compile steps (just posting it for juce_graphics.o):

Compiling include_juce_graphics.cpp
clang++  -MMD -DLINUX=1 -DDEBUG=1 -D_DEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.12.0 -DJUCE_APP_VERSION_HEX=0x10c00 -pthread -I/usr/include/x86_64-linux-gnu -I/usr/include/webkitgtk-4.0 -I/usr/include/gtk-3.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/webkitgtk-4.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I../../JuceLibraryCode -I/usr/share/juce/modules  -march=native -g -ggdb -O0  -std=c++14  -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=0 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0  -o "build/intermediate/Debug/include_juce_graphics_f817e147.o" -c "../../JuceLibraryCode/include_juce_graphics.cpp"

and these are the linking steps:

clang++ -o build/CommuniCare_Manager build/intermediate/Debug/AddComponent_f1220be5.o build/intermediate/Debug/AddEntryComponent_5a261f0d.o build/intermediate/Debug/AddUserComponent_7164805a.o build/intermediate/Debug/CustomTableListBox_5d232839.o build/intermediate/Debug/ExpandArea_ebaf6050.o build/intermediate/Debug/ExpandEntryArea_f195dc86.o build/intermediate/Debug/ExpandUserArea_8c693e3b.o build/intermediate/Debug/Main_90ebc5c2.o build/intermediate/Debug/PostFunctions_d279bcbc.o build/intermediate/Debug/BinaryData_ce4232d4.o build/intermediate/Debug/include_juce_core_f26d17db.o build/intermediate/Debug/include_juce_data_structures_7471b1e3.o build/intermediate/Debug/include_juce_events_fd7d695.o build/intermediate/Debug/include_juce_graphics_f817e147.o build/intermediate/Debug/include_juce_gui_basics_e3f79785.o build/intermediate/Debug/include_juce_gui_extra_6dee1c1a.o build/intermediate/Debug/include_juce_opengl_a8a032b.o  -march=native -Lbuild -Lbuild -lfreetype -lcurl -lX11 -lXext -lXinerama -lwebkit2gtk-4.0 -lgtk-3 -lsoup-2.4 -ljavascriptcoregtk-4.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lGL -ldl -lpthread -lrt    -march=native

But I have no idea where to begin…

Edit 1:
What I have noticed though is that -lpng isn’t even present. When adding it to the front, I get another error

/usr/bin/ld: build/intermediate/Debug/include_juce_core_f26d17db.o: undefined reference to symbol 'inflateEnd'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line

I am now trying to try out every possible position

Edit 2:
It doesn’t matter at which position I add -lpng, it gives me the ... libz.so.1: error adding symbols ... error. When I remove it, I get the ... libpng16.so.16: error adding symbols ... error again. I have no freaking idea what to do. Could you maybe tell me what I could try?

0 Likes

#8

Already upgraded my system. It was the first thing I tried. I will now also try to “turn it off and on again”. Just in case…

0 Likes

#9

Ok so update. The global modules dir was set to /usr/share/juce/modules. I now changed it to my JUCE develop dir ~/JUCE/modules. Now I’m getting a different error:

build/intermediate/Debug/include_juce_core_f26d17db.o: In function `juce::CURLSymbols::create()':
/home/dustvoice/JUCE/modules/juce_core/native/juce_curl_Network.cpp:55: undefined reference to `curl_easy_init'
/home/dustvoice/JUCE/modules/juce_core/native/juce_curl_Network.cpp:56: undefined reference to `curl_easy_setopt'
...
0 Likes

#10

Same error when trying to compile, in my case link, with the JUCE_USE_CURL option set in Projucer. Adding JUCE_LOAD_CURL_SYMBOLS_LAZILY also didn’t do anything. It gives me the exact same error.
I also tried using libcurl3 instead of libcurl4, but same error still. Reinstalled libcurl4 now, as this wasn’t the issue… I just want it to work damn it…

Please help me :sweat:. I’m not a linux guru. I know my way around usually but this really gives me a headache. Especially since the current Sprint ends tomorrow :sweat_smile: and my client would love to have a working version then …

Edit 1:
Also tried setting JUCE_WEB_BROWSER to disabled as suggested in the post @reuk linked, but as I guessed -> still same error :sob:
What I can’t understand is, how this error can occur from one day to another without any changes. Sure I changed my source code, but first off these weren’t huge changes, mainly documentation, and also success with building it on Windows and Mac should mean that it isn’t code base related! Also I don’t think this kind of linker error occurs because of source code.

0 Likes

#11

F R E A K I N G
H E L L

I have no idea what was wrong with my system. As I mentioned, my client wants a working version to be delivered tomorrow, together with packaging etc. so I was really under pressure. In my hopelessness, I upgraded to Ubuntu 8.10 (was on 8.04 LTS) in my virtual machine. No everything just … works. I have NO idea what caused this, I have spent over 8 hours trying to figure this whole *** out, but nothing worked. Until now. So unfortunately, I can’t reproduce this issue anymore.

0 Likes