ssalonen / libcec-sys

FFI bindings for the libcec
GNU General Public License v2.0
2 stars 3 forks source link

Does not compile #1

Closed Janhouse closed 4 years ago

Janhouse commented 4 years ago

I'm trying to use cec-rs = '2.0.1' but libcec-sys build fails.

   Compiling libcec-sys v1.0.0
error: failed to run custom build command for `libcec-sys v1.0.0`

Caused by:
  process didn't exit successfully: `/project/target/debug/build/libcec-sys-967053c0d25720a3/build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  Building libcec from local source
  running: "cmake" "/project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/platform" "-DCMAKE_INSTALL_PREFIX=/project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--"
  Scanning dependencies of target p8-platform
  [ 50%] Building CXX object CMakeFiles/p8-platform.dir/src/util/StringUtils.cpp.o
  [100%] Linking CXX static library libp8-platform.a
  [100%] Built target p8-platform
  Install the project...
  -- Install configuration: "Debug"
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/lib/libp8-platform.a
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/os.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/posix/os-socket.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/posix/os-threads.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/posix/os-types.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/sockets/cdevsocket.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/sockets/socket.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/sockets/tcp.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/threads/atomics.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/threads/mutex.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/threads/threads.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/atomic.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/buffer.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/StringUtils.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/StdString.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/timeutils.h
  -- Installing: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/include/p8-platform/util/util.h
  -- Up-to-date: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/lib/pkgconfig/p8-platform.pc
  -- Up-to-date: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build/lib/p8-platform/p8-platform-config.cmake
  cargo:root=/project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/platform_build
  running: "cmake" "/project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor" "-DCMAKE_INSTALL_PREFIX=/project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/libcec_build" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
  -- git found: fatal: No names found, cannot describe anything.
  fatal: your current branch 'master' does not have any commits yet
  fatal: ambiguous argument '..HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  -- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR)
  -- Configured features:
  -- Pulse-Eight CEC Adapter:                yes
  -- Pulse-Eight CEC Adapter detection:      yes
  -- xrandr support:                         yes
  -- Raspberry Pi support:                   no
  -- TDA995x support:                        no
  -- Exynos support:                         no
  -- DRM support:                            yes
  -- AOCEC support:                          no
  -- Python support:                         no
  -- lib info: git revision: fatal: No names found, cannot describe anything.
  fatal: your current branch 'master' does not have any commits yet
  fatal: ambiguous argument '..HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
  fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]', compiled on Wed Sep  2 05:11:09 PM UTC 2020 by janhouse@media on Linux 5.8.5-arch1-1 (x86_64), features: P8_USB, DRM, P8_detect, randr
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/libcec_build/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--"
  Scanning dependencies of target cec
  [  2%] Building CXX object src/libcec/CMakeFiles/cec.dir/CECProcessor.cpp.o
  [  5%] Building CXX object src/libcec/CMakeFiles/cec.dir/LibCEC.cpp.o
  [  8%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/Pulse-Eight/USBCECAdapterMessage.cpp.o
  [ 10%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/Pulse-Eight/USBCECAdapterCommands.cpp.o
  [ 13%] Building CXX object src/libcec/CMakeFiles/cec.dir/LibCECC.cpp.o
  [ 16%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/Pulse-Eight/USBCECAdapterCommunication.cpp.o
  [ 18%] Building CXX object src/libcec/CMakeFiles/cec.dir/CECClient.cpp.o
  [ 21%] Building CXX object src/libcec/CMakeFiles/cec.dir/adapter/AdapterFactory.cpp.o

  --- stderr
  make: *** No targets specified and no makefile found.  Stop.
  In file included from /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/CECProcessor.cpp:34:
  /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/env.h:92:19: warning: missing terminating " character
     92 | #define LIB_INFO ("git revision: fatal: No names found, cannot describe anything.
        |                   ^
  In file included from /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/adapter/Pulse-Eight/USBCECAdapterMessage.cpp:34:
  /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/env.h:92:19: warning: missing terminating " character
     92 | #define LIB_INFO ("git revision: fatal: No names found, cannot describe anything.
        |                   ^
  /project/target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/env.h:93:28: warning: character constant too long for its type
     93 | fatal: your current branch 'master' does not have any commits yet
        |                            ^~~~~~~~

I'm on Archlinux and libcec from git builds fine so I'm not sure if the problem is with libcec-sys build file or something else.

ssalonen commented 4 years ago

Looks like the cmake build of vendored libcec fails... libcec installed in your system should not play a role as far as I know

Just to double-confirm... is this one failing for you?

$ git clone https://github.com/ssalonen/cec-rs.git
...
$ cd cec-rs
$ cargo build
....
$ find target -wholename '*/libcec/env.h' -exec cat {} \;|grep LIB_INFO  master
#define LIB_INFO ("git revision: v2.0.1+1-8a2d0be, compiled on Thu  3 Sep 05:48:04 UTC 2020 by RETRACTED@RETRACTED.localdomain on Linux 5.8.4-200.fc32.x86_64 (x86_64), features: P8_USB, DRM, P8_detect")
$ git --version
$ cargo --version

Can you please provide the output of the above?

Janhouse commented 4 years ago

It works when checking out cec-rs from git and running cargo build.

I guess the grep LIB_INFO master part should not have master in it since it would break it:

grep: master: No such file or directory
find: ‘cat’ terminated by signal 13

But here is the LIB_INFO line:

target/debug/build/libcec-sys-b1cbd7e697ae9d37/out/vendor/src/libcec/env.h:#define LIB_INFO ("git revision: v2.0.1+1-8a2d0be, compiled on Thu Sep  3 06:24:09 AM UTC 2020 by janhouse@media on Linux 5.8.5-arch1-1 (x86_64), features: P8_USB, DRM, P8_detect, randr")

Git version: git version 2.28.0 Cargo version: cargo 1.47.0-nightly (aa6872140 2020-07-23)

Then I tried building your cec-alsa-sync and it works. I moved my code to that codebase and it works. I don't know why. Cargo file is dead simple and uses the same versions. :exploding_head:

In any case, this can be closed. Thank you!

ssalonen commented 4 years ago

Yep you are right, the grep command was a bit off but you got it right.

Good to hear it's working now... Odd things :)