I am building kodi on Arch ARM for Raspberry Pi2 (armv7h) with the following this cmake stanza. It works but it throws tons of warnings about conflicting switches. For example:
Code:
/scratch-nfs/PKGBUILDs/alarm/kodi-rbp/src/xbmc-17.3-Krypton/xbmc/profiles/ProfilesManager.cpp:1:0: warning: switch -mcpu=cortex-a7 conflicts with -march=armv7-a switch
...
/scratch-nfs/PKGBUILDs/alarm/kodi-rbp/src/xbmc-17.3-Krypton/xbmc/interfaces/legacy/WindowXML.cpp:1:0: warning: switch -mcpu=cortex-a7 conflicts with -march=armv7-a switch
The CFLAGS and CXXFLAGS are the distro default. Should I adjust the -DWITH_CPU flag to something else? The resulting package should run on both RPi2 and RPi3. Thanks.
Code:
export CFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
export CXXFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_PREFIX_PATH=/opt/vc \
-DCORE_SYSTEM_NAME=rbpi \
-DWITH_CPU=cortex-a7 \
-DENABLE_EVENTCLIENTS=ON \
-DENABLE_OPENGL=OFF \
-DENABLE_X11=OFF \
-DENABLE_VAAPI=OFF \
-DENABLE_VDPAU=OFF \
-DLIRC_DEVICE=/run/lirc/lircd \
../xbmc-17.3-Krypton/project/cmake
make
make preinstall
The warning is correct,
the right march for cortex-a7 is armv7ve
If you're building on/for pi2 mfpu is wrong too,
should be neon-vfpv4
(2017-05-27, 12:57)asavah Wrote: [ -> ]The warning is correct,
the right march for cortex-a7 is armv7ve
If you're building on/for pi2 mfpu is wrong too,
should be neon-vfpv4
I found
this bug report that agrees with your march statement.... yet:
Code:
% gcc -c -Q -march=native --help=target | grep march
-march= armv7-a
EDIT: Also looking in
tools/depends/configure.ac it seems that they are hardcoding the values I picked. Perhaps I am misunderstanding?
Yep, it,s hardcoded there, but that's correct for pi2 and the warning comes from c*flags in pkgbuild.
As for the other part - can't tell, it's actually gcc internals, which is complicated stuff, my pi2 has an old build of my crappo-os without gcc, can't check.
EDIT: I think the march stuff changed between gcc versions, eg armv7-a was ok for 5.x and lower, but changed for 6.x and higher,
I currently use linaro-7.1
After some tinkering, I ended up modifying the C*LAGS in the PKGBUILD which removed the warnings.
Code:
CFLAGS+=" -march=armv7ve"
CXXFLAGS="${CFLAGS}"
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DENABLE_EVENTCLIENTS=ON \
-DLIRC_DEVICE=/run/lirc/lircd \
-DWITH_CPU=cortex-a7 \
-DENABLE_CEC=OFF \
-DENABLE_SSH=OFF \
-DCMAKE_PREFIX_PATH=/opt/vc \
-DCORE_SYSTEM_NAME=rbpi \
-DENABLE_OPENGL=OFF \
-DENABLE_X11=OFF \
-DENABLE_VAAPI=OFF \
-DENABLE_VDPAU=OFF \
../"xbmc-$pkgver-$_codename"/project/cmake
...
(2017-05-27, 12:57)asavah Wrote: [ -> ]The warning is correct,
the right march for cortex-a7 is armv7ve
Old thread but relevant question: how did you make the association between cortex-a7 and armv7ve? I ask because I see a similar warning when I build for the original RPi (armv6h):
Code:
cc1: warning: switch -mcpu=arm1176jzf-s conflicts with -march=armv6 switch
I'm seeking the correct value for -march= for armv6h for RPi1. Thanks!
EDIT: Seems like the setting might be armv6zk:
Code:
% gcc -c -Q -march=native --help=target
The following options are target specific:
-mabi= aapcs-linux
-mabort-on-noreturn [disabled]
-mandroid [disabled]
-mapcs [disabled]
-mapcs-frame [disabled]
-mapcs-reentrant [disabled]
-mapcs-stack-check [disabled]
-march= armv6zk
-marm [enabled]
-masm-syntax-unified [disabled]
-mbig-endian [disabled]
-mbionic [disabled]
-mcallee-super-interworking [disabled]
-mcaller-super-interworking [disabled]
-mcmse [disabled]
-mcpu= [default]
-mfix-cortex-m3-ldrd [disabled]
-mflip-thumb [disabled]
-mfloat-abi= hard
-mfp16-format= none
-mfpu= vfp
-mglibc [enabled]
-mhard-float
-mlittle-endian [enabled]
-mlong-calls [disabled]
-mmusl [disabled]
-mneon-for-64bits [disabled]
-mpic-data-is-text-relative [enabled]
-mpic-register=
-mpoke-function-name [disabled]
-mprint-tune-info [disabled]
-mpure-code [disabled]
-mrestrict-it [disabled]
-msched-prolog [enabled]
-msingle-pic-base [disabled]
-mslow-flash-data [disabled]
-msoft-float
-mstructure-size-boundary= 8
-mthumb [disabled]
-mthumb-interwork [disabled]
-mtls-dialect= gnu
-mtp= cp15
-mtpcs-frame [disabled]
-mtpcs-leaf-frame [disabled]
-mtune= [default]
-muclibc [disabled]
-munaligned-access [enabled]
-mvectorize-with-neon-double [disabled]
-mvectorize-with-neon-quad [enabled]
-mword-relocations [disabled]
Known ARM ABIs (for use with the -mabi= option):
aapcs aapcs-linux apcs-gnu atpcs iwmmxt
Known ARM architectures (for use with the -march= option):
armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv5tej armv6 armv6-m armv6j armv6k armv6kz armv6s-m
armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8-m.base armv8-m.main
armv8-m.main+dsp armv8.1-a armv8.2-a armv8.2-a+fp16 iwmmxt iwmmxt2 native
Known __fp16 formats (for use with the -mfp16-format= option):
alternative ieee none
Known ARM FPUs (for use with the -mfpu= option):
auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp
vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16
Valid arguments to -mtp=:
auto cp15 soft
Known floating-point ABIs (for use with the -mfloat-abi= option):
hard soft softfp
Known ARM CPUs (for use with the -mcpu= and -mtune= options):
arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s
arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t
arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920
arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7
cortex-a17 cortex-a17.cortex-a7 cortex-a32 cortex-a35 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7
cortex-a72 cortex-a72.cortex-a53 cortex-a73 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a8 cortex-a9 cortex-m0
cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m23 cortex-m3
cortex-m33 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 ep9312 exynos-m1 fa526 fa606te fa626
fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110
strongarm1100 strongarm1110 xgene1 xscale
TLS dialect to use:
gnu gnu2
Honestly I don't remember where I found the info, probably google, arm docs, gcc docs.
I use following cflags:
Code:
pi3: -mcpu=cortex-a53+crc -mfpu=neon-fp-armv8 <- yep, this is for 32bit
pi2: -mcpu=cortex-a7 -mfpu=neon-vfpv4
pi1: -mcpu=arm1176jzf-s -mfpu=vfp
For pi1 if my old notes don't lie march is -march=armv6zk
Note that if you set mcpu there is no need for march anymore, at least on modern gcc.
(2018-03-10, 18:09)asavah Wrote: [ -> ]Note that if you set mcpu there is no need for march anymore, at least on modern gcc.
Is that how it works? I always thought one should define the -march= parameter and that would trigger other flags automatically.
On my RPi3:
Code:
% gcc -c -Q -march=native --help=target | grep 'march\|mtune\|mcpu\|mfpu'
-march= armv8-a+crc
-mcpu= [default]
-mfpu= vfpv3-d16
-mtune= [default]
So do the [default] values imply I need only set march and mfpu?
Thanks for the links... when I try building on my RPi3 (running Arch ARM armv7h) with your mcpu line, I kodi 17.6 fails:
Code:
-- The CXX compiler identification is GNU 7.2.1
-- The C compiler identification is GNU 7.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/lib/distcc/bin/cc
-- Check for working CXX compiler: /usr/lib/distcc/bin/c++
-- Check for working CXX compiler: /usr/lib/distcc/bin/c++ -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/usr/lib/distcc/bin/c++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_9ab3a/fast"
/usr/bin/make -f CMakeFiles/cmTC_9ab3a.dir/build.make CMakeFiles/cmTC_9ab3a.dir/build
make[1]: Entering directory '/scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_9ab3a.dir/testCXXCompiler.cxx.o
/usr/lib/distcc/bin/c++ -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong -fno-plt -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a53+crc -o CMakeFiles/cmTC_9ab3a.dir/testCXXCompiler.cxx.o -c /scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
distcc[18109] (dcc_build_somewhere) Warning: failed to distribute, running locally instead
c++: error: unrecognized argument in option ‘-mcpu=cortex-a53+crc’
c++: note: valid arguments to ‘-mcpu=’ are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a17 cortex-a17.cortex-a7 cortex-a32 cortex-a35 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a72 cortex-a72.cortex-a53 cortex-a73 cortex-a73.cortex-a35 cortex-a73.cortex-a53 cortex-a8 cortex-a9 cortex-m0 cortex-m0.small-multiply cortex-m0plus cortex-m0plus.small-multiply cortex-m1 cortex-m1.small-multiply cortex-m23 cortex-m3 cortex-m33 cortex-m4 cortex-m7 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 ep9312 exynos-m1 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xgene1 xscale; did you mean ‘cortex-a53’?
distcc[18109] ERROR: compile /scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx on localhost failed
make[1]: *** [CMakeFiles/cmTC_9ab3a.dir/build.make:66: CMakeFiles/cmTC_9ab3a.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory '/scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_9ab3a/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "/scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeOutput.log".
See also "/scratch/PKGBUILDs/alarm/kodi-rbp/src/kodi-build/CMakeFiles/CMakeError.log".
Seems that my gcc doesn't recognize it as a valid option. Arch ARM arm7h is currently shipping gcc (GCC) 7.2.1 20180116.
Ouch, drop the +crc part, I was writing from memory.
The flags you linked apply to depends, not sure if they are used for kodi itself,
AFAIK for building kodi itself these
https://github.com/xbmc/xbmc/blob/master....cmake#L24 are used.
But if other flags are present in the environment vars I'm not sure which ones will take precedence.
Got it! So the Arch ARM (armv7h) default CFLAGS in /etc/makepkg.conf are:
Code:
CFLAGS="-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong -fno-plt"
I redefined in the PKGBUILD with:
Code:
CFLAGS+=" -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a53"
And I patched the source with the following to get the result I described:
https://github.com/graysky2/kodi-raspberrypi3