Ubuntu 14.04 + LibCEC


24 posts
by AdamPapworth » Fri Mar 20, 2015 7:18 pm
Evening,

I have been playing around with Ubuntu 14.04 on the PI2 for the last couple of days, and everything seems to be more responsive, and performance seems to be slightly improved. I have however hit a snag.

Ive successfully compiled Kodi (14.1 Helix) from git, and everything is working well, except for LibCEC.

I can compile libcec without the "--enable-rpi" and it builds fine, however when trying to build the with RPi support, I get an error saying that the Raspberry Pi API is not installed or is not compatible.

Has anyone had any success building LibCEC? if so any pointers?

Many Thanks.
Posts: 2
Joined: Sat Jan 19, 2013 5:20 pm
by ktb » Fri Mar 20, 2015 7:32 pm
Nope. If you read through 14.04 thread, you'll see I ran into the same/similar problem. AFAIK, nobody has been able to get around those issues. I'm convinced there is something not quite right about the userland stuff on the 14.04 image. Perhaps it is due to the unusual way the VC bin, lib, and include files have been placed in usr/bin, usr/lib and usr/include instead of under /opt/vc. Good luck. Let us know if you find a solution.
Posts: 1379
Joined: Fri Dec 26, 2014 7:53 pm
by asavah » Fri Mar 20, 2015 11:41 pm
I didn't try ubuntu yet, but my own os has vc userland stuff installed to /usr/{bin,lib,include} and libcec builds and works fine.
Try adding this to ./configure args to force libcec to pickup includes and libs:
Code: Select all
--enable-rpi --disable-exynos --with-rpi-include-path=/usr/include --with-rpi-lib-path=/usr/lib


I'm not sure if ubuntu build for rpi is multiarch, if true try --with-rpi-lib-path=/usr/lib32.

However if you have problems compiling something it's a good practice to provide a link to pastebin with the error.
Posts: 238
Joined: Thu Aug 14, 2014 12:49 am
by ktb » Sat Mar 21, 2015 3:12 am
Same problem? viewtopic.php?p=710458#p710458

./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi
...
checking interface/vmcs_host/vc_cec.h usability... yes
checking interface/vmcs_host/vc_cec.h presence... yes
checking for interface/vmcs_host/vc_cec.h... yes
checking interface/vmcs_host/vc_cecservice.h usability... yes
checking interface/vmcs_host/vc_cecservice.h presence... yes
checking for interface/vmcs_host/vc_cecservice.h... yes
checking interface/vchiq_arm/vchiq_if.h usability... yes
checking interface/vchiq_arm/vchiq_if.h presence... yes
checking for interface/vchiq_arm/vchiq_if.h... yes
checking bcm_host.h usability... yes
checking bcm_host.h presence... yes
checking for bcm_host.h... yes
checking interface/vmcs_host/vc_cec.h compatibility... yes
checking for vchi_initialise in -lbcm_host... no
checking for vc_vchi_cec_init in -lbcm_host... yes
checking for vc_cec_get_logical_address in -lbcm_host... yes
checking for vc_cec_get_physical_address in -lbcm_host... yes
checking for vc_cec_param2message in -lbcm_host... yes
checking for vc_cec_poll_address in -lbcm_host... yes
checking for vc_cec_register_callback in -lbcm_host... yes
checking for vc_cec_release_logical_address in -lbcm_host... yes
checking for vc_cec_set_passive in -lbcm_host... yes
checking for vcos_init in -lbcm_host... yes
checking for vchiq_initialise in -lbcm_host... no
checking for vchi_initialise in -lbcm_host... (cached) no
checking for vchi_create_connection in -lbcm_host... no
checking for bcm_host_init in -lbcm_host... yes
configure: error: Raspberry Pi API not found or incompatible with libCEC

That was after creating a symlink at /opt/vc to /usr

