Build an open future with us.

Invest in Mycroft and become a community partner.

Mycroft on FreeBSD


#1

Hello,

Is there a port of Mycroft to FreeBSD on the way? Thanks
Matthias


#2

Not under development at the moment, however if you want to see if you can install it under FreeBSD, the best file to have a read through is dev_setup.sh - this uses conditional processing to install the dependencies for various distributions.

For example, we could include a conditional loop for installing packages under pkgng for FreeBSD - this would be straightforward.


#3
[guru@c720-r314251 ~/Mycroft]$ uname -a
FreeBSD c720-r314251 12.0-CURRENT FreeBSD 12.0-CURRENT #1 r314251M: Fri Jun 30 08:50:03 CEST 2017     guru@c720-r314251:/usr/obj/usr/src/sys/GENERIC  amd64
[guru@c720-r314251 ~/Mycroft]$ ./dev_setup.sh
Installing packages...
I like FreeBSD
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent version of packages are already installed
...

to be continued …


#4

I fixed all dependency install, but then it stops:

$ ./dev_setup.sh
Installing packages...
pkg install git ...The most recent version of packages are already installed
pkg install python2 ...The most recent version of packages are already installed
pkg install py27-setuptools27 ...The most recent version of packages are already installed
pkg install py27-virtualenv ...The most recent version of packages are already installed
pkg install py27-gobject ...The most recent version of packages are already installed
pkg install py27-virtualenvwrapper ...The most recent version of packages are already installed
pkg install libtool ...The most recent version of packages are already installed
pkg install libffi ...The most recent version of packages are already installed
pkg install openssl ...part of the base system
pkg install autoconf ...The most recent version of packages are already installed
pkg install bison ...The most recent version of packages are already installed
pkg install swig ...The most recent version of packages are already installed
pkg install glib ...The most recent version of packages are already installed
pkg install portaudio ...The most recent version of packages are already installed
pkg install mpg123 ...The most recent version of packages are already installed
pkg install flac ...The most recent version of packages are already installed
pkg install curl ...The most recent version of packages are already installed
pkg install fann ...The most recent version of packages are already installed
pkg install gcc ...The most recent version of packages are already installed
+ git config commit.template .gitmessage
fatal: not in a git directory

#5

Did you do a git clone? Is git installed on your host?


#6

I did not. But now with a bit better understanding, I did. The build stops at some point with

