PLEBTracker icon indicating copy to clipboard operation
PLEBTracker copied to clipboard

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

Open konsumer opened this issue 7 years ago • 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?

konsumer avatar Jun 04 '18 22:06 konsumer

That's likely the same issue as in Ubuntu (as detailed in the readme.md) On some distributions they separate wide character capabilities into ncurses and ncursesw. Check to see if there are ncursesw alternative packages (e.g. libncursesw5 and libncursesw5-dev) available to you.

If you do install those, unfortunately that also means that the #include directives in the header files in Tracker/include/ and Tracker/src/main.cpp need to change to point to that library, so in the ncursesw5 example would be #include<ncursesw/ncurses.h> and the LIBS variable in Tracker/src/Makefile would change to -lncursesw rather than - lncurses.

Sorry about that.

Tell me if that works or doesn't work for ya. Thanks for contacting me, I'm happy to help!

On Mon, Jun 4, 2018, 17:38 David Konsumer [email protected] wrote:

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/plebtrkWORKDIR /usr/local/plebtrk RUN apk add --no-cache alpine-sdk ncurses-dev fftw-dev alsa-utils inotify-toolsRUN 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?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7qnOO1VLHDpRA3WIm1IRRfm8VQQCks5t5bbvgaJpZM4UZ41Y .

danfrz avatar Jun 04 '18 23:06 danfrz

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.

konsumer avatar Jun 04 '18 23:06 konsumer

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.

konsumer avatar Jun 04 '18 23:06 konsumer

Well, it is just one package. I don't really Ubuntu much but can't you add like a ppa or something? Or just manually install the one package. Ncursesw5 shouldn't depend on any Ubuntu packages. I'd hope

On Mon, Jun 4, 2018, 18:09 David Konsumer [email protected] wrote:

Yeh, doesn't look https://pkgs.alpinelinux.org/packages?name=ncurses&branch=edge like there is a ncursesw package in alpine. I was hoping to get it working with a lighter docker- base, but I can convert it to ubuntu.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16#issuecomment-394528594, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7nJ0HIpgbFFK6iutQfAaORRtD9mYks5t5b4YgaJpZM4UZ41Y .

danfrz avatar Jun 04 '18 23:06 danfrz

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

konsumer avatar Jun 04 '18 23:06 konsumer

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.

konsumer avatar Jun 04 '18 23:06 konsumer

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

konsumer avatar Jun 04 '18 23:06 konsumer

I built it on archlinux (recently) and debian (a year ago?) without needing to get fancy with the packages (arch is my preferred flavor). It takes some work to get arch set up, if you haven't set it up before. But it is pretty light weight. Otherwise debian worked well, and you probably know more about debian than I do haha. I don't know how heavy it is.

On Mon, Jun 4, 2018 at 6:19 PM, David Konsumer [email protected] wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16#issuecomment-394530441, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7p_y6GH2Pt9DtopIXK6uDKyvmTA8ks5t5cCVgaJpZM4UZ41Y .

danfrz avatar Jun 04 '18 23:06 danfrz

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

konsumer avatar Jun 04 '18 23:06 konsumer

Awesome! okay :D I'll make a docker account and publish it. Feel free to add instructions to the README. I have only poked around with docker for like a cumulative hour a year ago but this is really cool and I will definitely credit you for setting this up :). How do I publish it?

On Mon, Jun 4, 2018 at 6:51 PM, David Konsumer [email protected] wrote:

Got it working with arch https://asciinema.org/a/VvpE1POg74CKtdQW4Mh7aDH6B 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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16#issuecomment-394535989, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7lffArCsseLu4VNCJ4wF5mj23gupks5t5cgBgaJpZM4UZ41Y .

danfrz avatar Jun 05 '18 00:06 danfrz

I'll wait till you publish to update README.

Basically, you can build/run local:

git clone [email protected]:konsumer/PLEBTracker.git
git checkout docker
docker build -t plebtracker .
docker run plebtracker

Then you login:

docker login --username=yourhubusername [email protected]

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

konsumer avatar Jun 05 '18 00:06 konsumer

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

konsumer avatar Jun 05 '18 00:06 konsumer

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

konsumer avatar Jun 05 '18 00:06 konsumer

If you just want to test audio you can try to run plebplay on an example song, but for quick testing use any song but electrosmash.plb it takes a long time to render.

On Mon, Jun 4, 2018, 19:20 David Konsumer [email protected] wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16#issuecomment-394540708, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7kOdeLO3ciHdNaoGD6dkRHYVTQiyks5t5c7ngaJpZM4UZ41Y .

danfrz avatar Jun 05 '18 00:06 danfrz

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

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

konsumer avatar Jun 05 '18 01:06 konsumer

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

konsumer avatar Jun 05 '18 01:06 konsumer

electrosmash is the song that you shouldn't test with because it takes over a minute to render: Intrepid is smaller. I'll try running that when I get home! Do you want me to publish on Docker hub after audio is figured out? Or will people just have to figure that out on whatever distribution they prefer?

On Mon, Jun 4, 2018, 20:07 David Konsumer [email protected] wrote:

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

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danfrz/PLEBTracker/issues/16#issuecomment-394547756, or mute the thread https://github.com/notifications/unsubscribe-auth/AJdi7q4_GUOBh3QOCovlgf6pC2Eupd6mks5t5dnsgaJpZM4UZ41Y .

danfrz avatar Jun 05 '18 11:06 danfrz

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.)

konsumer avatar Jun 05 '18 11:06 konsumer

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

danfrz avatar Jun 06 '18 00:06 danfrz

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

konsumer avatar Jun 06 '18 05:06 konsumer

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.

konsumer avatar Jun 06 '18 05:06 konsumer