Build error on audio plugin host

24 posts / 0 new
Last post
altima_boy_2001
Offline
Last seen: 5 years 4 months ago
Joined: 19 Mar 2009 - 09:50
Build error on audio plugin host

First post...

I downloaded and built JUCE on linux (RHEL 4, 2.6.9-78.0.5.ELsmp). After learning about LUA/premake I got the JUCE demo to build and run, and have successfully built the audio plugins demo under VST_Linux creating the .so file. I don't have a VST host to run it in though.

I'm trying to build the audio plugins host included under juce/extras/ and get the following error:

juce_amalgamated.cpp:53012: error: `class juce::KeyPress::juce' has not been declared
juce_amalgamated.cpp:53012: error: expected unqualified-id before ')' token

Line 53012 looks like this:

KeyPress::KeyPress() throw()
: keyCode (0),
mods (0),
textCharacter (0)
{

I'm guessing somehow the class KeyPress didn't get declared before the compiler found this code...

I tried searching the forum and google and haven't come up with any solutions. I've previously coded C++ on Linux and Windows, but a little rusty since most of my programming in the last 3 years has been PHP...

Any ideas?

jules
Offline
Last seen: 5 hours 25 min ago
Joined: 29 Apr 2013 - 18:37

Sounds very odd. It'd be pretty much impossible to avoid including the KeyPress headers, so maybe the problem is a name-clash with some other headers that you've included as well?

altima_boy_2001
Offline
Last seen: 5 years 4 months ago
Joined: 19 Mar 2009 - 09:50

I started over by re-unziping the juce_1_46.zip files and rebuilding the Debug and Release libraries including VST 2.4 support. Then I went into the juce/extras/audio plugin host/build/linux and edited premake.lua to point to the correct vstsdk directory. Still had the same compile errors on juce_LibrarySource.cpp so I started looking at the source files.

I edited juce/extras/audio plugin/src/juce_LibrarySource.cpp changing

#include "../../../juce_amalgamated.cpp"
to
#include "../../../juce_amalgamated.h"

and now everything compiles :!: (Don't really understand why it was including a .cpp file in the first place...)

jules
Offline
Last seen: 5 hours 25 min ago
Joined: 29 Apr 2013 - 18:37

Including the .cpp is the whole point of the amalgamated version! You include all the code rather than linking to the library

kraken
kraken's picture
Offline
Last seen: 2 months 2 weeks ago
Joined: 9 Feb 2005 - 09:31

The problem is that KeyPress is defined in some X11 includes. If you look in the VST_Wrapper you can see we are removing X11 keypresses because we include also X11 headers before juce ones:

  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xatom.h>
  #undef KeyPress

sherman
Offline
Last seen: 2 years 5 months ago
Joined: 5 Dec 2011 - 04:34
Re: Build error on audio plugin host

Hey guys, I've been looking at JUCE on and off for a few months and finally decided to try it for a program I'm planning atm. I'll be implementing VST hosting so decided to start with the audio plugin host in the extras/ directory.

My main workstation runs Linux (Ubuntu 11.04 i686) and I've installed the libraries listed in this post. I downloaded the vstsdk2.4 and have set up my workspace like so:

workspace/libs/vstsdk2.4/ (vst_sdk2_4_rev2)
workspace/libs/juce/ (git clone from today)

and updated the Makefile of the audio plugin host example to match the above directory, relative to the Makefile:

$ pwd
/home/sherman/workspace/libs/juce/extras/audio plugin host/Builds/Linux/Makefile
$ sed -i -e 's@~/SDKs@../../../../..@' Makefile
$ grep vst Makefile     # output actually appears twice (Debug, Release)
CPPFLAGS := $(DEPFLAGS) -D "LINUX=1"  . . .   -I "../../../../../vstsdk2.4"  . . .
RESFLAGS :=  -D "LINUX=1" . . . -I "../../../../../vstsdk2.4" . . .

If you try to run make now, it will fail for what looks like the reason shown in this post.

$ make
Compiling FilterGraph.cpp
Compiling GraphEditorPanel.cpp
Compiling HostStartup.cpp
Compiling InternalFilters.cpp
Compiling MainHostWindow.cpp
Compiling JuceLibraryCode1.cpp
Compiling JuceLibraryCode2.cpp
In file included from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.mm:28:0,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:216,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32,
                 from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15:
../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp:1914:40: warning: multi-character character constant
(above warning repeated a few times on different lines)
In file included from ../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffectx.h:17:0,
                 from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp:105,
                 from ../../JuceLibraryCode/../../../amalgamation/../src/audio/plugin_host/formats/juce_VSTPluginFormat.mm:28,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:216,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32,
                 from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15:
../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffect.h:125:32: error: expected ‘)’ before ‘*’ token
(above error repeated a few times on different lines)
../../../../../vstsdk2.4/pluginterfaces/vst2.x/aeffect.h:149:2: error: ‘AEffectDispatcherProc’ does not name a type
(above error repeated a few times with the other types from the VSTCALLBACK typedefs in the same file)

with some additional errors following, due to the above.

The post mentioned above shows some changes to juce_VST_Wrapper.cpp, but this file isn't referenced in the audio plugin host project, so __cdecl is never defined (that I can find). If I modify juce_VSTPluginFormat.cpp as shown:

$ cat src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
#include "../../../core/juce_TargetPlatform.h"
#include "../../../../juce_Config.h"

#if JUCE_PLUGINHOST_VST && (JUCE_MAC_VST_INCLUDED || ! JUCE_MAC)

#if JUCE_WINDOWS
 #undef _WIN32_WINNT
 #define _WIN32_WINNT 0x500
 #undef STRICT
 #define STRICT 1
 #include <windows.h>
 #include <float.h>
 #pragma warning (disable : 4312 4355)
 #ifdef __INTEL_COMPILER
  #pragma warning (disable : 1899)
 #endif
#elif JUCE_LINUX
 #define __cdecl                         // <- Added define here
 #include <float.h>
 #include <sys/time.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #undef Font
 #undef KeyPress
 #undef Drawable
 #undef Time
#else
 #define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
 #include <Cocoa/Cocoa.h>
 #include <Carbon/Carbon.h>
 #undef Point
#endif

//==============================================================================
#include "../../../core/juce_StandardHeader.h"

#if ! (JUCE_MAC && JUCE_64BIT)

BEGIN_JUCE_NAMESPACE 

I can compile further and get the following errors:

$ make
Compiling FilterGraph.cpp
Compiling GraphEditorPanel.cpp
Compiling HostStartup.cpp
Compiling InternalFilters.cpp
Compiling MainHostWindow.cpp
Compiling JuceLibraryCode1.cpp
Compiling JuceLibraryCode2.cpp
In file included from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:359:0,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32,
                 from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15:
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:43:1: error: ‘juce’ in class ‘juce::Drawable’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:49:12: error: expected class-name before ‘::’ token
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/drawables/juce_Drawable.cpp:49:12: error: expected constructor, destructor, or type conversion before ‘::’ token
In file included from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated_template.cpp:369:0,
                 from ../../JuceLibraryCode/../../../amalgamation/juce_amalgamated2.cpp:32,
                 from ../../JuceLibraryCode/JuceLibraryCode2.cpp:15:
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:211:1: error: ‘juce’ in class ‘juce::Font’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:216:1: error: ‘juce’ in class ‘juce::Font’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:221:1: error: ‘juce’ in class ‘juce::Font’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:226:1: error: ‘juce’ in class ‘juce::Font’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:231:1: error: ‘juce’ in class ‘juce::Font’ does not name a type
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:242:8: error: expected class-name before ‘::’ token
../../JuceLibraryCode/../../../amalgamation/../src/gui/graphics/fonts/juce_Font.cpp:242:8: error: expected constructor, destructor, or type conversion before ‘::’ token
make: *** [build/intermediate/Debug/JuceLibraryCode2_683aaa00.o] Error 1

Finally, I modified juce_VSTPluginFormat.cpp again and commented out the lines that redefine Drawable, Font, etc... :

 $ cat src/audio/plugin_host/formats/juce_VSTPluginFormat.cpp
#include <pluginterfaces/vst2.x/aeffectx.h>

#if JUCE_MSVC
  #pragma warning (pop)
#endif

//==============================================================================
//#if JUCE_LINUX
// #define Font       JUCE_NAMESPACE::Font
// #define KeyPress   JUCE_NAMESPACE::KeyPress
// #define Drawable   JUCE_NAMESPACE::Drawable
// #define Time       JUCE_NAMESPACE::Time
//#endif

#include "../juce_PluginDescription.h"

Now if I run make, the build succeeds as expected.

Jules, sorry for the wall of text. I started writing this as I went and well, it turned more into my rambling notes to help me keep track. I'm still quite new to the codebase and was hoping to find my feet with the extras/ examples, so I have no idea if the above will break something else. From the thread I linked, it looks like you've encountered these issues elsewhere, and found fixes within the affected code. Could you confirm this change or provide more information on a possible fix? I haven't really looked at the git repo yet, do you accept user submitted fixes or should I use the bug tracker on the sourceforge page in future?

Wow, so now that's all over...

Hi, I'm new to the boards but have been lurking for a few weeks. I'm working on a performance-based sequencer and host and am eager to see how well juce can handle some of the heavy lifting so I can focus on the features and fun stuff :) I'm a software engineer and tester by day (c/c++ security middleware :S ), and techno/*step/uk-bass DJ and producer by night (and music software developer now too, it seems). I use a macbook at home and linux (my main OS) on my work/dev laptop, so my app will run on those (plus windows if I can find someone who wants to build/test on it). I'm sure I'll be spending some time in the mac/linux/audio parts of the forum, so see you all then.

--sherman

--sherman

jules
Offline
Last seen: 5 hours 25 min ago
Joined: 29 Apr 2013 - 18:37
Re: Build error on audio plugin host

Linux VST hosting is one of the very very few bits of code that I rely on other people's contributions for.. So hopefully someone who knows that side of things will be able to help you out here!

sherman
Offline
Last seen: 2 years 5 months ago
Joined: 5 Dec 2011 - 04:34
Re: Build error on audio plugin host

Ok, no worries. Like I said, everything looks ok for now. If it all comes crashing down, I'll provide more info.

--sherman

schmiedl
Offline
Last seen: 2 years 3 months ago
Joined: 4 Apr 2012 - 21:17
Re: Build error on audio plugin host

hi,
i had problems building the audio plugin host. thanks for your howto on making it work. unfortunately the program segfaults on startup. did you make any additional changes? gcc and clang builds both produced this:

schmiedl@satellite:~/ports/juce/extras/audio plugin host/Builds/Linux/build$ ./Plugin\ Host 
JUCE v1.53.107
ALSA device: hw:Intel,0 outs=2-2 ins=2-2 rates=3
Segmentation fault
schmiedl@satellite:~/ports/juce/extras/audio plugin host/Builds/Linux/build$ gdb Plugin\ Host 
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/schmiedl/ports/juce/extras/audio plugin host/Builds/Linux/build/Plugin Host...done.
(gdb) run
Starting program: /home/schmiedl/ports/juce/extras/audio plugin host/Builds/Linux/build/Plugin Host 
[Thread debugging using libthread_db enabled]
JUCE v1.53.107
ALSA device: hw:Intel,0 outs=2-2 ins=2-2 rates=3
[New Thread 0x7ffff1319700 (LWP 8443)]

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) 

thanks in advance,
chris

jules
Offline
Last seen: 5 hours 25 min ago
Joined: 29 Apr 2013 - 18:37
Re: Build error on audio plugin host

JUCE v1.53.107

Please don't report bugs in old versions of the code! Unless you can show the problem still exists in the latest version, you're wasting everyone's time!

Dri
Offline
Last seen: 3 months 6 days ago
Joined: 14 Jul 2010 - 13:51
Re: Build error on audio plugin host

Hi,

I got the same first problem as Sherman with the __cdecl stuff, which I fixed by opening the audio plugin host introjucer project and adding a precompiler flag "-D__cdecl=".
But then I have a different problem:

Compiling juce_audio_processors.cpp
In file included from ../../../../modules/juce_audio_processors/juce_audio_processors.cpp:68:0:
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:2021:41: warning: multi-character character constant [-Wmultichar]
[...]
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:235:8: error: ‘Display’ does not name a type
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:236:8: error: ‘XContext’ does not name a type
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:238:31: error: typedef ‘juce::EventProcPtr’ is initialized (use decltype instead)
../../../../modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp:238:31: error: ‘XEvent’ was not declared in this scope

It looks like Xlib.h is not included, so I added it to the top of juce_VSTPluginFormat.cpp. But then the declarations of some types in Xlib.h such as Time, conflict with the Juce ones. I presume there is some tuning to do in the "amalagamation" file juce_audio_processors/juce_audio_processors.cpp so that Xlib related code is parsed before juce's own types are declared, but I don't master this part of Juce enough to find what to do exactly.

Any ideas? Jules? Linux gurus?

Cheers,
Adrien

Pages