rm -f unittests/*.o
test -z "unittests/hrg_test.log unittests/regex_test.log unittests/string_test.log unittests/token_test.log unittests/voice_select.log unittests/wave_test.log unittests/lex_test.log unittests/lts_test.log unittests/nums_test.log" || rm -f unittests/hrg_test.log unittests/regex_test.log unittests/string_test.log unittests/token_test.log unittests/voice_select.log unittests/wave_test.log unittests/lex_test.log unittests/lts_test.log unittests/nums_test.log
test -z "unittests/hrg_test.trs unittests/regex_test.trs unittests/string_test.trs unittests/token_test.trs unittests/voice_select.trs unittests/wave_test.trs unittests/lex_test.trs unittests/lts_test.trs unittests/nums_test.trs" || rm -f unittests/hrg_test.trs unittests/regex_test.trs unittests/string_test.trs unittests/token_test.trs unittests/voice_select.trs unittests/wave_test.trs unittests/lex_test.trs unittests/lts_test.trs unittests/nums_test.trs
test -z "test-suite.log" || rm -f test-suite.log
rm -f *.lo
Making all in .
  CC       src/audio/libttsmimic_la-au_alsa.lo
src/audio/au_alsa.c:61:20: fatal error: alloca.h: No such file or directory
 #include <alloca.h>

The complete nohup .out is here: http://www.unixarea.de/build-nohup.out

Is this the right place to move forward this thread?


#7

Is this the right place for debugging?

Yes, this is our official support forum. Our support for FreeBSD is ‘best effort’ - so I can certainly provide some pointers and guidance, but I can’t guarantee that we can get it working on FreeBSD - or variants like MacOS - for you. FreeBSD is quite different to our reference builds, which are -bian based (Raspbian, Ubuntu, Debian).

Compiler error

Firstly, a big thanks for providing the full log files, this was helpful.

From what I can tell with a little bit of reading, alloca.h is not included in the FreeBSD compiler tools, so that is why the build script is failing - it is a FreeBSD issue, not a Mycroft or mimic issue.

One of the workarounds I could suggest here is adding stdlib.h in ./dev_setup.sh bash script - by adding this line after #!/bin/bash at the top;

#include stdlib.h

That’s about the only suggestion I have at the moment - my guess is that there will likely be other issues as well in trying to compile for FreeBSD.


#8

There have been other errors, apart of the missing header file, raised in the nohup.out log:

...
  building 'sphinxbase._sphinxbase' extension
  swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c
  swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i
  unable to execute 'swig': No such file or directory
  error: command 'swig' failed with exit status 1

I fiexed this with:

sudo ln -s /usr/local/bin/swig2.0 /usr/local/bin/swig

I have had a look into your idea of changing the the shell script by adding the line for the #include ...
I do not see how such a bash-comment can fix anything. I modified the requesting C file in this way:

 diff ./mimic/src/audio/au_alsa.c*
61c61
< #include <stdlib.h>
---
> #include <alloca.h>
64,66d63
< void * alloca(size_t size);
<

and with this fix the compilation went through. I have in bin/ now:

$ ls -ltr mycroft-core/bin
total 36
-rwxr-xr-x  1 guru  wheel   789 Nov 16 21:46 mycroft-cli-client
-rwxr-xr-x  1 guru  wheel  1778 Nov 16 21:46 mycroft-help
-rwxr-xr-x  1 guru  wheel  1255 Nov 16 21:46 mycroft-mic-test
-rwxr-xr-x  1 guru  wheel   780 Nov 16 21:46 mycroft-msk
-rwxr-xr-x  1 guru  wheel   785 Nov 16 21:46 mycroft-msm
-rwxr-xr-x  1 guru  wheel   773 Nov 16 21:46 mycroft-pip
-rwxr-xr-x  1 guru  wheel   890 Nov 16 21:46 mycroft-say-to
-rwxr-xr-x  1 guru  wheel   894 Nov 16 21:46 mycroft-skill-testrunner
-rwxr-xr-x  1 guru  wheel   845 Nov 16 21:46 mycroft-speak

And now, what next? Thanks for your assistant.


#9

After disabling the md5sum -c test in the start script (BSD does not has -c), something starts:

Starting all mycroft-core services
Initializing...
stat: illegal option -- c
usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file|handle ...]
Changing ownership of /opt/mycroft to user: guru with group: wheel
Starting background service bus
CAUTION: The Mycroft bus is an open websocket with no built-in security
         measures.  You are responsible for protecting the local port
         8181 with a firewall as appropriate.
Starting background service skills
Starting background service audio
Starting background service voice
Starting cli
09:18:12.344 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /usr/home/guru/Mycroft-test/mycroft-core/mycroft/configuration/mycroft.conf loaded
09:18:12.458 - mycroft.configuration.config:load_local:109 - DEBUG - Configuration /usr/home/guru/Mycroft-test/mycroft-core/mycroft/configuration/mycroft.conf loaded
09:18:12.649 - mycroft.configuration.config:load_local:114 - DEBUG - Configuration '/etc/mycroft/mycroft.conf' not found
09:18:12.764 - mycroft.configuration.config:load_local:114 - DEBUG - Configuration '/home/guru/.mycroft/mycroft.conf' not found
09:18:12.931 - mycroft.identity:_load:44 - DEBUG - Loading identity
09:18:13.013 - mycroft.identity:_load:44 - DEBUG - Loading identity
09:18:13.021 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai:443
09:18:13.594 - urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/ HTTP/1.1" 301 106
09:18:13.603 - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): api.mycroft.ai:80
09:18:13.828 - urllib3.connectionpool - DEBUG - http://api.mycroft.ai:80 "GET /v1/device HTTP/1.1" 302 0
09:18:13.838 - urllib3.connectionpool - DEBUG - Resetting dropped connection: api.mycroft.ai
09:18:14.337 - urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device HTTP/1.1" 401 77
09:18:14.433 - mycroft.configuration.config:load_local:114 - DEBUG - Configuration '/var/tmp/mycroft_web_cache.json' not found
09:18:14.516 - mycroft.configuration.config:load_local:114 - DEBUG - Configuration '/etc/mycroft/mycroft.conf' not found
09:18:14.609 - mycroft.configuration.config:load_local:114 - DEBUG - Configuration '/home/guru/.mycroft/mycroft.conf' not found
09:18:14.619 - mycroft.client.text.text_client:load_settings:146 - INFO - Ignoring failed load of settings file
09:18:14.621 - mycroft.client.text.text_client:load_settings:147 - ERROR - [Errno 2] No such file or directory: '/home/guru/.mycroft_cli.conf'
Traceback (most recent call last):
  File "/usr/home/guru/Mycroft-test/mycroft-core/mycroft/client/text/text_client.py", line 133, in load_settings
    with io.open(config_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/guru/.mycroft_cli.conf'
e[?1049he[1;24re[me[4le[?1le>

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/curses/__init__.py", line 78, in wrapper
    cbreak()
_curses.error: cbreak() returned ERR

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/home/guru/Mycroft-test/mycroft-core/mycroft/client/text/__main__.py", line 61, in <module>
    main()
  File "/usr/home/guru/Mycroft-test/mycroft-core/mycroft/client/text/__main__.py", line 55, in main
    curses.wrapper(gui_main)
  File "/usr/local/lib/python3.5/curses/__init__.py", line 100, in wrapper
    nocbreak()
_curses.error: nocbreak() returned ERR

#10

This sounds like an issue with curses

https://docs.python.org/3/howto/curses.html

We uses curses for the display of the CLI but I don’t know exactly what the issue is here. Is curses installed in the Mycroft virtual environment in Python?

Do source venv-activate.sh from within the mycroft-core directory to activate the virtual environment then do pip list | grep curses to see which version of curses is installed.


#11

This did not show any curses. I installed now the devel version of ncurses. How can I rebuild all compiled modules?


#12

If you run ./dev_setup.sh it will recompile everything again


#13

No, it didn’t. not even after removing all below bin/*.


#14

I’m honestly not sure where to go from here - I don’t know a lot about FreeBSD at all.

I think that we’re definitely on the right track in terms of trying to ensure all the relevant dependencies are installed, but it’s very likely you will encounter issues with the FreeBSD compiler, especially in compiling mimic. It will definitely take some working through to get Mycroft running on FreeBSD - and as always we appreciate any assistance you can provide in helping us out here.


#15

Kathy, first of all thanks for your helping hands.

I realized that Mycroft was never ported to FreeBSD and that there are issues in using code which only works on Linux (smallest example md5sum -c in the start script). I will step by step trying to walk through and provide patches when I changed things for getting it up on FreeBSD. I have only not much time to work on this, but have not dropped the idea at all.

The curses issue seems to be a known bug in Python itself if you Google for the me message

./start-mycroft.sh debug
...
      File "/usr/home/guru/Mycroft-test/mycroft-core/mycroft/client/text/text_client.py", line 1078, in gui_main
        c = scr.get_wch()  # unicode char or int for special keys
    AttributeError: '_curses.curses window' object has no attribute 'get_wch'

I will see what I must do.


#16

What is your output of the command;

locale -a

I believe I run into this error with my project and was related to the wrong locale settings


#17

Ooooh good thinking @j1nx


#18

Yeah, only once in a while. Don’t get used to it… :rofl:


#19
locale -a
C
POSIX
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
am_ET.UTF-8
ar_AE.UTF-8
ar_EG.UTF-8
ar_JO.UTF-8
ar_MA.UTF-8
ar_QA.UTF-8
ar_SA.UTF-8
... 193 lines

What you are interesting in exactly?


#20

Damn, that are a lot of them :slight_smile:

Can you run the command without -a. Just; locale

Interested to see these;

LC_ALL
LANG

and perhaps

LANGUAGE