From d2c343a20bb61098d0450b15ea2d1dacd28d954a Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Sun, 12 Aug 2018 15:13:24 +0200 Subject: [PATCH] Fix crosscompiling issues The codepath for KODI_DEPENDSBUILD needs to be used in order to provide the correct crosscompiling options to ffmpeg. The CMake option KODI_DEPENDSBUILD itself can not be enabled because it disables the internal build of libdvd*. To link kodi.bin with the statically built ffmpeg libraries kodi uses a wrapper script which calls pkgconfig. Our pkgconfig is patched to alter paths which breaks the link command in this case, to fix this PKG_CONFIG_SYSROOT_DIR was added. Also remove configure option --cpu from ffmpeg_conf to fix build errors. Signed-off-by: Bernd Kuhls --- project/cmake/modules/FindFFMPEG.cmake | 16 +++++++--------- tools/depends/target/ffmpeg/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/project/cmake/modules/FindFFMPEG.cmake b/project/cmake/modules/FindFFMPEG.cmake index 28cc80710e..1ac8793149 100644 --- a/cmake/modules/FindFFMPEG.cmake +++ b/cmake/modules/FindFFMPEG.cmake @@ -234,14 +234,12 @@ -DENABLE_VAAPI=${ENABLE_VAAPI} -DENABLE_VDPAU=${ENABLE_VDPAU}) - if(KODI_DEPENDSBUILD) set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH} -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE} -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -DOS=${OS} + -DOS=linux -DCMAKE_AR=${CMAKE_AR}) - endif() set(LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) list(APPEND LINKER_FLAGS ${SYSTEM_LDFLAGS}) @@ -280,12 +278,12 @@ "#!${BASH_COMMAND} if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}${APP_BINARY_SUFFIX}* || $@ == *${APP_NAME_LC}.so* || $@ == *${APP_NAME_LC}-test* ]] then - avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` - avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat` - avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter` - avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil` - swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale` - swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample` + avformat=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` + avcodec=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat` + avfilter=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter` + avutil=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil` + swscale=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale` + swresample=`PKG_CONFIG_SYSROOT_DIR=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample` gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls` $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls else diff --git a/tools/depends/target/ffmpeg/CMakeLists.txt b/tools/depends/target/ffmpeg/CMakeLists.txt index fda6b0cac4..af3afa6b60 100644 --- a/tools/depends/target/ffmpeg/CMakeLists.txt +++ b/tools/depends/target/ffmpeg/CMakeLists.txt @@ -13,7 +13,7 @@ if(CROSSCOMPILING) set(pkgconf "PKG_CONFIG_LIBDIR=${DEPENDS_PATH}/lib/pkgconfig") list(APPEND ffmpeg_conf --pkg-config=${PKG_CONFIG_EXECUTABLE} --pkg-config-flags=--static) - list(APPEND ffmpeg_conf --enable-cross-compile --cpu=${CPU} --arch=${CPU} --target-os=${OS}) + list(APPEND ffmpeg_conf --enable-cross-compile --arch=${CPU} --target-os=${OS}) list(APPEND ffmpeg_conf --ar=${CMAKE_AR} --strip=${CMAKE_STRIP}) message(STATUS "CROSS: ${ffmpeg_conf}") endif()