terminalで動作するMastodon clientのnanotodonを試してみた

mikutodonをDebian jessie armhfに入れてみた.Makefileを修正したら動いたけど文字化けする.ちなみにDebian sid amd64では問題なく動作した.

$ cat /etc/debian_version 
8.10
$ uname -m
armv7l

ライブラリ等導入

$ sudo apt install build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
$ dpkg-query -W build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
build-essential 11.7
libcurl4-openssl-dev:armhf      7.38.0-4+deb8u11
libjson-c-dev:armhf     0.11-4
libncurses-dev  
libncursesw5:armhf      5.9+20140913-1+deb8u2

<追記>
入ってない場合gitも必要ですね $ sudo apt install git
</追記>

source入手

$ git clone https://github.com/taka-tuos/nanotodon

make

コケた

$ cd nanotodon
$ make
make -r nanotodon
make[1]: Entering directory '/home/chip/src/nanotodon'
gcc -c -g -o nanotodon.o nanotodon.c
nanotodon.c: In function 'stream_event_notify':
nanotodon.c:110:12: warning: initialization discards 'const' qualifier from pointer target type
  char *t = json_object_get_string(notify_type);
            ^
nanotodon.c: At top level:
nanotodon.c:138:6: warning: conflicting types for 'stream_event_update'
 void stream_event_update(struct json_object *jobj_from_string)
      ^
nanotodon.c:128:3: note: previous implicit declaration of 'stream_event_update' was here
   stream_event_update(status);
   ^
nanotodon.c: In function 'stream_event_update':
nanotodon.c:180:14: warning: initialization discards 'const' qualifier from pointer target type
  char *src = json_object_get_string(content);
              ^
nanotodon.c:226:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (int i = 0; i < json_object_array_length(media_attachments); ++i) {
   ^
nanotodon.c:226:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
nanotodon.c:245:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < term_w - (l + 4); i++) waddstr(scr, " ");
   ^
nanotodon.c: At top level:
nanotodon.c:589:6: warning: conflicting types for 'do_htl'
 void do_htl()
      ^
nanotodon.c:303:2: note: previous implicit declaration of 'do_htl' was here
  do_htl();
  ^
nanotodon.c: In function 'do_htl':
nanotodon.c:618:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (int i = json_object_array_length(jobj_from_string) - 1; i >= 0; i--) {
   ^
nanotodon.c: In function 'main':
nanotodon.c:751:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i < term_w; i++) mvaddch(5, i, '-');
  ^
nanotodon.c:777:4: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for(int i = 0; i < term_w; i++) mvaddch(5, i, '-');
    ^
nanotodon.c:802:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < txt.stringlen; i++) {
   ^
Makefile.in:21: recipe for target 'nanotodon.o' failed
make[1]: *** [nanotodon.o] Error 1
make[1]: Leaving directory '/home/chip/src/nanotodon'
Makefile.in:11: recipe for target 'default' failed
make: *** [default] Error 2

Makefileを修正したら通った

diff --git a/Makefile b/Makefile
index ac1828f..a35ee6a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 TARGET         = nanotodon
 OBJS_TARGET    = nanotodon.o
 
-CFLAGS = -g
+CFLAGS = -g -std=gnu99
 LDFLAGS = 
 LIBS = -lc -lm -lcurl -ljson-c -lncursesw -lpthread
 

文字化け><

20180521_20:05:50-30304

Debian sid amd64ではMakefileの書き換えも必要なく文字化けもしない.

20180521_20:05:01-31796

$ cat /etc/debian_version 
buster/sid
$ uname -m
x86_64
$ dpkg-query -W build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
build-essential 12.5
libcurl4-openssl-dev:amd64      7.60.0-1
libjson-c-dev:amd64     0.12.1-1.3
libncurses-dev:amd64    6.1+20180210-3
libncursesw5:amd64      6.1+20180210-3