I had also tried nearly the exact configure line you suggested (except for --disable-exynos), but got the same results as above:
./configure --with-rpi-include-path=/usr/include --with-rpi-lib-path=/usr/lib --enable-rpi
Posts: 1379
Joined: Fri Dec 26, 2014 7:53 pm
by asavah » Sat Mar 21, 2015 4:23 pm
Code: Select all
checking for vchiq_initialise in -lbcm_host... no
checking for vchi_initialise in -lbcm_host... (cached) no
checking for vchi_create_connection in -lbcm_host... no
checking for bcm_host_init in -lbcm_host... yes
configure: error: Raspberry Pi API not found or incompatible with libCEC


Uh-oh
There is the problem.

That's how it looks on my os:
Code: Select all
checking for vchiq_initialise in -lbcm_host... yes
checking for vchi_initialise in -lbcm_host... (cached) yes
checking for vchi_create_connection in -lbcm_host... yes
checking for bcm_host_init in -lbcm_host... yes


My guess is that ubuntu ships an outdated version of vc4 userland stuff,
which is incompatible with current version of libcec.

There would be two ways of fixing this:
1) upgrade vc4 stuff in ubuntu.
2) find an older version of libcec on https://github.com/Pulse-Eight/libcec/releases which would work with older firmware.
Posts: 238
Joined: Thu Aug 14, 2014 12:49 am
by nlrb » Mon Apr 13, 2015 8:15 pm
The checks for libcec are wrong as far as I can see with the latest userland:
Code: Select all
checking for vchiq_initialise in -lbcm_host... no
checking for vchi_initialise in -lbcm_host... (cached) no
checking for vchi_create_connection in -lbcm_host... no
These functions now live in library 'vchiq_arm'.

I haven't built libCEC on Ubuntu, but on Raspbian I had to follow the next steps.
Code: Select all
1. Install required tools (e.g. gcc 4.8 for C++11 support)
   sudo apt-get install cmake g++-4.8
2. Get development headers
   sudo apt-get install liblockdev1-dev libudev-dev libxrandr-dev
3. Python & SWIG
   sudo apt-get install python-dev swig
4. Get all the latest code
   git clone --recursive git@github.com:Pulse-Eight/libcec.git
5. Modify ~/libcec/src/libcec/cmake/CheckPlatformSupport.cmake
   change
     check_library_exists(bcm_host vchi_initialise "" HAVE_RPI_API)
   to
     check_library_exists(bcm_host bcm_host_init "" HAVE_RPI_API)
   and below 'set(LIB_INFO "${LIB_INFO}, 'RPi'")' add
     include_directories(/opt/vc/include /opt/vc/include/interface/vcos/pthreads /opt/vc/include/interface/vmcs_host/linux)
6. Build platform
   cd ~/libcec/src/platform
   mkdir build
   cd build
   cmake -DCMAKE_CXX_COMPILER=g++-4.8 ..
   make
   sudo make install
7. Build libcec
   cd ~/libcec
   mkdir build
   cd build
   export LIBRARY_PATH=/opt/vc/lib
   cmake -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 ..
   make
   sudo -E bash -c 'make install'
Posts: 6
Joined: Mon Apr 13, 2015 7:50 pm
by ktb » Mon Apr 13, 2015 9:30 pm
Nice tips, especially step 5.
Posts: 1379
Joined: Fri Dec 26, 2014 7:53 pm
by Seksan2 » Sun Apr 19, 2015 8:44 am
Just tried doing this on the latest raspbian and it was all going fine until it came to step 7 when i tried to run the cmake command:
Code: Select all
-- The C compiler identification is GNU 4.6.3
-- The CXX compiler identification is GNU 4.6.3
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test SUPPORTS_CXX11
-- Performing Test SUPPORTS_CXX11 - Failed
CMake Error at src/cec-client/CMakeLists.txt:21 (find_package):
  By not providing "Findplatform.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "platform",
  but CMake did not find one.

  Could not find a package configuration file provided by "platform" with any
  of the following names:

    platformConfig.cmake
    platform-config.cmake

  Add the installation prefix of "platform" to CMAKE_PREFIX_PATH or set
  "platform_DIR" to a directory containing one of the above files.  If
  "platform" provides a separate development package or SDK, be sure it has
  been installed.

