Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Adding plugin opcodes to WASM/Emscripten build

Date2017-09-04 23:15
FromEd Costello
Subject[Csnd-dev] Adding plugin opcodes to WASM/Emscripten build
Hi,
I am trying to add csound plugins which have no external dependencies to the WASM/Emscripten build.
I was able to compile csound and the plugin opcodes to llvm byte code using emmake, then I tried adding libarrayops.so (for arrayops.cpp) to the final binary using emcc and was actually successful. I then tried to add libpvsops.so (for pvsops.cpp) as well but unfortunately this gave me a duplicate symbol error: error: Linking globals named 'csoundModuleCreate': symbol multiply defined! Does anyone have any pointers on how I could fix this?

Date2017-09-04 23:51
FromMichael Gogins
SubjectRe: [Csnd-dev] Adding plugin opcodes to WASM/Emscripten build
Some plugins already are statically linked for WASM. The code is in
csound/Top/init_static_modules.c, just follow the pattern there. Each
module has to have a renamed csoundModuleCreate function to prevent
your problem, so the opcode itself then also has to be modified to
match, see for example ftsamplebank.cpp.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Sep 4, 2017 at 6:15 PM, Ed Costello  wrote:
> Hi,
> I am trying to add csound plugins which have no external dependencies to the WASM/Emscripten build.
> I was able to compile csound and the plugin opcodes to llvm byte code using emmake, then I tried adding libarrayops.so (for arrayops.cpp) to the final binary using emcc and was actually successful. I then tried to add libpvsops.so (for pvsops.cpp) as well but unfortunately this gave me a duplicate symbol error: error: Linking globals named 'csoundModuleCreate': symbol multiply defined! Does anyone have any pointers on how I could fix this?

Date2017-09-05 14:36
FromEd Costello
SubjectRe: [Csnd-dev] Adding plugin opcodes to WASM/Emscripten build
I see that there, I am however using Victor’s CPOF to develop plugins and I’m not sure if I can do something similar.
Ed

> On 4 Sep 2017, at 23:51, Michael Gogins  wrote:
> 
> Some plugins already are statically linked for WASM. The code is in
> csound/Top/init_static_modules.c, just follow the pattern there. Each
> module has to have a renamed csoundModuleCreate function to prevent
> your problem, so the opcode itself then also has to be modified to
> match, see for example ftsamplebank.cpp.
> 
> Regards,
> Mike
> 
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
> 
> 
> On Mon, Sep 4, 2017 at 6:15 PM, Ed Costello  wrote:
>> Hi,
>> I am trying to add csound plugins which have no external dependencies to the WASM/Emscripten build.
>> I was able to compile csound and the plugin opcodes to llvm byte code using emmake, then I tried adding libarrayops.so (for arrayops.cpp) to the final binary using emcc and was actually successful. I then tried to add libpvsops.so (for pvsops.cpp) as well but unfortunately this gave me a duplicate symbol error: error: Linking globals named 'csoundModuleCreate': symbol multiply defined! Does anyone have any pointers on how I could fix this?

Date2017-09-05 18:24
FromMichael Gogins
SubjectRe: [Csnd-dev] Adding plugin opcodes to WASM/Emscripten build
Sure you can. You just have to do what my example does about the
module registration functions.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Tue, Sep 5, 2017 at 9:36 AM, Ed Costello  wrote:
> I see that there, I am however using Victor’s CPOF to develop plugins and I’m not sure if I can do something similar.
> Ed
>
>> On 4 Sep 2017, at 23:51, Michael Gogins  wrote:
>>
>> Some plugins already are statically linked for WASM. The code is in
>> csound/Top/init_static_modules.c, just follow the pattern there. Each
>> module has to have a renamed csoundModuleCreate function to prevent
>> your problem, so the opcode itself then also has to be modified to
>> match, see for example ftsamplebank.cpp.
>>
>> Regards,
>> Mike
>>
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>>
>>
>> On Mon, Sep 4, 2017 at 6:15 PM, Ed Costello  wrote:
>>> Hi,
>>> I am trying to add csound plugins which have no external dependencies to the WASM/Emscripten build.
>>> I was able to compile csound and the plugin opcodes to llvm byte code using emmake, then I tried adding libarrayops.so (for arrayops.cpp) to the final binary using emcc and was actually successful. I then tried to add libpvsops.so (for pvsops.cpp) as well but unfortunately this gave me a duplicate symbol error: error: Linking globals named 'csoundModuleCreate': symbol multiply defined! Does anyone have any pointers on how I could fix this?

Date2017-09-05 18:39
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Adding plugin opcodes to WASM/Emscripten build
You can use that approach: in your module define a csoundModuleCreate()  that calls
the template function plugin<>() that registers the plugin (instead of putting it in
onload()). Don’t include modload.h in that case.
Then follow what Mike suggests.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 5 Sep 2017, at 14:36, Ed Costello  wrote:
> 
> I see that there, I am however using Victor’s CPOF to develop plugins and I’m not sure if I can do something similar.
> Ed
> 
>> On 4 Sep 2017, at 23:51, Michael Gogins  wrote:
>> 
>> Some plugins already are statically linked for WASM. The code is in
>> csound/Top/init_static_modules.c, just follow the pattern there. Each
>> module has to have a renamed csoundModuleCreate function to prevent
>> your problem, so the opcode itself then also has to be modified to
>> match, see for example ftsamplebank.cpp.
>> 
>> Regards,
>> Mike
>> 
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>> 
>> 
>> On Mon, Sep 4, 2017 at 6:15 PM, Ed Costello  wrote:
>>> Hi,
>>> I am trying to add csound plugins which have no external dependencies to the WASM/Emscripten build.
>>> I was able to compile csound and the plugin opcodes to llvm byte code using emmake, then I tried adding libarrayops.so (for arrayops.cpp) to the final binary using emcc and was actually successful. I then tried to add libpvsops.so (for pvsops.cpp) as well but unfortunately this gave me a duplicate symbol error: error: Linking globals named 'csoundModuleCreate': symbol multiply defined! Does anyone have any pointers on how I could fix