WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Pianobar  (Read 3668 times)

Offline Blake

  • Newbie
  • *
  • Posts: 39
Pianobar
« on: January 26, 2018, 10:59:08 AM »
I saw a few earlier posts that looked unanswered about pianobar. It also looks like at one time a pianobar.tcz was included. I tried installing from git hub source and get an error:
Code: [Select]
make: c99: Command not found
make: *** [Makefile:108: src/main.o] Error 127

I also setup a deb2tc and pianobar shows in /usr/local/tce.installed after tce-load -i pianobar.tcz. I cannot run pianobar by typing pianobar though so I must be missing some other step.
Below is the deb2tc that works for me saving it as deb2tc.sh and running it.

Code: [Select]
#!/bin/bash
# Create tce/tcz from Debian package
# Usage: $ scriptname packagename.deb packaganame.tce
# Depends: squashfs-tools, findutils, binutils
# References:
#  - http://forum.tinycorelinux.net/index.php/topic,2325.msg12127.html
#  - http://pastebin.com/ed5KSPsH

TMP1="`mktemp -d /tmp/tce.1.XXXXXX`"
TMP2="$TMP1"/pkg
FILE="$1"
APPNAME="$2"
INPUT=${FILE##*.}

extract() {
    mkdir "$TMP2"
    ar p "$FILE" data.tar.gz > "$TMP1"/data.tar.gz
    tar xzvf "$TMP1"/data.tar.gz -C "$TMP2"
    cd "$TMP2"
    [ -d usr/share/doc ] && rm -r usr/share/doc
    [ -d usr/share/man ] && rm -r usr/share/man
    [ -d usr/share/menu ] && rm -r usr/share/menu
    find . -type d -empty | xargs rmdir > /dev/null 2&>1
}

make() {
  extract
  if [ "$1" == "tce" ]; then
    find `ls` -not -type d > "$TMP1"/list
    tar -T "$TMP1"/list -czvf /home/"$USER"/"$APPNAME"
  else
    mksquashfs "$TMP2" /home/"$USER"/"$APPNAME"
  fi

  cd
  rm -r "$TMP1"
}

[ "$USER" == "root" ] && echo "Do not run as root." && exit 1
[ -z "$APPNAME" ] && echo "You must specify an extension name." && exit 1
[ -f /home/"$USER"/"$APPNAME" ] && echo "You have an existing extension in your \
home directory, you need to move or delete it before trying again." && exit 1
[ -z "$1" ] && echo "You must specify a file."
if [ ! "$INPUT" == "deb" ] ; then
    echo "Only Debian packages work with this."
    exit 1
fi

EXT=${APPNAME##*.}
if [ `echo "$EXT" | grep "tce"` 2>/dev/null ]; then
    make tce
elif [ `echo "$EXT" | grep "tcz"` 2>/dev/null ]; then
    make tcz
else
    echo "You need to specify either a tcz or tce for the output file."
    exit 1
fi

if [ -f /home/"$USER"/"$APPNAME" ]; then
    echo "Success."
else
    echo "Something went wrong."
fi

    [EDIT]: Added code tags.  Rich
« Last Edit: January 26, 2018, 11:20:36 AM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Pianobar
« Reply #1 on: January 26, 2018, 11:33:45 AM »
Hi Blake
Code: [Select]
make: c99: Command not found
make: *** [Makefile:108: src/main.o] Error 127
I think  make  is trying to execute  c99  which is not a command but a compiler directive.

Offline Blake

  • Newbie
  • *
  • Posts: 39
Re: Pianobar
« Reply #2 on: January 26, 2018, 01:55:13 PM »
Any idea how to correct make attempting to compile?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Pianobar
« Reply #3 on: January 26, 2018, 03:55:20 PM »
Hi Blake
I'm not very good with  make  files but if you post it I'll take a look at it. Possibly some other forum members may take a look too.

Offline Blake

  • Newbie
  • *
  • Posts: 39
Re: Pianobar
« Reply #4 on: January 26, 2018, 09:03:02 PM »
I've added the make file the entire source package is from https://github.com/PromyLOPh/pianobar.git. I tried deb2tcz.sh the deb ver then tce-load -i pianobar.tcz but I cannot seem to run pianobar so I am not so sure of the success rate of deb2tcz or if I am missing a step.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: Pianobar
« Reply #5 on: January 26, 2018, 09:44:20 PM »
Hi Blake
Try changing this:
Code: [Select]
else
CC:=c99
endif
endif
to this:
Code: [Select]
else
CC:=gcc -std=c99
endif
endif


Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14788
Re: Pianobar
« Reply #6 on: January 28, 2018, 02:49:29 AM »
make will run if you do something like this:
Code: [Select]
$ find . -name Makefile -type f -exec sed -i 's/-O2//g' {} \;
$ make CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" V=1

..however, it will fail becase pianobar-2017.08.30 requires ffmpeg > 3.1, whereas core-8.2.1 has ffmpeg-1.2.2 (corepure64 has ffmpeg-2.8.12)

Edit: pianobar-2016.06.02 will compile with corepure64-8.2.1
« Last Edit: January 28, 2018, 03:05:24 AM by Juanito »

Offline Blake

  • Newbie
  • *
  • Posts: 39
Re: Pianobar
« Reply #7 on: January 29, 2018, 08:28:26 AM »
---Rich---
( I get the below output when editing the make file: )

Code: [Select]
tc@box:~/pianobar$ make
    CC  src/main.c
    CC  src/player.c
src/player.c: In function 'openStream':
src/player.c:175:8: error: unknown type name 'AVCodecParameters'
  const AVCodecParameters * const cp = player->st->codecpar;
        ^~~~~~~~~~~~~~~~~
src/player.c:175:49: error: 'AVStream {aka struct AVStream}' has no member named 'codecpar'; did you mean 'codec'?
  const AVCodecParameters * const cp = player->st->codecpar;
                                                 ^~
src/player.c:176:13: warning: implicit declaration of function 'avcodec_parameters_to_context' [-Wimplicit-function-declaration]
  if ((ret = avcodec_parameters_to_context (player->cctx, cp)) < 0) {
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/player.c:180:52: error: request for member 'codec_id' in something not a structure or union
  AVCodec * const decoder = avcodec_find_decoder (cp->codec_id);
                                                    ^~
src/player.c: In function 'openFilter':
src/player.c:206:2: error: unknown type name 'AVCodecParameters'
  AVCodecParameters * const cp = player->st->codecpar;
  ^~~~~~~~~~~~~~~~~
src/player.c:206:43: error: 'AVStream {aka struct AVStream}' has no member named 'codecpar'; did you mean 'codec'?
  AVCodecParameters * const cp = player->st->codecpar;
                                           ^~
src/player.c:217:36: error: request for member 'sample_rate' in something not a structure or union
    time_base.num, time_base.den, cp->sample_rate,
                                    ^~
src/player.c:219:6: error: request for member 'channel_layout' in something not a structure or union
    cp->channel_layout);
      ^~
src/player.c: In function 'openDevice':
src/player.c:267:8: error: unknown type name 'AVCodecParameters'
  const AVCodecParameters * const cp = player->st->codecpar;
        ^~~~~~~~~~~~~~~~~
src/player.c:267:49: error: 'AVStream {aka struct AVStream}' has no member named 'codecpar'; did you mean 'codec'?
  const AVCodecParameters * const cp = player->st->codecpar;
                                                 ^~
src/player.c:273:21: error: request for member 'channels' in something not a structure or union
  aoFmt.channels = cp->channels;
                     ^~
src/player.c:274:17: error: request for member 'sample_rate' in something not a structure or union
  aoFmt.rate = cp->sample_rate;
                 ^~
src/player.c: In function 'play':
src/player.c:311:5: warning: implicit declaration of function 'avcodec_send_packet' [-Wimplicit-function-declaration]
     avcodec_send_packet (cctx, NULL);
     ^~~~~~~~~~~~~~~~~~~
src/player.c:337:10: warning: implicit declaration of function 'avcodec_receive_frame' [-Wimplicit-function-declaration]
    ret = avcodec_receive_frame (cctx, frame);
          ^~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:108: src/player.o] Error 1
« Last Edit: January 29, 2018, 08:53:31 AM by Juanito »

Offline Blake

  • Newbie
  • *
  • Posts: 39
Re: Pianobar
« Reply #8 on: January 29, 2018, 08:37:32 AM »
Juanito,
   I did a wget https://6xq.net/git/lars/pianobar.git/snapshot/pianobar-2016.06.02.tar.gz
and performed gunzip and tar -xvf. When I run make I am getting:
 make
    CC  src/main.c
make: c99: Command not found
make: *** [Makefile:108: src/main.o] Error 127

Would the script you supplied work for this? Would I need to change the i686 to something like x86_64?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14788
Re: Pianobar
« Reply #9 on: January 29, 2018, 08:52:18 AM »
Are you compiling on core or corepure64?

pianobar-2016.06.02 will compile with corepure64 (ffmpeg-2.x)

you will need an older version of pianobar to compile on core (ffmpeg-1.x)

In either case, it will compile if you use:
Code: [Select]
$ find . -name Makefile -type f -exec sed -i 's/-O2//g' {} \;
$ make CC="gcc -flto -fuse-linker-plugin -march=i486 -mtune=i686 -Os -pipe" V=1 [core]
$ make CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" V=1 [corepure64]

..as long as you have the appropriate version of pianobar for the version of ffmpeg in use.

Offline Blake

  • Newbie
  • *
  • Posts: 39
Re: Pianobar
« Reply #10 on: January 29, 2018, 09:50:24 PM »
I have been compiling on Core64 to test. I am interested in compiling for both though.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14788
Re: Pianobar
« Reply #11 on: January 30, 2018, 03:03:06 AM »
This works for me with corepure64:
Code: [Select]
$ tce-load -i compiletc libao-dev curl-dev libgcrypt-dev json-c-dev ffmpeg-dev

$ cd pianobar-2016.06.02

$ find . -name Makefile -type f -exec sed -i 's/-O2//g' {} \;

$ make CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe"
$ sudo make CC="gcc -flto -fuse-linker-plugin -mtune=generic -Os -pipe" install

As mentioned, to compile pianobar using core, you'll need to find an old version of pianobar that will compile against ffmpeg-1.x, compile ffmpeg-2.x or, to use the lastest version of pianobar, compile ffmpeg-3.x