Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.0: lv2lint fails on plugin #164

Closed
dvzrv opened this issue May 16, 2022 · 12 comments
Closed

2.2.0: lv2lint fails on plugin #164

dvzrv opened this issue May 16, 2022 · 12 comments

Comments

@dvzrv
Copy link
Contributor

dvzrv commented May 16, 2022

Hi! Similar to #125 I think this is again a problem with 2.2.0.

lv2lint 0.16.2
Copyright (c) 2016-2021 Hanspeter Portner (dev@open-music-kontrollers.ch)
Released under Artistic License 2.0 by Open Music Kontrollers
<http://yoshimi.sourceforge.net/lv2_plugin>
/build/.local/share/yoshimi/presets
Basic configuration /build/.config/yoshimi/yoshimi.config not found, will use default settings
/build/.local/share/yoshimi/presets
Configuration /build/.config/yoshimi/yoshimi-0.instance not found, will use default settings
Starting in LV2 plugin mode

Found 0 instruments in 0 banks
No bank 5 in root 5. Current bank is 5
Missing recent history file
    [FAIL]  Plugin Symbols
              binary exports superfluous globally visible symbols:
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesOS8_EEE10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation
                * _ZTSNSt13__future_base13_State_baseV27_SetterI9PADTablesNS0_19__exception_ptr_tagEEE
                * _ZTSSt19_Sp_make_shared_tag
                * _ZZNSt9once_flag18_Prepare_executionC4IZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS3_12_Result_baseENS7_8_DeleterEEvEEPbEJPS4_SC_SD_EEvRS_OT_DpOT0_EUlvE_EERSI_ENUlvE_4_FUNEv
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesOS8_EEE9_M_invokeERKSt9_Any_data
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesNS6_19__exception_ptr_tagEEEE9_M_invokeERKSt9_Any_data
                * _ZNSt15__exception_ptr12__dest_thunkISt12future_errorEEvPv
                * _ZTSNSt13__future_base13_State_baseV2E
                * _ZNSt13__future_base13_State_baseV29_M_do_setEPSt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEPb
                * _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE
                * ... there is more, but the rest is being truncated
              seeAlso: <http://lv2plug.in/ns/lv2core#binary>
  <http://yoshimi.sourceforge.net/lv2_plugin#ExternalUI>
    [FAIL]  UI Symbols
              binary exports superfluous globally visible symbols:
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesOS8_EEE10_M_managerERSt9_Any_dataRKSC_St18_Manager_operation
                * _ZTSNSt13__future_base13_State_baseV27_SetterI9PADTablesNS0_19__exception_ptr_tagEEE
                * _ZTSSt19_Sp_make_shared_tag
                * _ZZNSt9once_flag18_Prepare_executionC4IZSt9call_onceIMNSt13__future_base13_State_baseV2EFvPSt8functionIFSt10unique_ptrINS3_12_Result_baseENS7_8_DeleterEEvEEPbEJPS4_SC_SD_EEvRS_OT_DpOT0_EUlvE_EERSI_ENUlvE_4_FUNEv
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesOS8_EEE9_M_invokeERKSt9_Any_data
                * _ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_13_State_baseV27_SetterI9PADTablesNS6_19__exception_ptr_tagEEEE9_M_invokeERKSt9_Any_data
                * _ZNSt15__exception_ptr12__dest_thunkISt12future_errorEEvPv
                * _ZTSNSt13__future_base13_State_baseV2E
                * _ZNSt13__future_base13_State_baseV29_M_do_setEPSt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEPb
                * _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE
                * ... there is more, but the rest is being truncated
              seeAlso: <http://lv2plug.in/ns/lv2core#binary>
    [WARN]  UI Instance Access
              usage of instance-access is highly discouraged
              seeAlso: <http://lv2plug.in/ns/ext/instance-access>
    [WARN]  UI Mixed DSP/UI
              mixing DSP and UI code in same binary is discouraged
              seeAlso: <http://lv2plug.in/ns/extensions/ui#>
    [WARN]  UI Toolkit
              usage of unofficial external UI is discouraged
              seeAlso: <http://kxstudio.sf.net/ns/lv2ext/external-ui#Widget>
@abrolag
Copy link
Member

abrolag commented May 16, 2022 via email

@dvzrv
Copy link
Contributor Author

dvzrv commented May 20, 2022

It seems that when building without link time optimization (LTO) the error does not occur.

Not entirely sure whether this can be fixed on your end. For good measure I'll ping @ventosus and @falkTX here.

archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 20, 2022
Disable LTO as it leads to globally visible symbols in the plugin: Yoshimi/yoshimi#164

git-svn-id: file:///srv/repos/svn-community/svn@1209455 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue May 20, 2022
Disable LTO as it leads to globally visible symbols in the plugin: Yoshimi/yoshimi#164

