CMake Linux VST3 Not Stripped?

Hi

Still totally digging CMake Juce6. I’ve noticed, though, that the VST3 it ejects has a non-stripped library file, whereas one of our team members who did a projucer build with juce6 got it stripped.

I’m not doing anything particularly special in my cmake file (you can see it here if you want https://github.com/surge-synthesizer/surge-fx/blob/master/CMakeLists.txt) but the resulting artefact vst3 is 13mb and if I do a strip -s on the .so after build it is 8mb, and still works.

Most likely scenario is that I am missing something in the CMake JUCE6 VST3 which would run the strip, but I couldn’t find anything in the doc. Less likely scenario is that the CMake lib isn’t stripping, and is with projucer, or something else. But thought I would add this here to see if anyone else sees it.

Thanks!

I expect this is a problem on our end, I’ll see if I can update juce_recommended_config_flags to auto-strip release builds.

2 Likes

It looks like the Projucer-generated makefile contains a rule named strip which runs strip --strip-unneeded $(TARGET). This rule doesn’t run by default, and moreover it appears to be broken in VST3 projects as $(TARGET) is not defined. I also can’t see anywhere where the -s flag is being passed to the linker. For these reasons, I think any discrepancy between the Projucer and CMake outputs is likely unrelated to symbol stripping.

That being said, if you want to add stripping to your CMake builds, I’d recommend adding a custom interface library which you can then link into any target which requires symbol stripping. That might look like this:

add_library(strip_flags INTERFACE)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    target_link_options(strip_flags INTERFACE $<$<CONFIG:Release>:-s>)
endif()

Now, when I do a build with the Projucer in Release configuration, I get an 11M build of the DSPModulePluginDemo Standalone, but the same target built with CMake (also in Release configuration) is around 6.2M.

Thank you!