-- Configuring incomplete, errors occurred!
Makefile:120: recipe for target 'cmake_check_build_system' failed


Help would be appreciated please
Thanks
Intelligence is quite Sexy!
Posts: 1
Joined: Sun Feb 22, 2015 1:34 am
Location: Australia
by nlrb » Sun Apr 19, 2015 1:17 pm
Looks to be multiple errors in there. Did you follow each step to the letter?
  • C++ compiler is not found to be g++-4.8
  • platform cannot be found, which should be there after 'sudo make install' of step 6.
Posts: 6
Joined: Mon Apr 13, 2015 7:50 pm
by kartik93abc » Sat May 02, 2015 8:21 pm
Got this error on step 7
Can you help
g++-4.8: internal compiler error: Segmentation fault (program collect2)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
src/libcec/CMakeFiles/cec.dir/build.make:885: recipe for target 'src/libcec/libcec.so.3.0.0' failed
make[2]: *** [src/libcec/libcec.so.3.0.0] Error 4
CMakeFiles/Makefile2:227: recipe for target 'src/libcec/CMakeFiles/cec.dir/all' failed
make[1]: *** [src/libcec/CMakeFiles/cec.dir/all] Error 2
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Posts: 1
Joined: Sat May 02, 2015 8:18 pm
by gkreidl » Wed May 27, 2015 12:01 pm
I managed to get libCEC-3.0 compiled and installed on Raspbian following the OP, but had to install and make "platform" from a separate github repository ( https://github.com/Pulse-Eight/platform ). It's working with kodi now.

But when I try to configure the newest kodi sources, which require libCEC-3.0, it is not found and CEC-support is missing. Any idea?
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5121
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by coopak » Sat Jun 06, 2015 8:03 am
gkreidl wrote:I managed to get libCEC-3.0 compiled and installed on Raspbian following the OP, but had to install and make "platform" from a separate github repository ( https://github.com/Pulse-Eight/platform ). It's working with kodi now.

But when I try to configure the newest kodi sources, which require libCEC-3.0, it is not found and CEC-support is missing. Any idea?


How did you use the separate platform? Did you just wget the platform repository and save it in ~/libcec/src/platform and then follow OP's original compile instructions?
Posts: 2
Joined: Thu Jun 04, 2015 5:53 am
by gkreidl » Sat Jun 06, 2015 9:38 am
coopak wrote:
gkreidl wrote:I managed to get libCEC-3.0 compiled and installed on Raspbian following the OP, but had to install and make "platform" from a separate github repository ( https://github.com/Pulse-Eight/platform ). It's working with kodi now.

But when I try to configure the newest kodi sources, which require libCEC-3.0, it is not found and CEC-support is missing. Any idea?


How did you use the separate platform? Did you just wget the platform repository and save it in ~/libcec/src/platform and then follow OP's original compile instructions?


No, I got it as a separate github project and compiled it separately. Meanwhile it's working with kodi-15-beta2 (see https://www.raspberrypi.org/forums/view ... 6&t=109088 ).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5121
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by sirjonnyboy » Sun Jun 14, 2015 11:01 pm
Hey everyone, could someone help me out by compiling the current way to get CEC working into a single post? I mixed myself up by starting with This Post and tried following the comments to get it all worked out. Needless to say, it didn't work. At this point I have no idea what I'm doing. I know you guys have gotten this to work and would love it if someone could show me how.
Thanks so much.
Posts: 1
Joined: Sun Jun 14, 2015 10:49 pm
by EMJB » Sun Jul 12, 2015 5:19 pm
Have just tried nlrb's procedure for installation on a Pi1 with Raspbian, and all worked OK after an "apt-get update" until:
Code: Select all
~ $ git clone --recursive git@github.com:Pulse-Eight/libcec.git
Cloning into 'libcec'...
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,192.30.252.131' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly


Can anyone help me proceed please?

EMJB
Posts: 93
Joined: Wed Jun 12, 2013 8:29 am
by asavah » Mon Jul 13, 2015 10:05 am
use https://

git clone --recursive https://github.com/Pulse-Eight/libcec.git
Posts: 238
Joined: Thu Aug 14, 2014 12:49 am
by EMJB » Mon Jul 13, 2015 1:52 pm
asavah wrote:use https://

git clone --recursive https://github.com/Pulse-Eight/libcec.git


Many thanks - it now seems to compile (after doing Raspbian update), but got one error message:
Code: Select all
-- Looking for __atomic_fetch_add_4 in atomic
-- Looking for __atomic_fetch_add_4 in atomic - not found

Just have to see if it works in spite of that!

EMJB
Posts: 93
Joined: Wed Jun 12, 2013 8:29 am
by EMJB » Mon Jul 13, 2015 4:49 pm
Oops - missed a group of error messages:

Code: Select all
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
RPI_BCM_HOST
    linked by target "cec" in directory /home/pi/libcec/src/libcec
RPI_VCHIQ_ARM
    linked by target "cec" in directory /home/pi/libcec/src/libcec
RPI_VCOS
    linked by target "cec" in directory /home/pi/libcec/src/libcec

so it did not compile OK after all. Can anyone help with these or the "__atomic_fetch_add_4" error in my previous post?

EMJB
Posts: 93
Joined: Wed Jun 12, 2013 8:29 am
by sam nazarko » Mon Jul 20, 2015 9:54 pm
This is a new change in 3.0.1. You need to add:

-DRPI_BCM_HOST=1 -DRPI_VCHIQ_ARM=1 -DRPI_VCOS=1

Sam
Posts: 144
Joined: Wed Apr 25, 2012 5:05 pm
by EMJB » Tue Jul 21, 2015 5:59 pm
sam nazarko wrote:This is a new change in 3.0.1. You need to add:

-DRPI_BCM_HOST=1 -DRPI_VCHIQ_ARM=1 -DRPI_VCOS=1

Sam


Thanks - do I add those to "libcec/src/libcec/cmake/CheckPlatformSupport.cmake", and if so does it matter where?

EMJB
Posts: 93
Joined: Wed Jun 12, 2013 8:29 am
by gkreidl » Tue Jul 21, 2015 6:55 pm
No, they are arguments for the cmake command, like this:
Code: Select all
cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 ..
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer
Posts: 5121
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany
by EMJB » Thu Jul 23, 2015 8:44 am
Thanks gkreidl, that has cleared that problem. Need to investigate the next one further before requesting help.

EMJB
Posts: 93
Joined: Wed Jun 12, 2013 8:29 am
by JSavino » Sat Aug 29, 2015 1:33 pm
Hey all, I'm getting a cmake error of:
Code: Select all
CMake Error: cmake_symlink_library: System Error: Operation not permitted


I assume this is because I am attempting to make it on a vfat usb drive attached to my raspberry pi. Any thoughts on how to work around this?
Posts: 1
Joined: Sat Aug 29, 2015 1:30 pm
by pawnguyen » Mon Mar 14, 2016 4:32 pm
gkreidl wrote:No, they are arguments for the cmake command, like this:
Code: Select all
cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 ..


I know this post is old but I wanted to post incase someone else ran into the same problems I did. I installed Ubuntu 14.04 on my Raspberry PI 2. Follow the libCEC install for raspberry pi according to libcec github page as of this post. I was able to compile and install however i did not have raspberry pi support.

I followed the steps provided above by by nlrb (thank you). most important was step 7 and symlinks to from opt/vc to /usr which was stated in this post:
https://wiki.ubuntu.com/ARM/RaspberryPi

I also installed the raspberry pi Libraries as instructed to do so form that wiki as well.

Again i was able to compile but no support for raspberry pi.

It was until i ran:
Code: Select all
cmake -DRPI_INCLUDE_DIR=/opt/vc/include -DRPI_LIB_DIR=/opt/vc/lib -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 ..

I saw raspberry pi was supported. I continued with install then ran "cec-client" and got my tv information and power status.

thanks @gkreidl
Posts: 2
Joined: Mon Mar 14, 2016 4:17 pm