Csound can’t find/load custom plugin on Mac M1 Laptop

Dear Csounders!

I have some strange problem that Csound can’t find or load a plugin using option flag –opcode-lib.

Strange thing is that this problem only appears on M1 laptop. On my older Mac (not M1) and Windows laptop I don’t have this issue.

On both Macs I am compiling like this:
gcc -std=c++11 -O2 -dynamiclib -o myopcode.dylib myopcodesrc.cpp -DUSE_DOUBLE -I/Library/Frameworks/CsoundLib64.framework/Headers -lstdc++

I’ve also tested plugins written in C but problem is the same. In this case I’m compiling like this:
gcc -O2 -dynamiclib -o myopc.dylib opsrc.c -DUSE_DOUBLE -I/Library/Frameworks/CsoundLib64.framework/Headers

Error that I get is:
error: syntax error, unexpected T_IDENT, expecting T_OPCODE or T_FUNCTION or ',' or '=' (token "myopcode")

I’ve reinstalled the Csound but it didn’t help.

OS: macOS 11.6.8 (Big Sur)
Csound: Csound version 6.17 (double samples) Feb 2 2022 [commit: deff4f9aaeaf44f7db445c215f004bca8d50901f]

Any ideas what could be wrong?

It’s probably building arm64 binaries. For now Csound is x86_64. I usually use CMake to set arch types, but I@m sure you can do this from the command line too. You need to set it to universal, or x86_64.

1 Like

Thanks @rory! That was the problem.

I’m not expert in this stuff so I just experimented a bit with --target and -arch compile flags but without success.

In the end I made Xcode project :dizzy_face: and made a dynamic library for x86_64 architecture like that.

1 Like