Minimise dependencies (do I really need libcurl?)

I have an app that doesn’t connect to the internet or use networking in any way. The binary requires libcurl to be installed. Is that really necessary? Why? Does it do something that every app needs?

In general how can I reduce the dependencies and reduce the number of juce modules required so my builds don’t require anything they aren’t actully using, either for compiling or for running.

For example why is include_juce_cryptography in my JuceLibraryCode folder? I can’t imagine what it would be used for.

If you don’t need juce_cryptography (or another JUCE module), you can right-click on it in Projucer to show the following context menu:

By default, JUCE_USE_CURL is Disabled, as shown in the following screenshot:

If you don’t want your app to depend on libcurl, set JUCE_USE_CURL to Default (Disabled) or Disabled.

1 Like

that’s strange, because it was already set to default (disabled).

lots of things may have got messed up moving the project from V4

Is there a way to automatically show which modules my code is actually using? I seem to have a few that are probably not needed.

On linux, we require libcurl as juce_core depends on it (we’ve deprecated the non-libcurl linux code some while ago). As every JUCE app needs at least juce_core your app will always depend on libcurl on Linux.

However, if you add the linker flag -Wl,--as-needed then you will only need libcurl when building your JUCE app (install the libcurl-dev packages) but your JUCE app will not depend on it at runtime if you do not use any networking functions.

You can check which library you app depends on by using the ldd command.

the list is about 1/3 the length when the same app is built with juce 4 rather than 5.

I will use that linker flag does that change all libs to as needed in the binary?

Yes. The increase in dependencies is due to the webview which we added in JUCE 5. You can easily disable it:

Or simply remove the juce_gui_extra module from your project.

OK, I naively assume that anything unused would by default not be included, I will try this.

so far all my problems are solved by reverting the whole project to Juce 4 - but the 2 versions don’t play nice together so Juce 5 is in danger of being put aside entirely.

I’m using -Wl,–as-needed

i have use curl turned off as above

i have removed juce crypto modules and juce gui extra and juce video and juce opengl (since it needs juceguiextras)

i have deleted the entire contents of my Linuxmakefile directory and recreated the makefile by saving in projucer

but ldd still shows the compiled app needing twice as many dependencies as V4 and they include libcurl and various crypto libs.

oops I was compiling with clang - if i compile with gcc the various stuff above works to reduce dependencies. I don’t understand why at all but OK.