Projucer 4.2.1 on Linux - new dependency to librtmp

Hello everyone

I have installed the new Juce release today (on ArchLinux), and the new Projucer refuses to start. The first time I’ve launched it, I got a missing dependency message (I didn’t have with previous versions, including 4.2) :

Projucer: error while loading shared libraries: librtmp.so.1: cannot open shared object file: No such file or directory

So I checked my package manager for something including this library, and found rtmpdump version 1:2.4.r96.fa8646d, and installed it. Starting ProJucer now induce a core dump :

Instruction non permise (core dumped)

I don’t know how to analyze a dump (I haven’t tried either), and I can still use ProJucer 4.2, so that’s no urging, but I wanted to report the issue :slight_smile:

That’s very very odd. I’ll investigate. Are you on a 64-bit distribution?

Hello Fabian

Yes it is :

[~] uname -a
Linux chewie 4.5.1-1-ARCH #1 SMP PREEMPT Thu Apr 14 19:19:32 CEST 2016 x86_64 GNU/Linux

I have an up to date set of packages, and ldd gives this result :

linux-vdso.so.1 (0x00007ffc8c501000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fa283117000)
libcurl-gnutls.so.4 => /usr/lib/libcurl-gnutls.so.4 (0x00007fa282eaa000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa282c8d000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fa282988000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fa282772000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fa2823d1000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa28331b000)
librtmp.so.1 => /usr/lib/librtmp.so.1 (0x00007fa2821b4000)
libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007fa281f86000)
libnettle.so.6 => /usr/lib/libnettle.so.6 (0x00007fa281d4e000)
libgnutls.so.30 => /usr/lib/libgnutls.so.30 (0x00007fa281a17000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007fa281801000)
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007fa281590000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fa281119000)
libp11-kit.so.0 => /usr/lib/libp11-kit.so.0 (0x00007fa280eb4000)
libtasn1.so.6 => /usr/lib/libtasn1.so.6 (0x00007fa280ca1000)
libhogweed.so.4 => /usr/lib/libhogweed.so.4 (0x00007fa280a6c000)
libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007fa2807f4000)
libffi.so.6 => /usr/lib/libffi.so.6 (0x00007fa2805eb000)

I don’t have much time to search the net on how to analyze a core dump for one, but if needed I can upload one somewhere for someone who could.

P.S. : rebuilding Projucer from source obviously works.

Can you do a ldd on libcurl-gnutls.so? I think libcurl may be pulling in the rtmp dependency? We certainly don’t require rtmp for the Projucer.

Hello Fabian

libcurl in itself does not require librtmp, but libcurl-gnutls does, you’re right.
I had to install libcurl-gnutls for… Tracktion 7 :wink:

Now maybe the prebuilt Projucer has been built against libcurl-gnutls instead of the libcurl one (which seems to be used when building Projucer oneself)

I’ll investigate and see if I can build only with the libcurl dependency

@fabian If you could find a way to reduce the dependancy that would be great. I recently had a user on OpenSUSE reporting problems due to missing cURL libs. (Was that you @riri?)

Yes I’ll have a look. You can always disable curl support by clicking on the juce_core module in the Projucer and disabling CURL support altogether.

Yeah but we had so many problems with users having to authorise using the offline key file method. It’s just not expected this day and age.

When you added the cURL stuff it was great!
If I could figure out which package to get users to install that would be a temporary work around. There’s just so many variations of Linux it’s impossible to test them all.

Sorry didn’t read your username ;-). Unfortunately, you really need to have a shared lib dependancy to libcurl. libcurl with modern ssl support is not available as a static lib (some security issues I think). I’m not really sure what the differences are between libcurl-gnutls and libcurl. I’ll need to re-check this.

@dave96 no it wasn’t me :slight_smile:

OK I’ve spent some time investigating this. Unfortunately, on Ubuntu there is no libcurl package that I can install that doesn’t come with a whole set of unnecessary dependencies. So I compiled a static version of libcurl myself. This seems to be overly complicated so I’d be happy for any suggestions.

