ambisonictoolkit / atk-sc3

An extension library for the SuperCollider programming language
GNU General Public License v3.0
74 stars 12 forks source link

ATK without GUI #100

Open giuliomoro opened 3 years ago

giuliomoro commented 3 years ago

I ran Quarks.install("https://github.com/ambisonictoolkit/atk-sc3.git"); on an embedded platform (Bela), where Sc 3.11.2 is installed, but it doesn't include any of the GUI stuff (Sc on this platform is built with -DNO_X11=ON -DSC_QT=OFF -DSC_IDE=OFF -DSC_EL=OFF -DSC_ED=OFF). After a successful install, if I start sclang I get:

compiling class library...
    Found 726 primitives.
    Compiling directory '/usr/share/SuperCollider/SCClassLibrary'
    Compiling directory '/usr/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MathLib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/FileLog'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/ExtraWindows'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SignalBox'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/Hilbert'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/XML'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/wslib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MatrixArray'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/PointView'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SphericalDesign'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/atk-sc3'
ERROR: Superclass 'View' of class 'PointViewRadianCtl' is not defined in any file.
/root/.local/share/SuperCollider/downloaded-quarks/PointView/Classes/PointViewUI.sc
ERROR: Superclass 'View' of class 'PointViewUI' is not defined in any file.
/root/.local/share/SuperCollider/downloaded-quarks/PointView/Classes/PointViewUI.sc
ERROR: Superclass 'EZSlider' of class 'EZSmoothSlider' is not defined in any file.
/root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Views/EZSmoothSlider.sc
ERROR: Superclass 'EZRanger' of class 'EZSmoothRanger' is not defined in any file.
/root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Views/EZSmoothRanger.sc
ERROR: Superclass 'View' of class 'PointView' is not defined in any file.
/root/.local/share/SuperCollider/downloaded-quarks/PointView/Classes/PointView.sc
ERROR: Class extension for nonexistent class 'FlowLayout'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Views/ExpandView.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extDrawIcon.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extPen-transformToRect.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extPen-roundedRect.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extPen-addCurve.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extPen-arrow.sc'
ERROR: Class extension for nonexistent class 'Gradient'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extGradient-fill.sc'
ERROR: Class extension for nonexistent class 'FlowLayout'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extSCWindow-asCode.sc'
ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Interpolation/extPen-splineCurve.sc'
ERROR: There is a discrepancy.
numClassDeps 1859   gNumClasses 3704

I seem to understand from the docs of ATK that it can be used from sclang directly and that it is not essential to use the GUI to use the package, so I am wondering whether there is any workaround for the above errors.

joslloand commented 3 years ago

What we're seeing is errors thrown regarding:

I have a feeling that we can get away with not installing PointView. Try removing this quark from your embedded installation. The associated PointView errors should no longer be thrown.


Regarding wslib, the problem is trickier, but should be trivial to resolve. Most of the errors thrown relate to classes found in the GUI folder. This folder could be discarded for an embedded install.

Also:

ERROR: Class extension for nonexistent class 'Pen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Interpolation/extPen-splineCurve.sc'

Pen is missing. Conveniently extPen-splineCurve.sc just contains a single extension for Pen, so this file could be removed from your install.


@giuliomoro , why don't you try these three things:

  1. remove PointView
  2. remove the GUI folder from wslib
  3. remove extPen-splineCurve.sc from wslib

Let me know how this goes. If this works, I expect the thing to do will be to add a note in the README.

giuliomoro commented 3 years ago

Removing the folders at this point was the only way, because trying to do anything with Quarks from within sclang was not possible due to the class library failure to compile. So I did:

rm -rf  ~/.local/share/SuperCollider/downloaded-quarks/PointView/
rm -rf  ~/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/
rm -rf  ~/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main\ Features/Interpolation/extPen-splineCurve.sc

at which point I get:

root@bela:~/Bela# sclang
compiling class library...
    Found 726 primitives.
    Compiling directory '/usr/share/SuperCollider/SCClassLibrary'
    Compiling directory '/usr/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MathLib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/FileLog'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/ExtraWindows'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SignalBox'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/Hilbert'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/XML'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/wslib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MatrixArray'
WARNING: Could not open directory: '/root/.local/share/SuperCollider/downloaded-quarks/PointView'
    To resolve this, either create the directory or remove it from your compilation paths.

    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SphericalDesign'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/atk-sc3'
ERROR: Class extension for nonexistent class 'ColPen'
     In file:'../../../../root/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extColPen-asSVGFile.sc'
    numentries = 1411787 / 22571388 = 0.063
    6249 method selectors, 3612 classes
    method table size 12009896 bytes, big table size 90285552
    Number of Symbols 16827
    Byte Code Size 614355
    compiled 718 files in 4.94 seconds

Info: 9 methods are currently overwritten by extensions. To see which, execute:
MethodOverride.printAll

