JUCE, Python, PYO


Hi all,
In the last 6 months I built a few JUCE plugins …
I am trying to embed a simple PYO application into JUCE without a great deal of luck.

I am using Xcode 9.1
JUCE version 5.2.0
Pyo 0.8.0
Python 2.7.13

I followed these instructions

I had to create the files and then drag them into the source folder of the projucer project before adding them otherwise Xcode had trouble finding the header files in the #include statements.
I also had to be careful not to compile or create binaries for files that didn’t need that.

Prepare to play looks like this
pyo.setup(getTotalNumOutputChannels(), samplesPerBlock, sampleRate);
getNumOutputChannels() is depreciated in JUCE

I also left these lines in the process block from the file JUCE created
const int totalNumInputChannels = getTotalNumInputChannels();
const int totalNumOutputChannels = getTotalNumOutputChannels();

and added

At this point I have a number of linker errors like :

Undefined symbols for architecture x86_64:
"_PyEval_AcquireLock", referenced from:
_pyo_new_interpreter in libWayloChorus6.a(PyoClass-49E47892F43FB590.o)

I suspect it’s a matter of adding the correct linker paths from the xcode project to
python .


I spent a lot of time on it today …
Bed time now.
Perhaps someone else has some thoughts here.
It would be nice to get this all to work properly and work towards making a VST with PYO .

If anyone has had any luck linking JUCE and python with Xcode let me know thanks



I tried everything to no avail.
There seems to be a couple of different Python directories on my mac

Is there a way to add these as linker search paths in the projucer ?

I have solved this sort of problem before in Clion I was thinking that I might try and export to clion and see if I can add those to the cmake lists . txt file somehow and make it work …


Add -L/usr/local/Cellar/python to the “Extra linker flags” field


Thanks t0m ,
I tried adding that filepath to “other linker flags” under build settings and debug with no luck
I found “extra linker flags” in projucer …
I added all this …

Still no luck !
That seems to produce a new Apple LLVM 9.0 error
clang: error: cannot specify -o when generating multiple output files

The errors seem to be disappearing ? Down to this possibly …
ld: can’t map file, errno=22 file ‘/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7’ for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I searched the filepath in xcode there is a DIRECTORY there called python2.7 … When searching some of the folders appear to be aliases …


Oh, sorry. It’s the end of quite a long day.

Add /usr/local/Cellar/python to “Extra library search paths” in each build configuration. This is a much more robust way of doing things. Then look at the linker command in the Xcode build log - you should be able to see the path you added.

Which Python installation are you targeting? Your homebrew installed one is likely to be different to the system installed one, so it’s probably unwise to add both paths at once.

You might also want to try adding Python to “Extra Frameworks” instead of all that…


The only think that worked was adding “Python” in Extra Frameworks and leaving the Extra library search paths blank.
New problems now! After building the VST isn’t recognized by cubase 8.5. It’s not visible. I can load the VST3 but starting the plugin causes somesort of buffer overflow, a loud digital pop and the the meters to head to the top and stay there. The plugin loads in reaper as an .au and vst3 and seems to work. The .au component wont load in mainstage3. It “crashes” the apple testing it says. Perhaps I should be emailing cubase at this point ? Other VST plugins ( midi only ) I created with JUCE will load in cubase and work fine. Perhaps I should try building a very simple audio VST with a bit of gain or something and see if it will load … Thanks for your help t0m!! The battle has been won but the war is not over!


Well I got the VST3 to load in cubase.
I love how it sounds …

I turned off the “ASIO guard” in cubase 8.5
I think there is a problem with the size of the buffers being sent around . It’s all a bit beyond me. I might try a modified version with a small buffer size set in PYO.