Cabbage Logo
Back to Cabbage Site

Where to place dylib file for custom opcode?

I’m trying to build a custom opcode and so far I’ve been able to write and compile one but when I try to use it in csoundqt I get the following error message: error: syntax error, unexpected T_IDENT (token “newopc”) from file /Users/ghostchamb3r/CSD files/testys.csd (1), line 17:

asig newopc <<<

The csound code is:


-odac --opcode-lib="/Users/ghostchamb3r/CSD files/newopc.dylib"

</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1

instr 1

icps cpsmidi 
iamp ampmidi 1
asig newopc icps, iamp
outs asig*0.5, asig*0.5

endin

</CsInstruments>
<CsScore>

</CsScore>
</CsoundSynthesizer>

I’m wondering if perhaps the dylib file for it needs to be placed in a different directory? Any help would be mucho appreciated!

That looks fine ( although I had to format your code so I could read it, please use the </> button to format large chunks of code :slight_smile: ).

Can you try moving the dylib into the same folder as your .csd file for now so that you can simply pass the name of the opcode without the path? If it still fails, then I suspect there might be an issue with the opcode itself.

Is there any way the opcode isn’t actually named newopc, but something else? That would also cause the issue, even if the opcode library is valid.

1 Like

I got it to work late last night!
I had to move the dylib file to /Library/Frameworks/CsoundLib64.framework/Versions/6.0/Resources/Opcodes64

Then I had to add -arch x86_64 to the command line for compiling and it works! I’m on an apple silicon mac so I think it was compiling for arm64 not x86_64

Nice, although I can’t see anything wrong with how you were doing it. This used to work fine. But there is little point filing a ticket about it now considering Csound6 is done.