compile done
localhost : setting clientID to 0.
internal : setting clientID to 0.
WARNING: Atk: kernels don't appear to be installed
Run 'Atk.downloadKernels' to attempt automatic installation
WARNING: Atk: matrices don't appear to be installed
Run 'Atk.downloadMatrices' to attempt automatic installation
Class tree inited in 0.18 seconds
Execution warning: Class 'GUI' not found
ERROR: Message 'current' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
    DoesNotUnderstandError:reportError
        arg this = <instance of DoesNotUnderstandError>
    Nil:handleError
        arg this = nil
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError
        arg this = <instance of Thread>
        arg error = <instance of DoesNotUnderstandError>
    Object:throw
        arg this = <instance of DoesNotUnderstandError>
    Object:doesNotUnderstand
        arg this = nil
        arg selector = 'current'
        arg args = [*0]
    Meta_AvailableFonts:getFonts
        arg this = <instance of Meta_AvailableFonts>
    Function:doOnStartUp
        arg this = <instance of Function>
    ArrayedCollection:do
        arg this = [*3]
        arg function = <instance of Function>
        var i = 0
    List:do
        arg this = <instance of List>
        arg function = <instance of Function>
    Meta_StartUp:run
        arg this = <instance of Meta_StartUp>
    Main:startup
        arg this = <instance of Main>
        var didWarnOverwrite = false
^^ ERROR: Message 'current' not understood.
RECEIVER: nil

sc3>

so I also did:

rm ~/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main\ Features/SVGFile/extColPen-asSVGFile.sc

and, from within sclang (now that I was allowed to):

 Quarks.uninstall("PointView")

When I start sclang now I get:

root@bela:~/Bela# sclang
compiling class library...
    Found 726 primitives.
    Compiling directory '/usr/share/SuperCollider/SCClassLibrary'
    Compiling directory '/usr/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/Extensions'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MathLib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/FileLog'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/ExtraWindows'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SignalBox'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/Hilbert'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/XML'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/wslib'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/MatrixArray'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/SphericalDesign'
    Compiling directory '/root/.local/share/SuperCollider/downloaded-quarks/atk-sc3'
    numentries = 1411771 / 22571388 = 0.063
    6249 method selectors, 3612 classes
    method table size 11997528 bytes, big table size 90285552
    Number of Symbols 16808
    Byte Code Size 614274
    compiled 717 files in 4.98 seconds

Info: 9 methods are currently overwritten by extensions. To see which, execute:
MethodOverride.printAll

compile done
localhost : setting clientID to 0.
internal : setting clientID to 0.
WARNING: Atk: kernels don't appear to be installed
Run 'Atk.downloadKernels' to attempt automatic installation
WARNING: Atk: matrices don't appear to be installed
Run 'Atk.downloadMatrices' to attempt automatic installation
Class tree inited in 0.18 seconds
Execution warning: Class 'GUI' not found
ERROR: Message 'current' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
    DoesNotUnderstandError:reportError
        arg this = <instance of DoesNotUnderstandError>
    Nil:handleError
        arg this = nil
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError
        arg this = <instance of Thread>
        arg error = <instance of DoesNotUnderstandError>
    Object:throw
        arg this = <instance of DoesNotUnderstandError>
    Object:doesNotUnderstand
        arg this = nil
        arg selector = 'current'
        arg args = [*0]
    Meta_AvailableFonts:getFonts
        arg this = <instance of Meta_AvailableFonts>
    Function:doOnStartUp
        arg this = <instance of Function>
    ArrayedCollection:do
        arg this = [*3]
        arg function = <instance of Function>
        var i = 0
    List:do
        arg this = <instance of List>
        arg function = <instance of Function>
    Meta_StartUp:run
        arg this = <instance of Meta_StartUp>
    Main:startup
        arg this = <instance of Main>
        var didWarnOverwrite = false
^^ ERROR: Message 'current' not understood.
RECEIVER: nil

sc3>

so ... not perfect yet! Any further suggestions?

joslloand commented 3 years ago

@giuliomoro, it looks like you're almost there.

This lines note that you need to finish the installation of the ATK by installing the kernels and matrices:

WARNING: Atk: kernels don't appear to be installed
Run 'Atk.downloadKernels' to attempt automatic installation
WARNING: Atk: matrices don't appear to be installed
Run 'Atk.downloadMatrices' to attempt automatic installation

But, otherwise, it looks like the ATK is ready to go.

What we're seeing here:

Execution warning: Class 'GUI' not found
ERROR: Message 'current' not understood.

Is a method call, current being made to the GUI class. Given that GUI has been removed, an error is thrown. We can see this in the report:

    Object:doesNotUnderstand
        arg this = nil
        arg selector = 'current'
        arg args = [*0]
    Meta_AvailableFonts:getFonts
        arg this = <instance of Meta_AvailableFonts>

Having had a look, I'm seeing that this call is being made in:

/wslib-classes/Main Features/SVGFile/SVGFile.sc

Try also removing the SVGFile folder from wslib. See if that works....

giuliomoro commented 3 years ago

ok,

m -rf ~/.local/share/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main\ Features/SVGFile/

did the trick. I then ran 'Atk.downloadKernels() and 'Atk.downloadMatrices() and I get no more warnings/errors when starting sclang. Great, thanks!

Do you have a simple code example that I can try to run to verify everything is working as expected?

joslloand commented 3 years ago

Excellent!

Can you put together a short write up detailing everything you had to do to get this to work? (Including installing SC.) I think it would be valuable to document what needs to be done to get things working on an embedded system.

Some simple examples can be found here.

In your write up you could also include a link or otherwise relevant test example.

Depending on the verbosity, this could be thrown in as a section in the README.