Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: jodel on April 18, 2014, 08:34:41 AM

Title: PiCore and Omxplayer
Post by: jodel on April 18, 2014, 08:34:41 AM
How should I go about trying to get Omxplayer running on PiCore?
Jodel
Title: Re: PiCore and Omxplayer
Post by: bmarkus on April 18, 2014, 08:54:10 AM
How should I go about trying to get Omxplayer running on PiCore?
Jodel

You must install it from source.
Title: Re: PiCore and Omxplayer
Post by: jodel on April 18, 2014, 05:27:53 PM
Thanks.  Has anyone tried to do this and how did it go?
Title: Re: PiCore and Omxplayer
Post by: onelife on June 16, 2014, 07:19:35 AM
Heyo all,

Does anyone know if this did eventually work? OMX form source that is?

I'm looking for a way of playing "video" and displaying images with PiCore but from command line and also ideally keeping CPU down and / or taking advantage of the GPU.

BIG Thanks
Title: Re: PiCore and Omxplayer
Post by: bmarkus on June 17, 2014, 02:48:08 AM
omxplayer from Raspbian works fine in piCore 5.3.1, it can play fullscreen vide with audio in sync. Havn't checked all features but in general it is ok. If you are interested I can make a short guide how to install it.
Title: Re: PiCore and Omxplayer
Post by: dae87 on August 29, 2014, 05:07:11 AM
Hi,
I would like to know how to build omxplayer from source.

Thanks.
Title: Re: PiCore and Omxplayer
Post by: bmarkus on August 29, 2014, 11:46:38 AM
Hi,
I would like to know how to build omxplayer from source.

Thanks.

See upstream forum, web, git, etc.
Title: Re: PiCore and Omxplayer
Post by: sixgunz on June 15, 2015, 04:00:29 PM
omxplayer from Raspbian works fine in piCore 5.3.1, it can play fullscreen vide with audio in sync. Havn't checked all features but in general it is ok. If you are interested I can make a short guide how to install it.

Hi Béla

I would be very interested in the guide for how to install.

Thanks,

Glenn.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 10, 2015, 05:06:49 AM
I apologize to revive an old thread but I just would like to know whether there exist any guide on how to compile omxplayer from source. I cloned the source from https://github.com/popcornmix/omxplayer and tried the build script but it require some packages and dependencies that I do not know how do install since the build script was meant for Debian.

Do you have any guide that I can refer to or any article out there that I can learn from in building from source? Thank you for your time!
Title: Re: PiCore and Omxplayer
Post by: Rich on November 10, 2015, 11:09:13 AM
Hi paperone
Based on this:
Code: [Select]
REQUIRED_PKGS="ca-certificates git-core subversion binutils libva1 libpcre3-dev libidn11-dev libboost1.50-dev libfreetype6-dev libusb-1.0-0-dev libdbus-1-dev libssl-dev libssh-dev libsmbclient-dev gcc-4.7 g++-4.7 sed pkg-config"
Found here:
https://github.com/popcornmix/omxplayer/blob/master/prepare-native-raspbian.sh
My best guess based on what I see in the current repository is that you need to install:
Code: [Select]
compile-essentials.tcz
pcre-dev.tcz
libidn-dev.tcz
boost-dev.tcz
freetype-dev.tcz
libusb-dev.tcz
dbus-dev.tcz
openssl-1.0.1-dev.tcz
libssh2-dev.tcz
samba4-dev.tcz
pkg-config.tcz
I don't know if all the version numbers are suitable for this.
One of the required packages listed is  libva1 , which I don't see listed, so you'll probably have to track it down and
compile that first.
This should help for build instructions:
http://wiki.tinycorelinux.net/wiki:creating_extensions
Title: Re: PiCore and Omxplayer
Post by: paperone on November 10, 2015, 10:01:09 PM
Thank you for the reply, Rich! I am going to follow along the info you've just posted and try the build instructions. :)
Title: Re: PiCore and Omxplayer
Post by: Rich on November 10, 2015, 10:42:54 PM
Hi paperone
I think this might be the missing  libva1  dependency:
http://www.freedesktop.org/wiki/Software/vaapi/#git
Title: Re: PiCore and Omxplayer
Post by: paperone on November 11, 2015, 11:24:30 PM
Thanks Rich!

Ok, I just went through your info and the wiki on creating extension and also the CoreBook. I understand only certain part and I am still trying to digest and wrap my head around how to compile omxplayer.

I don't know what steps and requirements it entails yet to be able to compile omxplayer so I hope you can bear with me on my question. Here are the questions:
- Reading through your link on http://wiki.tinycorelinux.net/wiki:creating_extensions — to compile omxplayer, does it mean I need to find and download those dependencies or extensions in TC parlance as listed in the omxplayer project build script and then embeded it along in the omxplayer extension that still need to be build?
- I was on piCore 6.0 X on Raspi Model B but I couldn't find the compiletc.tcz extension using the App Browser. Then I tried using TinyCore 6.4.1 under VirtualBox, I was able to find and load compiletc.tcz extension. Does it mean I can only create the extension on TinyCore then pack them up, copy and install the generated omxplayer extension on piCore?
Title: Re: PiCore and Omxplayer
Post by: Rich on November 12, 2015, 01:07:57 AM
Hi paperone
Quote
I was on piCore 6.0 X on Raspi Model B but I couldn't find the compiletc.tcz extension using the App Browser.
It's called  compile-essentials  when you are running on PI.

You need to install the following using the  Apps  utility:
Code: [Select]
compile-essentials.tcz
pcre-dev.tcz
libidn-dev.tcz
boost-dev.tcz
freetype-dev.tcz
libusb-dev.tcz
dbus-dev.tcz
openssl-1.0.1-dev.tcz
libssh2-dev.tcz
samba4-dev.tcz
pkg-config.tcz
That should provide most of the tools and dependencies you need to build  omxplayer.

Here's a link for the latest libva tarball.
http://www.linuxfromscratch.org/blfs/view/svn/x/x7driver.html#libva
You'll need to compile that before you can build omxplayer.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 12, 2015, 01:12:00 AM
Oops. Sorry for my ignorance, while waiting for your reply, I did some reading and test. I need to clarify one thing.

I was reading through https://github.com/puppetlabs/Razor-Microkernel/wiki/Building-your-own-TCL-Extension and tried to follow along but didn't quite manage to get the extension compilation done. Okay, don't rain down at me, lol. The article was created in 2012 so I think it was probably outdated in some way such as a few extensions are no longer available when I tried to install them. Knowing the fact that some stuff is missing, I exported the flags such as described in the wiki, it gave me: "checking whether the C compiler works... no".

Ok, coming back to the idea of an extension — in reading between the few articles, it started to make sense to me. Correct me if I am wong, when building an extension, we're essentially doing a few steps?
- Install the build tools such as compiletc.tcz, squashfs-tools.tcz, etc.
- Find and install all dependencies, these dependencies must be already "converted" to TinyCore extensions. For example, the omxplayer requires the the dependencies as you listed above — some are in tcz format and some others aren't.
- For those that aren't, we need to "convert" them in tcz.
- Finally, find the source file of the new extension eg: omxplayer. Do "configure" with some parameters and build it using "make".
- Move the build package or executable into their own folder and pack it using "mksquashfs".

Is the steps correct?
Title: Re: PiCore and Omxplayer
Post by: Rich on November 12, 2015, 01:49:06 AM
Hi paperone
Quote
I was reading through newbielink:https://github.com/puppetlabs/Razor-Microkernel/wiki/Building-your-own-TCL-Extension [nonactive] and tried to follow along but didn't quite manage to get the extension compilation done.
Those instructions are for X86, you are building for ARM, so there will be differences.
Under ARM, there is no  compiletc. You use  compile-essentials  instead.
The exported flags are different. I think most of them default to the correct values. Maybe bmarkus can comment on that.
I also recommend you don't use the  tce-load  commands. Use the GUI  Apps  utility and let it install the required tools
and extensions  Onboot.
Quote
- Install the build tools such as compiletc.tcz, squashfs-tools.tcz, etc.
- Find and install all dependencies, these dependencies must be already "converted" to TinyCore extensions. For example, the omxplayer requires the the dependencies as you listed above — some are in tcz format and some others aren't.
- For those that aren't, we need to "convert" them in tcz.
- Finally, find the source file of the new extension eg: omxplayer. Do "configure" with some parameters and build it using "make".
Yes, yes, yes, and yes.
Quote
- Move the build package or executable into their own folder and pack it using "mksquashfs".
Do:
Code: [Select]
./configure --helpthis will list available build options. Check for a  dest-dir  option. This will let you select a unique directory to install to
which will make squashing into a tcz a lot easier.
Title: Re: PiCore and Omxplayer
Post by: bmarkus on November 12, 2015, 02:37:36 AM
You can use default GCC settings. If you want to be sure using correct flags, use

Code: [Select]
-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp
to make sure code will run on all Raspberry Pi boards. There are other options which depends on the application you are building and influence spped, size and other features.

Title: Re: PiCore and Omxplayer
Post by: paperone on November 12, 2015, 03:20:01 AM
Thanks Rich, bmarkus!

I am trying to compile the last dependency now — that is libav. As suggested by Rich, I downloaded the compressed file from http://www.freedesktop.org/software/vaapi/releases/libva/libva-1.6.1.tar.bz2
But when I run "./configure $XORG_CONFIG &&" — I can't get past this step as it threw me:
checking now to run the C preprocessor... /lib/cpp
configure: error: in '/hone/tc/libva-1.6.1':
configure: error: C preprocessor "lib/cpp" fails sanity check

I searched other forum and people suggested it has something to do with c or c++ compiler but it seemed that I can run both gcc or g++ just fine from the terminal. Any idea? Here's the config.log from the configure step : https://gist.github.com/anonymous/48dcd949df7aa061adab

(http://i68.tinypic.com/24gruyo.jpg)
Title: Re: PiCore and Omxplayer
Post by: bmarkus on November 12, 2015, 03:36:57 AM
Install Linux api headers from repo
Title: Re: PiCore and Omxplayer
Post by: paperone on November 12, 2015, 07:54:38 AM
Hi bmarkus,

That was the indeed the missing extension, thank you! I am slow but I managed to compile libav now.

Next, I downloaded omxplayer master branch and I was trying to compile it, along the way I found that the "make" requires 2 more extensions - git.tcz and coreutils.tcz which are there in the App Browser. From the compiling section on https://github.com/popcornmix/omxplayer#compiling, the instruction is to run the ./prepare-native-raspbian.sh script first which I skipped since I have already installed the dependencies separately using App Browser.

Next, it said build with "make ffmpeg" and this is where I am currently stuck. I waited for a while for the "make" to clone the repo and do its own thing but then it stopped and spewed out some errors. It said compiler test failed along the bottom of the output but I couldn't understand what that means and where to fix.

Code: [Select]
arm-linux-gnueabihf-gcc is unable to create an executable file.
C compiler test failed.
Full terminal output is at https://gist.github.com/anonymous/687c2e9a23e86359d5e4

Any idea?
Title: Re: PiCore and Omxplayer
Post by: bmarkus on November 12, 2015, 08:12:52 AM
Check config.log for details on error and adjust make file according to your setup.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 12, 2015, 08:33:23 AM
Ok, I spot 2 warnings in config.log:

Code: [Select]
WARNING: arm-linux-gnueabihf-pkg-config not found, library detection may fail.
mktemp -u XXXXXX
RCXMQY
WARNING: Unknown C compiler arm-linux-gnueabihf-gcc, unable to select optimal CFLAGS
check_ld cc
check_cc

First I tried to disable some flags as suggested by Irenaud @ https://github.com/huceke/omxplayer/issues/20#issuecomment-7143502

Quote
I'm trying to run a build on a native system, and the solution thus far has been to remove all references (in Makefile.ffmpeg and Makefile.include) to the flag -mfpu=vfp and change -mfloat-abi=softfp to -mfloat-abi=hard. Native raspberry pi builds take quite a while so I haven't finished the build for a full test, but thus far that appears to fix this build error.

No luck. Removed the old build. Then I tried again to install a few things as suggested from http://stackoverflow.com/questions/14180185/gcc-arm-linux-gnueabi-command-not-found but it still throw me the same error. I am clueless as to what flags in the make file to adjust.  :-\
Title: Re: PiCore and Omxplayer
Post by: paperone on November 13, 2015, 12:50:08 AM
Ok, looks like I am asking a lot of questions and sorry to draw a bit of you time into this.  ;D Apparently, I need to delve into configure, make and make install stuff a bit more.

I am currently building ffmpeg using the configure script and make file included in the ffmpeg directory, a subdirectory in omxplayer. Will post back once I manage to get everything running and then probably create a complete guide of the steps that I went through.

Thanks bmarkus and Rich for your help so far!  :)
Title: Re: PiCore and Omxplayer
Post by: paperone on November 14, 2015, 12:40:12 AM
Ok, I am listing out the steps I have taken so far:

- Install the following extensions/dependencies from repo using App Browser:
   - compile-essentials.tcz (the variant of compiletc.tcz in piCore)
   - pcre-dev.tcz
   - libidn-dev.tcz
   - boost-dev.tcz
   - freetype-dev.tcz
   - libusb-dev.tcz
   - dbus-dev.tcz
   - openssl-1.0.1-dev.tcz
   - libssh2-dev.tcz
   - samba4-dev.tcz
   - pkg-config.tcz
   - linux-3.12.y_api_headers.tcz (this is needed to compile libva)
   - ffmpeg-dev.tcz and ffmpeg.tcz (there's a Makefile.ffmpeg inside omxplayer source but since the piCore repo already has ffmpeg.tcz we can just use it)
   - git.tcz (utility to clone omxplayer from github - https://github.com/popcornmix/omxplayer)
   - coreutils.tcz (maybe we don't need this?)

- libva requires pthread-stubs and libdrm so before we build that we have to install them first else it will throw out missing package error during the libva make process.
   - Download and build pthread-stubs from http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2
      > wget http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2
      > tar -xjvf libpthread-stubs-0.1.tar.bz2
      > cd libpthread-stubs-0.1
      > ./configure --prefix=/usr && make
      > sudo make install
      - Ref: http://www.linuxfromscratch.org/blfs/view/6.3/general/libpthread-stubs.html

   - Download and build libdrm from http://dri.freedesktop.org/libdrm/libdrm-2.4.65.tar.gz (else mid way into libva configure, it will fail with error: no package 'libdrm' found)
      > wget http://dri.freedesktop.org/libdrm/libdrm-2.4.65.tar.gz
      > tar -xzvf libdrm-2.4.65.tar.gz
      > cd libdrm-2.4.65
      > ./configure --prefix=/usr --enable-udev && make
      > sudo make install
      - Ref: http://www.linuxfromscratch.org/blfs/view/svn/x/libdrm.html

- Now, download and build libva from http://www.linuxfromscratch.org/blfs/view/svn/x/x7driver.html#libva
   > wget http://www.freedesktop.org/software/vaapi/releases/libva/libva-1.6.1.tar.bz2
   > tar jxf libva-1.6.1.tar.bz2
   > cd libva-1.6.1
   > ./configure $XORG_CONFIG && make
   > sudo make install [we're at this now...]

- Download and build omxplayer from https://github.com/popcornmix/omxplayer
   > git clone https://github.com/popcornmix/omxplayer
   > cd omxplayer
   - There's not configure script from the source so skipping it (am I doing the right thing?)
   > make
   - Got "/bin/sh: bash: not found" — fixed that by replacing bash to sh on Makefile line 51 and save the file
   > make (run again)
   - Got another error, something like "/home/dc4/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi" (didn't manage to copy the screenshot as the I accidentally rebooted the system and all the build is gone). I guess I need to try from building libdrm, libpthread and libva again before I can run omxplayer make.

What a long journey hehe, and I hope to be able to tackle the omxplayer build process, natively or otherwise cross-compile I am new to this by the way, will go through another heaps of learning process again but it's fun! I am posting the previous steps in the hope of easing other people from falling in my steps, of course if you're newbie like me — you're probably doing the same mistake as mine.

For the piCore experts out there, please pick my mistakes and kindly give advice for improvement, thank you very much and have a great weekend!
Title: Re: PiCore and Omxplayer
Post by: Rich on November 14, 2015, 01:57:08 AM
Hi paperone
I'm no PiCore expert, but this might help ....
Take another look in the repository, libpthread-stubs.tcz is in there.
Quote
./configure --prefix=/usr
That should probably be:
Code: [Select]
./configure --prefix=/usr/local
Quote
sudo make install
Rather than installing in the running system, you would be better off creating an extension
Code: [Select]
mkdir /tmp/package
sudo make install DESTDIR=/tmp/package
mksquashfs /tmp/package ExtensionName.tcz
rm -r /tmp/package
Copy the extension to your  tce  directory and add it to your  onboot.lst  file. You can load it without rebooting using
Apps load local.
Quote
Got "/bin/sh: bash: not found"
Install  bash.tcz  just in case it really needs some features of bash.
Title: Re: PiCore and Omxplayer
Post by: Rich on November 14, 2015, 02:19:23 AM
Hi paperone
Xorg-7.7-lib.tcz  has  libdrm  so install  Xorg-7.7-dev.tcz.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 15, 2015, 04:11:44 AM
Hi Rich, thanks for the tips on creating extension the proper way and also pointing out that Xorg-7.7-dev.tcz contains libdrm. I will keep that in mind.

Now, I am trying to tailor the Makefile.include from omxplayer to my environment so that I can compile it natively on RPi Model B. I have time so I am not bothered with the fact that natively compiling thing on RPi is slow.

Looking at the Makefile.include, the TOOLCHAIN and HOST flags was pointing to a non-existent directory:
Code: [Select]
#Makefile.include
TOOLCHAIN :=/home/dc4/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/
HOST :=arm-linux-gnueabihf

Down below the Makefile.include, I found that it uses g++ so I did a
Code: [Select]
which g++the system gave me /usr/local/bin/g++ so I changed those flags to:

Code: [Select]
#Makefile.include
TOOLCHAIN :=/usr/local/
HOST :=
CXX := $(TOOLCHAIN)/bin/$(HOST)g++ --sysroot=$(SYSROOT)
CFLAGS := -Os -pipe
CXXFLAGS := -Os -pipe
LDFLAGS := -Wl,-O1

Now I am able to direct the Makefile to run g++ but when I run make, I got:
Code: [Select]
bash gen_version.sh > version.h
/usr/local//bin/g++ --sysroot=/opt/bcm-rootfs -Os -pipe -Os -pipe -std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST -isystem/opt/bcm-rootfs/opt/vc/include -isystem/opt/bcm-rootfs/usr/include -isystem/opt/bcm-rootfs/opt/vc/include/interface/vcos/pthreads -Ipcre/build -Iboost-trunk -Ifreetype2/include -I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include -c linux/XMemUtils.cpp -o linux/XMemUtils.o -Wno-deprecated-declarations
linux/XMemUtils.cpp:1:20:fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>

 compilation terminated.
Makefile:45: recipe for target 'linux/XMemUtils.o' failed

Compile-essentials.tcz is installed right from the start, shouldn't stdlib.h file be included by default? Do you know what causes this error — by chance is there any flags that I still need to change or do I need to install other dev extension?

Also, tried install glibc_base-dev.tcz and added /usr/include to the INCLUDES flag but still it seemed make doesn't pick up the stdlib.h library.  :-\
Title: Re: PiCore and Omxplayer
Post by: curaga on November 15, 2015, 05:26:46 AM
Remove the --sysroot option. That's also for cross-compiling.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 15, 2015, 09:10:44 AM
Thanks curaga, that helped fixed the missing stdlib.h file - although I am new to the whole configure and make thing, I feel a bit embarrassed now, lol.
Now the make threw me different errors and to my inexperienced eye, I could not determine whether the error is caused by missing library or because the incorrect flags or path in the Makefile. Or do I need to download anything from http://releases.linaro.org/14.04/components/toolchain/binaries/? Sorry about the barrage of questions!

Here's the Makefile.include, Makefile and error in full, can you take a quick glance and spot anything wrong with them?

Code: [Select]
#Makefile.include
USE_BUILDROOT=0
FLOAT=hard

ifeq ($(USE_BUILDROOT), 1)
BUILDROOT :=/opt/xbmc-bcm/buildroot
SDKSTAGE :=$(BUILDROOT)/output/staging
TARGETFS :=$(BUILDROOT)/output/target
TOOLCHAIN :=$(BUILDROOT)/output/host/usr/
HOST :=arm-unknown-linux-gnueabi
SYSROOT :=$(BUILDROOT)/output/host/usr/arm-unknown-linux-gnueabi/sysroot
else
BUILDROOT :=/opt/bcm-rootfs
SDKSTAGE :=/opt/bcm-rootfs
TARGETFS :=/opt/bcm-rootfs
TOOLCHAIN :=/usr/local/
HOST :=
#SYSROOT :=$(TOOLCHAIN)/arm-bcm2708hardfp-linux-gnueabi/sysroot
SYSROOT :=/opt/bcm-rootfs
endif

JOBS=7

CFLAGS := -Os -pipe
CXXFLAGS := -Os -pipe
CPPFLAGS := $(CFLAGS)
LDFLAGS := -L$(BUILDROOT)/lib
LD := $(TOOLCHAIN)/bin/$(HOST)-ld
CC := $(TOOLCHAIN)/bin/$(HOST)-gcc
CXX := $(TOOLCHAIN)/bin/$(HOST)g++
OBJDUMP := $(TOOLCHAIN)/bin/$(HOST)-objdump
RANLIB := $(TOOLCHAIN)/bin/$(HOST)-ranlib
STRIP := $(TOOLCHAIN)/bin/$(HOST)-strip
AR := $(TOOLCHAIN)/bin/$(HOST)-ar
CXXCP := $(CXX) -E
PATH := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)

CFLAGS += -Os -pipe
LDFLAGS += -Wl, -O1
#INCLUDES += -isystem$(SDKSTAGE)/usr/include -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -isystem$(SDKSTAGE)/usr/include/freetype2
#INCLUDES += -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -Ipcre/build -Iboost-trunk -Ifreetype2/include /usr/include
INCLUDES += /usr/include


Code: [Select]
#Makefile
include Makefile.include

CFLAGS+=-Os -pipe

LDFLAGS+=-Wl, -O1

INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include /usr/include

DIST ?= omxplayer-dist

SRC=linux/XMemUtils.cpp \
utils/log.cpp \
DynamicDll.cpp \
utils/PCMRemap.cpp \
utils/RegExp.cpp \
OMXSubtitleTagSami.cpp \
OMXOverlayCodecText.cpp \
BitstreamConverter.cpp \
linux/RBP.cpp \
OMXThread.cpp \
OMXReader.cpp \
OMXStreamInfo.cpp \
OMXAudioCodecOMX.cpp \
OMXCore.cpp \
OMXVideo.cpp \
OMXAudio.cpp \
OMXClock.cpp \
File.cpp \
OMXPlayerVideo.cpp \
OMXPlayerAudio.cpp \
OMXPlayerSubtitles.cpp \
SubtitleRenderer.cpp \
Unicode.cpp \
Srt.cpp \
KeyConfig.cpp \
OMXControl.cpp \
Keyboard.cpp \
omxplayer.cpp \

OBJS+=$(filter %.o,$(SRC:.cpp=.o))

all: dist

%.o: %.cpp
@rm -f $@
$(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@ -Wno-deprecated-declarations

omxplayer.o: help.h keys.h

version:
bash gen_version.sh > version.h

omxplayer.bin: version $(OBJS)
$(CXX) $(LDFLAGS) -o omxplayer.bin $(OBJS) -lvchiq_arm -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
$(STRIP) omxplayer.bin

help.h: README.md Makefile
awk '/SYNOPSIS/{p=1;print;next} p&&/KEY BINDINGS/{p=0};p' $< \
| sed -e '1,3 d' -e 's/^/"/' -e 's/$$/\\n"/' \
> $@
keys.h: README.md Makefile
awk '/KEY BINDINGS/{p=1;print;next} p&&/KEY CONFIG/{p=0};p' $< \
| sed -e '1,3 d' -e 's/^/"/' -e 's/$$/\\n"/' \
> $@

omxplayer.1: README.md
sed -e '/DOWNLOADING/,/omxplayer-dist/ d; /DBUS/,$$ d' $< >MAN
curl -F page=@MAN http://mantastic.herokuapp.com 2>/dev/null >$@

clean:
for i in $(OBJS); do (if test -e "$$i"; then ( rm $$i ); fi ); done
@rm -f omxplayer.old.log omxplayer.log
@rm -f omxplayer.bin
@rm -rf $(DIST)
@rm -f omxplayer-dist.tar.gz

ffmpeg:
@rm -rf ffmpeg
make -f Makefile.ffmpeg
make -f Makefile.ffmpeg install

dist: omxplayer.bin omxplayer.1
mkdir -p $(DIST)/usr/lib/omxplayer
mkdir -p $(DIST)/usr/bin
mkdir -p $(DIST)/usr/share/doc/omxplayer
mkdir -p $(DIST)/usr/share/man/man1
cp omxplayer omxplayer.bin $(DIST)/usr/bin
cp COPYING $(DIST)/usr/share/doc/omxplayer
cp README.md $(DIST)/usr/share/doc/omxplayer/README
cp omxplayer.1 $(DIST)/usr/share/man/man1
cp -a ffmpeg_compiled/usr/local/lib/*.so* $(DIST)/usr/lib/omxplayer/
cd $(DIST); tar -czf ../$(DIST).tgz *

Code: [Select]
tc@box:/home/omxplayer-master$ make
bash gen_version.sh > version.h
/usr/local//bin/g++ -Os -pipe -Os -pipe -Os -pipe /usr/include -I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include /usr/include -c utils/log.cpp -o utils/log.o -Wno-deprecated-declarations
utils/log.cpp: In static member function 'static void CLog::Log(int, const char*, ...)':
utils/log.cpp:60:64: error: expected ',' or ';' before 'PRIu64'
   static const char* prefixFormat = "%02.2d:%02.2d:%02.2d T:%" PRIu64 " %7s: ";
                                                                ^
utils/log.cpp:73:28: error: 'gettimeofday' was not declared in this scope
     gettimeofday(&now, NULL);
                            ^
utils/log.cpp:74:5: error: 'SYSTEMTIME' was not declared in this scope
     SYSTEMTIME time;
     ^
utils/log.cpp:75:10: error: request for member 'wHour' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     time.wHour=(now.tv_sec/3600) % 24;
          ^
utils/log.cpp:76:10: error: request for member 'wMinute' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     time.wMinute=(now.tv_sec/60) % 60;
          ^
utils/log.cpp:77:10: error: request for member 'wSecond' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     time.wSecond=now.tv_sec % 60;
          ^
utils/log.cpp:96:43: error: request for member 'wHour' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
       strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[m_repeatLogLevel]);
                                           ^
utils/log.cpp:96:55: error: request for member 'wMinute' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
       strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[m_repeatLogLevel]);
                                                       ^
utils/log.cpp:96:69: error: request for member 'wSecond' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
       strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[m_repeatLogLevel]);
                                                                     ^
utils/log.cpp:98:57: error: expected ')' before 'LINE_ENDING'
       strData2.Format("Previous line repeats %d times." LINE_ENDING, m_repeatCount);
                                                         ^
utils/log.cpp:126:27: error: 'LINE_ENDING' was not declared in this scope
     strData.Replace("\n", LINE_ENDING"                                            ");
                           ^
utils/log.cpp:129:41: error: request for member 'wHour' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[loglevel]);
                                         ^
utils/log.cpp:129:53: error: request for member 'wMinute' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[loglevel]);
                                                     ^
utils/log.cpp:129:67: error: request for member 'wSecond' in 'time', which is of non-class type 'time_t(time_t*) throw () {aka long int(long int*) throw ()}'
     strPrefix.Format(prefixFormat, time.wHour, time.wMinute, time.wSecond, stamp, levelNames[loglevel]);
                                                                   ^
utils/log.cpp: In static member function 'static bool CLog::Init(const char*)':
utils/log.cpp:152:17: error: aggregate 'CLog::Init(const char*)::stat info' has incomplete type and cannot be defined
     struct stat info;
                 ^
utils/log.cpp:153:41: error: invalid use of incomplete type 'struct CLog::Init(const char*)::stat'
     if (stat(strLogFileOld.c_str(),&info) == 0 &&
                                         ^
utils/log.cpp:152:12: error: forward declaration of 'struct CLog::Init(const char*)::stat'
     struct stat info;
            ^
utils/log.cpp:156:38: error: invalid use of incomplete type 'struct CLog::Init(const char*)::stat'
     if (stat(strLogFile.c_str(),&info) == 0 &&
                                      ^
utils/log.cpp:152:12: error: forward declaration of 'struct CLog::Init(const char*)::stat'
     struct stat info;
            ^
Makefile:45: recipe for target 'utils/log.o' failed
make: *** [utils/log.o] Error 1
Title: Re: PiCore and Omxplayer
Post by: Rich on November 15, 2015, 11:51:13 AM
Hi paperone
The original  Makefile  had:
Code: [Select]
CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOSTwhich you removed. I suggest putting that back in.

Quote
/usr/local//bin/g++ -Os -pipe -Os -pipe -Os -pipe /usr/include -I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include /usr/include -c utils/log.cpp -o utils/log.o -Wno-deprecated-declarations
-Os -pipe  shows up multiple times. Remove  -Os -pipe  from the  CFLAGS+=  statements.
/usr/include  shows up twice and is incorrect. It should be  -I/usr/include  and only defined once. Also, there should
not be a space between  -I  and what's being included.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 15, 2015, 08:15:34 PM
Thank you again, Rich for pointing out my mistake!

Looks like I need to take a step back and hold off for a bit to learn or at least forge some understanding around make and makefile. There are huge amount of flag, parameter, syntax and construct inside omxplayer's Makefile and Makefile.include, and obviously they all looked greek to me at the moment.

Also, the fact that the included Makefile was intended for other platform (with cross-compiling options in it) is making thing a bit more difficult. I am not complaining though and I really appreciate the help so far. It's a bit pity that due to my limited understanding of general things, I am not able to use the tip and suggestion given to me to formulate the correct Makefile yet.

I hope you guys aren't bored with my newbie questions!
Title: Re: PiCore and Omxplayer
Post by: paperone on November 19, 2015, 12:06:57 AM
Hello!

Now I have a bit more general understanding on the GNU make and I am able to change a bit the flag and path here and there inside a makefile. But I still have problem building omxplayer, allow me to explain. Here are steps that I did from loading up the dependencies to actually run the make command.

- Load all dependencies
   > tce-load -wi compile-essentials.tcz pcre-dev.tcz libidn-dev.tcz boost-dev.tcz freetype-dev.tcz libusb-dev.tcz dbus-dev.tcz openssl-1.0.1-dev.tcz libssh2-dev.tcz samba4-dev.tcz pkg-config.tcz linux-3.12.y_api_headers.tcz ffmpeg-dev.tcz git.tcz bash.tcz
- Download and extract /opt/vc directory in raspberry firmware (https://github.com/raspberrypi/firmware) to /opt directory, is it correct to use the raspberry firmware from that repo as I couldn't find any in the piCore 6.0 release?
   > cp -r /mnt/sda1/picore/opt/* /opt
> git clone https://github.com/popcornmix/omxplayer
> cd omxplayer
- Remove all Makefile
   > rm Makefile
   > rm Makefile.include
   > rm Makefile.ffmpeg
- I created a new Makefile based on omxplayer default Makefile.include and Makefile to tailor to my environment — basically set the toolchain and include to their correct location. Also removed the sysroot options as suggested by curaga as that flag is meant for cross-complilation.
> sudo make

Here's the edited Makefile in its entirety:

Code: [Select]
FLOAT=hard

BUILDROOT   :=/opt/vc
SDKSTAGE    :=/opt/vc
TARGETFS    :=/opt/vc
TOOLCHAIN   :=/usr/local/
HOST        :=
SYSROOT     :=/opt/vc

CFLAGS          := -isystem$(PREFIX)/include
CXXFLAGS        := $(CFLAGS)
CPPFLAGS        := $(CFLAGS)
LDFLAGS         := -L$(BUILDROOT)/lib
LD              := $(TOOLCHAIN)/bin/$(HOST)ld
CC              := $(TOOLCHAIN)/bin/$(HOST)gcc
CXX             := $(TOOLCHAIN)/bin/$(HOST)g++
OBJDUMP         := $(TOOLCHAIN)/bin/$(HOST)objdump
RANLIB          := $(TOOLCHAIN)/bin/$(HOST)ranlib
STRIP           := $(TOOLCHAIN)/bin/$(HOST)strip
AR              := $(TOOLCHAIN)/bin/$(HOST)ar
CXXCP           := $(CXX) -E
PATH            := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)

CFLAGS          += -pipe -mfloat-abi=$(FLOAT) -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -g -mstructure-size-boundary=32 -mno-sched-prolog
LDFLAGS         += -L$(SDKSTAGE)/lib -L$(SDKSTAGE)/usr/lib -L$(SDKSTAGE)/opt/vc/lib/ -Lpcre/build
#INCLUDES       += -isystem$(SDKSTAGE)/usr/include -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -isystem$(SDKSTAGE)/usr/include/freetype2
INCLUDES        += -isystem/opt/vc/include -isystem/usr/include -isystem/opt/vc/include/interface/vcos/pthreads -Ipcre/build -Iboost-trunk -Ifreetype2/include

CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG  -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST

LDFLAGS+=-L./ -L/usr/local/lib/ -lc -lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz

INCLUDES+=-I./ -Ilinux -I/usr/local/include/ -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/local/include/freetype2 -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include -I/opt/vc/lib

DIST ?=

SRC=linux/XMemUtils.cpp \
        utils/log.cpp \
        DynamicDll.cpp \
        utils/PCMRemap.cpp \
        utils/RegExp.cpp \
        OMXSubtitleTagSami.cpp \
        OMXOverlayCodecText.cpp \
        BitstreamConverter.cpp \
        linux/RBP.cpp \
        OMXThread.cpp \
        OMXReader.cpp \
        OMXStreamInfo.cpp \
        OMXAudioCodecOMX.cpp \
        OMXCore.cpp \
        OMXVideo.cpp \
        OMXAudio.cpp \
        OMXClock.cpp \
        File.cpp \
        OMXPlayerVideo.cpp \
        OMXPlayerAudio.cpp \
        OMXPlayerSubtitles.cpp \
        SubtitleRenderer.cpp \
        Unicode.cpp \
        Srt.cpp \
        KeyConfig.cpp \
        OMXControl.cpp \
        Keyboard.cpp \
        omxplayer.cpp \

OBJS+=$(filter %.o,$(SRC:.cpp=.o))

all: dist

%.o: %.cpp
    @rm -f $@
    $(CXX) $(CFLAGS) $(INCLUDES) -c $< -o $@ -Wno-deprecated-declarations

omxplayer.o: help.h keys.h

version:
    bash gen_version.sh > version.h

omxplayer.bin: version $(OBJS)
    $(CXX) $(LDFLAGS) -o omxplayer.bin $(OBJS) -lvchiq_arm -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
    $(STRIP) omxplayer.bin

help.h: README.md Makefile
    awk '/SYNOPSIS/{p=1;print;next} p&&/KEY BINDINGS/{p=0};p' $< \
    | sed -e '1,3 d' -e 's/^/"/' -e 's/$$/\\n"/' \
    > $@
keys.h: README.md Makefile
    awk '/KEY BINDINGS/{p=1;print;next} p&&/KEY CONFIG/{p=0};p' $< \
    | sed -e '1,3 d' -e 's/^/"/' -e 's/$$/\\n"/' \
    > $@

omxplayer.1: README.md
    sed -e '/DOWNLOADING/,/omxplayer-dist/ d; /DBUS/,$$ d' $< >MAN
    curl -F page=@MAN http://mantastic.herokuapp.com 2>/dev/null >$@

clean:
    for i in $(OBJS); do (if test -e "$$i"; then ( rm $$i ); fi ); done
    @rm -f omxplayer.old.log omxplayer.log
    @rm -f omxplayer.bin
    @rm -rf $(DIST)
    @rm -f omxplayer-dist.tar.gz

ffmpeg:
    @rm -rf ffmpeg
    make -f Makefile.ffmpeg
    make -f Makefile.ffmpeg install

dist: omxplayer.bin omxplayer.1
    mkdir -p $(DIST)/usr/lib/omxplayer
    mkdir -p $(DIST)/usr/bin
    mkdir -p $(DIST)/usr/share/doc/omxplayer
    mkdir -p $(DIST)/usr/share/man/man1
    cp omxplayer omxplayer.bin $(DIST)/usr/bin
    cp COPYING $(DIST)/usr/share/doc/omxplayer
    cp README.md $(DIST)/usr/share/doc/omxplayer/README
    cp omxplayer.1 $(DIST)/usr/share/man/man1
    cp -a /usr/local/lib/*.so* $(DIST)/usr/lib/omxplayer/

When I run the last step — sudo make — the system was able to compile successfully and I didn't see any warning of missing header files etc. At the end of the make, I saw that the system copies the binary to /usr/bin, copies libraries to /usr/lib/omxplayer, all in all no complain.

Now the problem is when I run:
- ./omxplayer   : the terminal complained that "pgrep: invalid option -- 'F'", I can see that in the omxplayer script, it is calling the pgrep function. This can probably be fixed with replacing the F with a correct flag.
- omxplayer.bin : the terminal complained that "omxplayer.bin: error while loading shared libraries: libWFC.so: cannot open shared object file: No such file or directory". If I list all files in /usr/lib/omxplayer, I can see libWFC.so and other various *.so files.

What did I do wrong, any idea?
Title: Re: PiCore and Omxplayer
Post by: Rich on November 19, 2015, 01:46:13 AM
Hi paperone
Quote
- ./omxplayer   : the terminal complained that "pgrep: invalid option -- 'F'", I can see that in the omxplayer script, it is calling the pgrep function. This can probably be fixed with replacing the F with a correct flag.
Just a guess on my part, but maybe try  P  since it seem to be looking at a process ID.
Quote
- omxplayer.bin : the terminal complained that "omxplayer.bin: error while loading shared libraries: libWFC.so: cannot open shared object file: No such file or directory". If I list all files in /usr/lib/omxplayer, I can see libWFC.so and other various *.so files.
Try running  depmod  first and see if that fixes it.
Title: Re: PiCore and Omxplayer
Post by: bmarkus on November 19, 2015, 02:08:51 AM
depmod has nothing to do with *.so shared libraries, it is for kernel modules.

If you see missing *.so reason usually it is not installed, not in ldconfig path or ldconfig is not executed.

Check you have installed VideoCore libraries, location and run ldconfig. If necessary, copy/symlink them to a proper dir or adjust ldconfig path.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 19, 2015, 02:58:03 AM
Hi paperone
Quote
- ./omxplayer   : the terminal complained that "pgrep: invalid option -- 'F'", I can see that in the omxplayer script, it is calling the pgrep function. This can probably be fixed with replacing the F with a correct flag.
Just a guess on my part, but maybe try  P  since it seem to be looking at a process ID.
Quote
- omxplayer.bin : the terminal complained that "omxplayer.bin: error while loading shared libraries: libWFC.so: cannot open shared object file: No such file or directory". If I list all files in /usr/lib/omxplayer, I can see libWFC.so and other various *.so files.
Try running  depmod  first and see if that fixes it.

Thanks Rich but unfortunately it didn't work, I've played around with f, F, p and P but it kept throwing me invalid option.

depmod has nothing to do with *.so shared libraries, it is for kernel modules.

If you see missing *.so reason usually it is not installed, not in ldconfig path or ldconfig is not executed.

Check you have installed VideoCore libraries, location and run ldconfig. If necessary, copy/symlink them to a proper dir or adjust ldconfig path.


Markus, thanks! I can get past the mising libWFC.so by adding /opt/vc/lib to /etc/ld.so.conf and rebuild the cache. Now I can't seem to find libpcre.so.3, the pcre.tcz extension in the repo only contains: libpcre.so, libcpre.so.1, libcpre.so.1.2.4 and a variety of others, just not libcpre.so.3.  ;D
Title: Re: PiCore and Omxplayer
Post by: bmarkus on November 19, 2015, 04:53:41 AM
libpcre3 is a Debian package. If you build omxplayer on piCore with its pcre you can't see such messages which indicates you are running a binary built on Raspbian.
Title: Re: PiCore and Omxplayer
Post by: paperone on November 19, 2015, 08:35:45 PM
libpcre3 is a Debian package. If you build omxplayer on piCore with its pcre you can't see such messages which indicates you are running a binary built on Raspbian.

Ok. Now, I am wondering where does the libpcre3 came from? Let me take a step back and list them out:

Else, I would need to redo everything again if I can spot any missed error. Btw, thank you for your time markus!