This is how I did it:

  1. Compile a static version of libcurl with only http/https support

     cd curl-static
     mkdir build
     # the following package is needed on debian/ubuntu systems to have static SSL support
     sudo apt-get install libssl-dev 
     wget 'https://curl.haxx.se/download/curl-7.48.0.tar.bz2'
     tar -xvjf curl-7.48.0.tar.bz2
     cd curl-7.48.0
     ./configure --prefix=/home/xxxx/curl-static/build --with-static --without-dynamic --disable-dynamic --enable-static --disable-rt --without-librtmp --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-tls-srp --disable-crypto-auth --disable-shared --disable-ipv6 --disable-verbose --without-libidn
     # Make sure the above configure step results in SSL enabled
     make -j6
     make install # do NOT use sudo!!
    
  2. Make sure pkg-config picks up the right version

     export PKG_CONFIG_PATH=/home/xxxx/curl-static/build/lib/pkgconfig:${PKG_CONFIG_PATH}
    
     # check that pkg-config returns the correct dependencies
     # should return:
     # -L/home/xxxx/curl-static/build/lib -lcurl -lssl -lcrypto -lssl -lcrypto -lz
    
     pkg-config --libs --static libcurl 
    
  3. Modify the LDFLAGS lines (both for Debug and Release) of the makefile of your JUCE project (here for the Projucer)

    Change this line:
    LDFLAGS += (TARGET_ARCH) -L(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lX11 -lXext -lXinerama -ldl -lfreetype -lpthread -lrt -lcurl`

    to this:

    LDFLAGS += (TARGET_ARCH) -L(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -Wl,-Bstatic -lX11-xcb -lX11 -lxcb -lXau -lXdmcp -lXext -lXinerama -lfreetype -lz -lpng12 -lrt `pkg-config --libs --static libcurl` -Wl,-Bdynamic -ldl -lpthread

4, Re-build your JUCE project
The dependencies should be as follows:

ldd Projucer
linux-vdso.so.1 =>  (0x00007ffcd1bf8000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc64a6dc000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc64a4bf000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc64a13c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc649e33000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc649c1d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc649853000)
/lib64/ld-linux-x86-64.so.2 (0x0000555dd7289000)

which looks clean to me.

Looks better. I might try it out soon.

My main concern is the “export PKG_CONFIG_PATH” line. Does that have to be an absolute path? Ideally I’d like to be able to build this static lib once, add it to the repo and have all the team members build it. Having each of them follow these steps seems problematic.

If we don’t do the export step can we just link to “-lcurl -lssl -lcrypto -lssl -lcrypto -lz” directly in the PJ project? Presumably these dependancies won’t change? But does this mean we won’t be pointing to the correct libcurl binary?

Yes you definitely need the PKG_CONFIG_PATH when building your JUCE code otherwise it will pick up the system’s libcurl instead of the one you built.

However, you can also just copy and paste the output of pkg-config and put that into the Makefile instead of the pkg-config --static --libs libcurl part in the LDFlags. For me the output of pkg-config (with the PKG_CONFIG_PATH) gives this:

-L/home/xxxx/curl-static/build/lib -lcurl -lssl -lcrypto -lssl -lcrypto -lz

So the LDFLAGS line would read as follows

LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -Wl,-Bstatic -lX11-xcb -lX11 -lxcb -lXau -lXdmcp -lXext -lXinerama -lfreetype -lz -lpng12 -lrt -L/home/xxxx/curl-static/build/lib -lcurl -lssl -lcrypto -lssl -lcrypto -lz -Wl,-Bdynamic -ldl -lpthread

Obviously you can replace the -L with a relative path so that should work for your setup.

BTW: we’ve just uploaded a new linux binary build with a static libcurl. So you can test the binary on various distributions to see if this setup works for you.