git-svn-id: file:///srv/repos/svn-community/svn@1209455 9fca08f4-af9d-4005-b8df-a31f2cc04f65
@falkTX
Copy link

falkTX commented May 20, 2022

well the usual good practices for building and linking apply here.
for plugins, make sense to only export the needed functions, so lv2lint checks for that.
this can be kinda ignored on distributions and usage where all plugins are built the same way, from the same repos and sets of libs, but as commercial vendors begin to release custom builds for linux it also becomes a problem when proper care is not taken on plugin (and host side).

so the same rules as always apply:

  • plugins must be self-contained, as much as possible
  • do not make use of shared libs that might conflict with the host (like the usual gtk2 vs gtk3, aubio2 vs aubio3, etc)
  • hide the plugin function symbols so loading a plugin does not mess with the current host process
  • do not block the event loop / main thread from the plugin
  • do not allocate or otherwise do non-RT stuff during audio thread

I will welcome the day where lv2lint also checks for RT safety. so that if a plugin says it is RT safe, lv2lint could check directly for that (at least the most common bad practices anyway)

coming back to the topic at hand, here are a few steps to take:

  • plugin build with symbols hidden by default, unless debug build is requested
  • use a linker script to ensure only specific symbols get exported
  • limit the amount of shared libs used by the plugin
  • if possible, separate the DSP and UI, so capable hosts can sandbox the UI and have it not conflict with the audio
  • stop using fltk, as opening menus and dialogs blocks the main/current event loop

@abrolag
Copy link
Member

abrolag commented May 20, 2022 via email

@abrolag
Copy link
Member

abrolag commented May 20, 2022 via email

@falkTX
Copy link

falkTX commented May 20, 2022

I still think the amount of effort spent on Yoshimi is kinda wasted, after zynaddsubfx got a maintainer and substantial amount of work put into it.
I gave up on trying to convince anyone to merge efforts. For all I know, Mark/fundamental (current maintainer) wishes for the same, it is on Yoshimi side that things do not want to move into that direction.
Very sad state of affairs, and a bit shameful for the community in my opinion.

It is nothing personal, more about seeing projects diverge instead trying to merge. We have very few hands on the linux audio side, collaboration could achieve great things, but everyone prefers to do its own thing instead. Probably too late for that perhaps.

@abrolag
Copy link
Member

abrolag commented May 20, 2022 via email

@falkTX
Copy link

falkTX commented May 20, 2022

UIs and plugins are complicated, because the use of big popular frameworks is often not suitable.
I wish the situation was better than it is, there are a few nice little projects for it like pugl, but they are very low-level.
Graphic frameworks do not really take into account window embedding usually.

@abrolag
Copy link
Member

abrolag commented May 25, 2022 via email

@falkTX
Copy link

falkTX commented May 25, 2022

Those URIs are not URLs, they do not need to point to places that actually exist.
I have changed the domain of kxstudio, but still keep the lv2 extensions up to date to anything they might need.
https://github.com/KXStudio/LV2-Extensions has the latest, and https://git.kx.studio/KXStudio/LV2-Extensions as mirror in case something happens to github.

@abrolag
Copy link
Member

abrolag commented May 25, 2022 via email

@kramlie
Copy link
Contributor

kramlie commented Jun 20, 2022

A bit late to the party, but I'm surprised that lv2lint is complaining about globally visible symbols. We already tried to fix this here. Is arch ignoring our build arguments and using their own? It needs to pass the -fvisibility=hidden argument.

IIRC, the symbols it's talking about are the "GLOBAL DEFAULT" ones. On my system I get only these:

$ readelf -s LV2_Plugin/yoshimi_lv2.so | grep 'GLOBAL *DEFAULT' | grep -v ' UND '
   491: 00000000005d7420    23 FUNC    GLOBAL DEFAULT   14 lv2ui_descriptor
   509: 00000000005d73f0    35 FUNC    GLOBAL DEFAULT   14 lv2_descriptor
   528: 00000000009a2350     0 NOTYPE  GLOBAL DEFAULT   26 _edata
   543: 00000000009a2350     0 NOTYPE  GLOBAL DEFAULT   27 __bss_start
   549: 0000000000dda968     0 NOTYPE  GLOBAL DEFAULT   27 _end
 13632: 00000000009a2350     0 NOTYPE  GLOBAL DEFAULT   26 _edata
 13665: 00000000005d73f0    35 FUNC    GLOBAL DEFAULT   14 lv2_descriptor
 13770: 00000000005d7420    23 FUNC    GLOBAL DEFAULT   14 lv2ui_descriptor
 13973: 0000000000dda968     0 NOTYPE  GLOBAL DEFAULT   27 _end
 14018: 00000000009a2350     0 NOTYPE  GLOBAL DEFAULT   27 __bss_start

In other words not much, and only two function definitions, the two that we want.

@abrolag abrolag closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants