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:
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?