clap-wrapper
clap-wrapper copied to clipboard
linux vst3 requires position independent code to be enabled
tested on arch linux, with a cmake script I am cobbling together myself
example error:
/usr/bin/ld: libTemplate_vst3-clap-wrapper-vst3-lib.a(wrapasvst3_entry.cpp.o): warning: relocation against `_ZTVN9Steinberg3Vst18IContextMenuTargetE' in read-only section `.text._ZN9Steinberg3Vst18IContextMenuTargetC2Ev[_ZN9Steinberg3Vst18IContextMenuTargetC5Ev]'
/usr/bin/ld: libTemplate_vst3-clap-wrapper-vst3-lib.a(wrapasvst3_entry.cpp.o): relocation R_X86_64_PC32 against symbol `_ZNSt6vectorISt10shared_ptrI15CreationContextESaIS2_EED1Ev' can not be used when making a shared object; recompile with -fPIC
the trick in cmake for enabling -fPIC on a specific target looks like this
set_property(TARGET Template_vst3 PROPERTY POSITION_INDEPENDENT_CODE ON)
could this be added to the upstream vst wrapper targets?
I am pulling in clap-wrapper like so:
# TODO: needed for clap-wrapper, who should really be doing this for us
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# from git
FetchContent_MakeAvailable(clap clap-helpers clap-wrapper ....)
project(Template)
add_library(Template MODULE
src/plugin.cpp
)
target_include_directories(Template PUBLIC
include
PRIVATE
src
)
target_link_libraries(Template PRIVATE clap)
set_target_properties(Template PROPERTIES PREFIX "" SUFFIX ".clap")
add_library(Template_vst3 MODULE)
set_property(TARGET Template_vst3 PROPERTY POSITION_INDEPENDENT_CODE ON)
target_add_vst3_wrapper(TARGET Template_vst3
OUTPUT_NAME "Template"
SUPPORTS_ALL_NOTE_EXPRESSIONS TRUE
)
we should add this to all the endpoint targets i guess.
I pretty much always put https://github.com/baconpaul/six-sines/blob/83ce6881c269f0ef7e0a83901deda3362b036952/CMakeLists.txt#L3 at the top of every cmake file i write for plugins. I wonder though if this is something like link style and osx version where we should warn as opposed to decide.