danfrz/PLEBTracker

cmdbar.cpp:150:16: error: 'get_wch' was not declared in this scope

Opened this issue · 21 comments

I am trying to add a Dockerfile to this project, to ease installation (you can try it out by just installing docker)

I am having trouble getting it to run with this Dockerfile:

FROM alpine:3.7

COPY . /usr/local/plebtrk
WORKDIR /usr/local/plebtrk

RUN apk add --no-cache alpine-sdk ncurses-dev fftw-dev alsa-utils inotify-tools
RUN cd ./Tracker/src && make && ./INSTALL.sh && cd ../../Interpreter/src && make && ./INSTALL.sh

ENTRYPOINT ["plebtrk"]
docker build .

Sending build context to Docker daemon  58.77MB
Step 1/6 : FROM alpine:3.7
 ---> 3fd9065eaf02
Step 2/6 : COPY . /usr/local/plebtrk
 ---> Using cache
 ---> e456797f511b
Step 3/6 : WORKDIR /usr/local/plebtrk
 ---> Using cache
 ---> bf0c1788b56e
Step 4/6 : RUN apk add --no-cache alpine-sdk ncurses-dev fftw-dev alsa-utils inotify-tools
 ---> Using cache
 ---> e9ba090f6443
Step 5/6 : RUN cd ./Tracker/src && make && ./INSTALL.sh && cd ../../Interpreter/src && make && ./INSTALL.sh
 ---> Running in d5036bb0b085
g++ -c -o ../obj/cmdbar.o cmdbar.cpp -std=c++11 -I../include
cmdbar.cpp: In function 'bool editor::getCommand(const char*)':
cmdbar.cpp:150:16: error: 'get_wch' was not declared in this scope
     get_wch(&in);
                ^
make: *** [Makefile:23: ../obj/cmdbar.o] Error 1
The command '/bin/sh -c cd ./Tracker/src && make && ./INSTALL.sh && cd ../../Interpreter/src && make && ./INSTALL.sh' returned a non-zero code: 2

do I need to install ncurses differently in alpine, maybe?

I will try it out. I couldn't find anything that looked like that, but I will see if I can figure it out.

If nothing else, I can follow the ubuntu instructions and make the documented change in the Dockerfile, or maybe we can use a def to set it up right for different environments.

If you want to follow the docker progress, I'm working on it over here. I'll make a PR when I get it working.

Yeh, doesn't look like there is a ncursesw package in alpine. I do see some whateverw files in ncurses-dev I was hoping to get it working with a lighter docker- base, but I can convert it to ubuntu, if necessary.

alpine is not ubuntu, it's just sort of similar. it uses apk instead of apt, and no debs or ppa.

it's very light, a good choice generally as a base for docker images because it installs really fast and the downloaded image is pretty small.

what distro do you use to compile it without any trouble? maybe I could just start with that as the base.

Got it working with arch pretty quickly. I'll make the PR for that, and we can maybe lighten it up later. Should I also publish on docker hub, and add instructions for running to README? Happy to leave publishing to you, if you want it under your name on dockerhub, too.

It will be something like this:

You can try it out, without compiling anything, if you have docker installed with docker run -it konsumer/plebtrk

I'll wait till you publish to update README.

Basically, you can build/run local:

git clone git@github.com:konsumer/PLEBTracker.git
git checkout docker
docker build -t plebtracker .
docker run plebtracker

Then you login:

docker login --username=yourhubusername --email=youremail@company.com

Then you tag it. I recommend making it match a git tag, and using semver, so people can track back to it more easily. Below, instead of semver, I will use firstdocker:

docker tag plebtracker yourhubusername/plebtracker:firstdocker

and then people can run it with this:

docker run -it yourhubusername/plebtracker

it will default to pseudo-tag latest but they could run the specific tag, too:

docker run -it yourhubusername/plebtracker:firstdocker

I wasn't sure how to make the tracker play, though, so didn't get a chance to test sound.

Looks like getting it to play sound in docker might be more complicated. :(

Yeh, on my mac, this doesn't make sound:

docker run --entrypoint ./Interpreter/src/plebplay -it plebtracker examples/electrosmash.plb

I think for a linux docker host, you can do something like this:

docker build -t plebtracker .
docker run --device /dev/snd  --entrypoint ./Interpreter/src/plebplay -it plebtracker examples/electrosmash.plb

Yeh, from my research, audio seems to only work on linux hosts (since you can pass audio device through.) On windows & mac, it's not simple (you can use network audio like pulse, with a little trickery.)

I got docker set up and
docker run --device /dev/snd --entrypoint ./Interpreter/src/plebplay -it plebtracker examples/intrepid.plb
produces audio!

Unfortunately when I run docker run --device /dev/snd -it plebtracker the interface looks really messed up and doesn't produce sound. (Same result with and without the --device assignment)

image

I get same. I think this is caused by however your app figures out the terminal-sizing from the environment. I'm not really sure what it's supposed to look like, and other ncurses-based software doesn't seem to have this issue, for example Glances is a complex ncurses-based UI for monitoring docker:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it docker.io/nicolargo/glances

screen shot 2018-06-05 at 10 13 42 pm

I tried it with this command, and still got bad term layout, but there is probly some trick to make your term figure out how big the console is:

docker run -e TERM=xterm -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -it plebtracker examples/intrepid.plb

screen shot 2018-06-05 at 9 49 56 pm

I'm actually working on a text-based tracker myself, and was hoping I could get yours running on my box quickly, for inspiration & ideas :(

When I have more time, I'll run it in a virtualbox and check it out.