LV2 Builds Failing in CI Pipelines

Since updating to JUCE 7.0.4 it seems that some of my build pipelines are hitting this error when building LV2 plugins:

terminate called after throwing an instance of 'std::system_error'
  what():  Enable multithreading to use std::thread: Operation not permitted

Seems like that’s happening when generating the LV2 TTL files, but it’s hard to tell for sure. The builds will sometimes succeed and sometimes fail, but I haven’t been able to find a pattern just yet.

The juce_lv2_helper is built without linking to pthread, so I’m wondering if that could be the issue @reuk?

Some preliminary tests seem to confirm that this diff fixes the issue:

--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -845,7 +845,9 @@ function(_juce_add_lv2_manifest_helper_target)
     add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper)
     target_compile_features(juce_lv2_helper PRIVATE cxx_std_17)
     set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
-    target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS})
+    find_package(Threads REQUIRED)
+    target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS} Threads::Threads)

Do you have a consistent repro for the problem?

According to this SO answer the problem may be due to the order in which libraries are loaded. I’m not sure of the best way to test this, but a good start would be to try adding the LD_PRELOAD variable to your environment to see whether that also fixes the problem. If it does, then I think we can be fairly confident that the problem is to do with library loading order, in which case I think the fix you’ve suggested seems sensible.

Ah okay, after some more tests I’ve got a clearer picture of what’s going on:

  • The issue occurs consistently on GitHub Actions runners using the ubuntu-18.04 image. With the ubuntu-22.04 image, the issue no longer occurs.
  • While using ubuntu-18.04, using either the diff I pasted above, or the LD_PRELOAD environment variable as described in the SO answer, the issue no longer occurs.

This page has the exact specs for the different GitHub Actions runner images.

1 Like

Great, thanks for the additional testing. It sounds like adding pthread to the helper target is the way to go.

Thanks for reporting + investigating, that change is added here:

1 Like