Skip to content

Statically link libc and libc++ to vst3 when using mingw to build#454

Open
shockham wants to merge 5 commits intofree-audio:nextfrom
shockham:link-libc-mingw
Open

Statically link libc and libc++ to vst3 when using mingw to build#454
shockham wants to merge 5 commits intofree-audio:nextfrom
shockham:link-libc-mingw

Conversation

@shockham
Copy link
Copy Markdown

When building a VST3 for Windows on Linux using MinGW the resultant plugin would not work due to the missing libraries as they were dynamically linked.

Not sure if this is the best place or way of fixing this, so welcome to suggestions or updates to the PR.

@baconpaul
Copy link
Copy Markdown
Collaborator

my primary question is: if using mingw to build on windows, would this also work? I notice we don't have a CI stage for that but I think the GitHub windows runners do provide mingw.

@shockham
Copy link
Copy Markdown
Author

Good question, in order to verify am happy to add them to the matrix for the build_feature_clapfirst-test following the lead of the build_feature_cpm_download job which appears to cater for gcc/minGW already.

Is there a reason why the verifier is not set to run for single file windows builds?

Also noticed have added so would only impact the windows folder vst3, so will move to work with the single file build too.

@baconpaul
Copy link
Copy Markdown
Collaborator

Good question, in order to verify am happy to add them to the matrix for the build_feature_clapfirst-test following the lead of the build_feature_cpm_download job which appears to cater for gcc/minGW already.

Is there a reason why the verifier is not set to run for single file windows builds?

Also noticed have added so would only impact the windows folder vst3, so will move to work with the single file build too.

The verifier doesnt run for single file windows builds because the 3.8.0 verifier fails on non folder builds as invalid vst3s

Comment thread cmake/base_sdks.cmake
Comment on lines +192 to +194
if(MSVC_VST3_VALIDATOR)
set(MSVC_VALIDATOR_FLAG -DCMAKE_CXX_COMPILER="MSVC" -DCMAKE_C_COMPILER="MSVC" -G "Visual Studio 17 2022" -A x64)
endif()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some trouble getting the validator to build under MinGW, so figured using the MSVC build might be ok here?

Comment thread cmake/wrap_vst3.cmake
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${v3root}/${v3root_r}/${V3_OUTPUT_NAME}.vst3/Contents/${v3arch}-win"
SUFFIX ".vst3")
SUFFIX ".vst3"
PREFIX "")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validator wouldn't find the shared lib in the folder directory due to "lib" prefix being applied, so this strips that.

@baconpaul baconpaul changed the base branch from main to next April 9, 2026 15:39
#endif

const CLAP_EXPORT struct clap_plugin_entry clap_entry = {CLAP_VERSION, dist_entry_init,
CLAP_EXPORT extern const struct clap_plugin_entry clap_entry = {CLAP_VERSION, dist_entry_init,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh was just about to merge and i saw this change. Why the extern? this is fully defined here right? Sorry to be late seeing ghat.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries! It was to fix this issue when building with MinGW on windows: https://github.com/free-audio/clap-wrapper/actions/runs/23811973893/job/69513675175#step:6:176

For some reason MinGW seems to expect it even though it is already in the clap entry header and the issue isn't present when using MinGW on linux.

The other compilers appear to be okay with it, but doesn't feel ideal.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm and does it work? I wonder if the problem is actually that CLAP_EXPORT shoudl not be defined as dllexport on mingw but instead as attribute("export") or some such?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it works, as passes the VST3 validation, though I have not tested in a DAW myself

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

Successfully merging this pull request may close these issues.

2 participants