steinbergmedia / vst3sdk

VST 3 Plug-In SDK
Other
1.59k stars 162 forks source link

vst3sdk doesn't compile on Alpine Linux. #26

Closed anerss closed 3 years ago

anerss commented 5 years ago

Alpine Linux is not a GNU/Linux distro and gcc on Alpine doesn't define __gnu_linux__ only __linux, __linux__ and linux.

gcc -dM -E - < /dev/null | grep linux
#define __linux 1
#define __linux__ 1
#define linux 1

No platform is detected in pluginterfaces/base/fplatform.h, the #pragma error unknown platform doesn't do anything.
Since no platform was detected, PLUGIN_API is undefined which causes a lot of compiler errors.

[ 32%] Building CXX object CMakeFiles/vstgui_support.dir/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.cpp.o
In file included from /source/vst3sdk/base/source/fobject.h:44,
                 from /source/vst3sdk/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.h:11,
                 from /source/vst3sdk/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.cpp:5:
/source/vst3sdk/pluginterfaces/base/funknown.h:214:18: error: expected initializer before 'atomicAdd'
 int32 PLUGIN_API atomicAdd (int32& value, int32 amount);
                  ^~~~~~~~~
In file included from /source/vst3sdk/base/source/fobject.h:44,
                 from /source/vst3sdk/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.h:11,
                 from /source/vst3sdk/vstgui4/vstgui/plugin-bindings/vst3groupcontroller.cpp:5:
/source/vst3sdk/pluginterfaces/base/funknown.h:363:18: error: 'PLUGIN_API' declared as a 'virtual' field
  virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) = 0;
                  ^~~~~~~~~~
/source/vst3sdk/pluginterfaces/base/funknown.h:363:18: error: expected ';' at end of member declaration
  virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) = 0;
                  ^~~~~~~~~~
                            ;
/source/vst3sdk/pluginterfaces/base/funknown.h:363:76: error: ISO C++ forbids declaration of 'queryInterface' with no type [-fpermissive]
  virtual tresult PLUGIN_API queryInterface (const TUID _iid, void** obj) = 0;
                                                                            ^
/source/vst3sdk/pluginterfaces/base/funknown.h:368:17: error: 'PLUGIN_API' declared as a 'virtual' field
  virtual uint32 PLUGIN_API addRef () = 0;
                 ^~~~~~~~~~
/source/vst3sdk/pluginterfaces/base/funknown.h:368:17: error: expected ';' at end of member declaration
  virtual uint32 PLUGIN_API addRef () = 0;
                 ^~~~~~~~~~
                           ;
....

A quick and dirty workaround for now is to add __gnu_linux__ to CMAKE_CXX_FLAGS when configuring cmake.

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-D__gnu_linux__ -S /source/vst3sdk/ -B /build/

I have been able to build my plug-ins and run the validator test suits on Alpine using the workaround or by changing the platform check(line 79 in fplatform.h) to __linux__.

Is there anything that actually requires __gnu_linux__ to build or use the vst3sdk on Linux or would it be possible to change the Linux platform check to __linux__ instead of __gnu_linux__?

ygrabit commented 3 years ago

linux is used too now