Skip to content

linux vst3 requires position independent code to be enabled #397

@Alloyed

Description

@Alloyed

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
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    linuxEverything related to Linux

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions