WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: PiCore and Omxplayer  (Read 18659 times)

Offline paperone

  • Newbie
  • *
  • Posts: 19
Re: PiCore and Omxplayer
« Reply #30 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!
Hello from sunny Singapore! :)

Offline paperone

  • Newbie
  • *
  • Posts: 19
Re: PiCore and Omxplayer
« Reply #31 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?
Hello from sunny Singapore! :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: PiCore and Omxplayer
« Reply #32 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.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: PiCore and Omxplayer
« Reply #33 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.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline paperone

  • Newbie
  • *
  • Posts: 19
Re: PiCore and Omxplayer
« Reply #34 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
« Last Edit: November 19, 2015, 03:16:16 AM by paperone »
Hello from sunny Singapore! :)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: PiCore and Omxplayer
« Reply #35 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.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline paperone

  • Newbie
  • *
  • Posts: 19
Re: PiCore and Omxplayer
« Reply #36 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!
Hello from sunny Singapore! :)