Closed harryhaaren closed 6 years ago
Hi @harryhaaren, I am trying to compile this branch but am failing to tell Luppp about Ctlra.
Is it correct to compile Ctlra separately (with meson build && cd build && ninja
)? How do I link Ctlra so that Luppp’s compile.sh
finds it? Or does meson (for Luppp) replace running compile.sh
? Sorry if this might be obvious …
Hey @coderkun ; good question! You must install Ctlra to make Luppp pick it up:
$ cd /path/to/ctlra/
meson configure -Dprefix=/usr
ninja install # note this installs to your system-wide location
Then in Luppp
meson build
cd build
ninja
Make sure that you have "libtcc" installed too, the Luppp implementation depends on it.
Good luck, and post back if you're having issues. Cheers! -H
@harryhaaren, I would really like to avoid installing Ctlra system-wide. Therefore I tried to install it in ~/.local
with the following steps:
meson --prefix ~/.local build
ninja -C build
ninja -C build install
PKG_CONFIG_PATH=~/.local/lib/pkgconfig/ meson build
So the meson build
for Luppp finds the Ctlra dependency but fails with this error:
meson.build:38:2: ERROR: Could not generate cargs for openav_ctlra:
Investigating further reveals that I might be missing the AVTK library:
$ PKG_CONFIG_PATH=~/.local/lib/pkgconfig/ pkg-config --cflags --libs openav_ctlra
Package openav_avtka was not found in the pkg-config search path.
Perhaps you should add the directory containing `openav_avtka.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openav_avtka', required by 'openav_ctlra', not found
Unfortunately OpenAV-AVTK does not ship with a PKG-Config file and also does not provide an “install” target, does it?
Sorry for bothering you with these environmental issues …
@coderkun - nice work - you're making good progress!
Note that there are now two (very similarly named) UI toolkits, AVTK (the old C++ one) and AVTKA (which Ctlra uses, and is a simpler plain-C re-write).
Ctlra is looking for AVTKA. You can install it using the same method as you did for using Ctlra, by prefixing the PKG_CONFIG_PATH env var, and then building Ctlra, and after that Luppp.
There are ways to make Luppp download / compile Ctlra / Avtka directly (using Meson), which would remove this issue for you. I'll consider adding it ASAP after merging this - to make it easier to test / deploy.
Thanks for your work on this - let me know if the above helps enough, or if I should prioritize adding the "automated" download / compile of Ctlra/Avtka for Luppp.
Some progress here. First, thanks for the hint re “Avtka”, @harryhaaren, I had the wrong one. To summarize first, I am able to build all three libraries/application but have issues with ctlra_test.c
. Here is how I compile now:
First I had to fix Avtka’s “gd” dependency to be lowercase (“GD” does not find it for me)
Then I build all three libraries/applications with the same commands (though install
does not do anything for Luppp):
PKG_CONFIG_PATH=~/.local/lib/pkgconfig/ meson --prefix ~/.local build
ninja -C build
ninja -C build install
Finally I run Luppp with the following
cd /path/to/luppp/gcc
$ LD_LIBRARY_PATH=~/.local/lib/ ../build/luppp
The last commad starts Luppp properly but complains about ctlra_test.c
. One issue seems to be that stdio.h
is missing – though I am not certain about tcc here. If I fix that tcc complains about additional issues but does not give any useful error message.
I am not sure if these additional issues are due to my environment or due to one of these steps. But it some progress which I want to document. Let me know, if this is not the right place for that.
@coderkun - great progress! The last steps are to copy a few files to the "build" folder. Again this step should be made automatic - or somehow easier for testing, alpha quality code here.
From Ctlra, copy event.h
to the build directory
From the build dir, copy the "luppp_script_api.h" file:
cp ../src/controller/luppp_script_api.h .
Finally a header called "pstdint.h" is required,
wget https://raw.githubusercontent.com/mongodb/mongo-perl-driver/master/pstdint.h
At the end, there should be beside the luppp
binary, the event.h
file from Ctlra, pstdint.h
and luppp_script_api.h
for the Luppp control itself. The ctlra_test.c
file is the TCC enabled "script" that you can modify at runtime and remap controllers.
Note: the <luppp>/gcc
directory has the pstdint.h and ctlra_test.c files already present.
meson gcc # that should be enough to build Luppp in the gcc directory :)
Let me know how that goes - its the last step I think... -H
The build etc. all works fine now (using gcc
as the build folder) but starting Luppp still complains about the Ctlra script:
$ cd gcc
$ LD_LIBRARY_PATH=~/.local/lib/ ./luppp
[…]
[Luppp] Gui:475: Add Ctlra Controller in GUI()
[Luppp] CtlraScript:311: CtlraScript() got file ctlra_test.c
TCC ERROR: ctlra_test.c:27: warning: implicit declaration of function 'printf'
TCC ERROR: /usr/lib/tcc/libtcc1.a:1: error: declaration expected
failed to alloc mem for program
TCC ERROR: /usr/lib/tcc/libtcc1.a:1: error: declaration expected
failed to relocate code to program memory
compile failed
[Luppp] Gui:482: Ctlra Controller initialization failed!
@harryhaaren, I am not sure what I am doing wrong. Do you have any clue or any hint how to proceed?
I have the same issue. Obviously compiling the ctlra_test.c fails for any reason. the first error could be fixed by
#include <stdio.h>
remains the memory allocation error without any further information.
Do you think the version of tcc
could cause a difference? I am using 0.9.27, @harryhaaren, which one are you using?
Here is the Howto build the branch: https://github.com/openAVproductions/openAV-Luppp/wiki/Building-ctlra_v1-branch Will keep it updated, maybe a good tool so simplify the progress.
gcc/ should be added to .gitignore
Finally success: It works for me using tcc 0.9.26! I created an issue for Cltra for this: openAVproductions/openAV-Ctlra#79.
Now I can start testing the actual functionality. Sorry for all the noise.
@coderkun thanks for your perseverence! Lets see how you go from here :)
@georgkrause This is a WIP branch - and the gcc/
directory contains useful files for testing. You're right in that it shouldn't be merged as is - and that's also not the intention.
@harryhaaren sorry because of this gcc folder, i thought all stuff in there is generated, but now i know its in the repository. my fault, nevermind and sorry!
I'm closing this PR. The Ctlra codebase could still be used directly by Luppp, but there is not a huge advantage to doing so. The Mappa PR (https://github.com/openAVproductions/openAV-Luppp/pull/241) is a much smaller code-change, and provides better runtime user-experience as well as easier integration for users.
Cancelling this PR doesn not mean that there will not be Ctlra support in Luppp. The hardware device IO will still use Ctlra library, but the Mappa API is used (instead of raw ctlra) to also fix the mapping of hw->sw problem.
Initial implementation of Ctlra support for Luppp. This is based on POC code from ~2016, when the Ctlra library was being designed. Since then the API has seen lots of updates, and these commits hack those changes into Luppp.
Note that the actual architecture of the current implementation is not correct, as the ctlra_idle_poll() function is called from the real-time audio context. This means that these patches are NOT ready for use on stage, as they WILL cause glitches and Xruns when Ctlra enabled devices are plugged into your system.
This PR is here to show the workings of Ctlra and Luppp - and to allow alpha testers etc to get access to the codebase. More commits will be pushed as time permits! -H