Kodi Community Forum
[Cross compiling] - Need to pass the --arch=arm to ffmpeg build when cross compiling - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [Cross compiling] - Need to pass the --arch=arm to ffmpeg build when cross compiling (/showthread.php?tid=343996)



[Cross compiling] - Need to pass the --arch=arm to ffmpeg build when cross compiling - graysky - 2019-05-18

I am building Kodi for armv7h on another ARM machine that runs armv8.  I get this errors on the ffmpeg step:
Code:
...
src/libavutil/aarch64/bswap.h:31:5: error: invalid 'asm': invalid operand for code 'w'
     __asm__("rev16 %w0, %w0" : "+r"(x));
     ^~~~~~~
...

From googling this, it seems the problem is due to ffmpeg is including headers from the armv8 system, rather than from the cross-compiled target environment.  I think the solution might be to pass the --arm switch when cmake starts building ffmpeg.

Does Kodi offer any switch I can add to cmake to set this to only affect the ffmpeg build?

The following patch is a dirty hack I put together, but it allows for a successful build:
Code:
diff -uprN a/tools/depends/target/ffmpeg/CMakeLists.txt b/tools/depends/target/ffmpeg/CMakeLists.txt
--- a/tools/depends/target/ffmpeg/CMakeLists.txt 2019-04-15 16:33:43.000000000 -0400
+++ b/tools/depends/target/ffmpeg/CMakeLists.txt 2019-05-18 05:30:03.011169171 -0400
@@ -20,7 +20,7 @@ endif()

if(CORE_PLATFORM_NAME STREQUAL rbpi)
string(CONCAT CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux")
- list(APPEND ffmpeg_conf --enable-rpi)
+ list(APPEND ffmpeg_conf --enable-rpi --arch=arm)
endif()

if(CMAKE_C_FLAGS)



RE: [Cross compiling] - Need to pass the --arch=arm to ffmpeg build when cross compiling - kuro2357509 - 2019-05-31

Hi,

Kodi offers use external ffmpeg option to compile Kodi.

-DENABLE_INTERNAL_FFMPEG=OFF
-DFFMPEG_PATH=</path/to/your/ffmpeg>

Maybe it's helpful for you.

Reference to Kodi source code: CMakeList.txt