» »

Crosscompiling Gnuradia za RPi

Crosscompiling Gnuradia za RPi

poweroff ::

Torej, imam Ubuntu 15.04 (64-bit) in bi na njem želel crosscompilat najnovejšo verzijo Gnuradio za RaspberryPi (model B)

Uporabim naslednji recpt, ki sem ga sestavil iz nekaj vodičev in nekaj lastnih dodatkov.

1. Nastavitev toolchaina

cd ~/RaspberryPi
mkdir -p toolchain
cd toolchain
wget http://crosstool-ng.org/download/crosst...
tar xjf crosstool-ng-1.22.0.tar.bz2
cd crosstool-ng

mkdir -p ../local/crosstool-ng

sudo apt-get install bison cvs flex gperf texinfo automake libtool help2man libtool-bin

./configure --prefix=/home/matej/RaspberryPi/toolchain/local/crosstool-ng
make
make install

export PATH=$PATH:/home/matej/RaspberryPi/toolchain/local/crosstool-ng/bin/

Včasih je potrebno - da preprečimo toolchaini, da uporabi knjižnice na host mašini - reči še tole:
unset LD_LIBRARY_PATH


2. Prevajanje C
mkdir -p ~/RaspberryPi/staging
cd ~/RaspberryPi/staging/

ct-ng menuconfig

NASTAVITVE:
- Paths and misc options ---> Try features marked as EXPERIMENTAL
- Paths and misc options ---> Prefix directory: ${HOME}/RaspberryPi/toolchain/local/x-tools/${CT_TARGET}

- Target options ---> Target Architecture: arm
Leave setting: Endianness: (Little endian), Bitness: (32-bit)

- Operating System ---> Target OS: linux

- Binary utilities ---> binutils version: 2.25.1 (the most recent version that is not marked as EXPERIMENTAL)

- C compiler ---> [*] Show Linaro versions ││ gcc version (5.2.0) ---> linaro-4.9-2015.06

# Setting to cross-compile code that used C++11 futures/promises:
- Target options -> Architecture level: enter armv6

Save, Exit
===

ct-ng build

(melje dobre pol ure...)

cd ~/RaspberryPi/toolchain/local/x-tools/
export PATH=$PATH:/home/matej/RaspberryPi/toolchain/local/x-tools/arm-unknown-linux-gnueabi/bin
unset LD_LIBRARY_PATH


3. Prevajanje C++
cd ~/RaspberryPi/staging/
ct-ng menuconfig

NASTAVITVE

- C compiler ---> C++ (enable)

Save, Exit
===

ct-ng build

(melje nekaj minut...)


4. Namestitev CMAKE
mkdir ~/RaspberryPi/CMakeToolChain
cd ~/RaspberryPi/CMakeToolChain
nano Toolchain-RaspberryPi.cmake

V to datoteko vpišemo:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER
/home/matej/RaspberryPi/toolchain/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc)

SET(CMAKE_CXX_COMPILER
/home/matej/RaspberryPi/toolchain/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++)

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH
/home/matej/RaspberryPi/toolchain/local/x-tools/arm-unknown-linux-gnueabi)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


OK, zdaj grem prevajat Gnuradio...
cd ~/RaspberryPi/
wget http://gnuradio.org/releases/gnuradio/g ... 7.9.tar.gz
tar xvzf gnuradio-3.7.9.tar.gz
cd gnuradio-3.7.9/
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/home/matej/RaspberryPi/CMakeToolChain/Toolchain-RaspberryPi.cmake ..

Evo, zdaj pa dobim tole napako:
-- Could NOT find Boost
CMake Error at volk/CMakeLists.txt:98 (message):
VOLK Requires boost to build
-- Configuring incomplete, errors occurred!
See also "/home/matej/RaspberryPi/gnuradio-3.7.9/build/CMakeFiles/CMakeOutput.log".

Stvar pa je v tem, da imam nameščen libboost-all-dev...

Kakšna ideja kaj je narobe?
sudo poweroff

hojnikb ::

mogoče bi mogu probat z kako starejšo verzijo boosta ?

Kaj pa kompajlanje direkt na rpi ?
#brezpodpisa

poweroff ::

Sem skušal direktno na RPi, ampak je problem... traja 24+ ur, uničuje SD kartico na polno... poleg tega so se tam pojavili neki drugi problemi (napačen VOLK...).
sudo poweroff

Randomness ::

Poglej, kam se ti je instaliral FindBoost.cmake file. Nato pa moraš cmakeu dopovedati, da gre iskat ta file na pravilno mesto.

hojnikb ::

poweroff je izjavil:

Sem skušal direktno na RPi, ampak je problem... traja 24+ ur, uničuje SD kartico na polno... poleg tega so se tam pojavili neki drugi problemi (napačen VOLK...).

uničuje sd kartico ???
#brezpodpisa

poweroff ::

A nima flash omejeno število writing ciklov?

Randomness:
/usr/share/cmake-3.0/Modules/FindBoost.cmake

Kako pa to cmakeu dopovem?
sudo poweroff

Zgodovina sprememb…

  • spremenilo: poweroff ()

hojnikb ::

Ima, ja. Ampak sd kartice so po večini tako počasne, da bi trajal precej časa da bi jo znucal.

Če maš recimo 32GB kartico z TLC flashom (običajno vse kartice z class 10 ali manj) boš mogu zapisat ene par 10TB podatkov, da bo začela kazat znake izrabe.
#brezpodpisa

Zgodovina sprememb…

  • spremenil: hojnikb ()

poweroff ::

Imam sicer 8 Gb. Ampak vseeno, crosscompilanje mi prihrani ogromno časa.

No, če smo pa že pri compilanju na RPiju, se pa zatakne tule:

mkdir gnuradio
cd gnuradio
wget http://gnuradio.org/releases/gnuradio/g...
tar xvzf gnuradio-3.7.9.tar.gz
cd gnuradio-3.7.9
mkdir build
cd build
cmake ..
make

Zdaj pa dobim tole:

make
[ 0%] Building ASM object volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s: Assembler messages:
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s:46: Error: selected processor does not support ARM mode `sbfx r11,r1,#2,#1'
volk/lib/CMakeFiles/volk_obj.dir/build.make:1479: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o' failed
make[2]: *** [volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o] Error 1
CMakeFiles/Makefile2:233: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/all' failed
make[1]: *** [volk/lib/CMakeFiles/volk_obj.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
sudo poweroff

pegasus ::

poweroff je izjavil:

Error: selected processor does not support ARM mode `sbfx r11,r1,#2,#1'
Sicer nisem preveč intimen z neon asm, a ta error mi da mislit da ali cmake napačno izbere arm tip in hoče gcc potem bit preveč pameten, ali pa je sam asm v fajlu napisan z ukazi, ki jih tvoj cpu res ne podpira in boš moral mal rewritat. Najdi kdo je spisal ta asm in ga pocukaj za rokav, bo najhitrejše.

poweroff ::

OK, sumim, da bi znal biti problem v tem, da je zadeva spisana za ARM7 (ki ga uporablja RPi 2), paj za imam compiler, ki uporablja ARM6 ukaze.

Ampak ja, Gnuradio developerji bodo verjetno pravi naslov...
sudo poweroff

Randomness ::

Prilepi še izpis, ki ga dobiš z
make VERBOSE=1

poweroff ::

make VERBOSE=1

/usr/bin/cmake -H/home/pi/gnuradio/gnuradio-3.7.9 -B/home/pi/gnuradio/gnuradio-3.7.9/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/pi/gnuradio/gnuradio-3.7.9/build/CMakeFiles /home/pi/gnuradio/gnuradio-3.7.9/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
make -f volk/lib/CMakeFiles/volk_obj.dir/build.make volk/lib/CMakeFiles/volk_obj.dir/depend
make[2]: Entering directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
cd /home/pi/gnuradio/gnuradio-3.7.9/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/pi/gnuradio/gnuradio-3.7.9 /home/pi/gnuradio/gnuradio-3.7.9/volk/lib /home/pi/gnuradio/gnuradio-3.7.9/build /home/pi/gnuradio/gnuradio-3.7.9/build/volk/lib /home/pi/gnuradio/gnuradio-3.7.9/build/volk/lib/CMakeFiles/volk_obj.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
make -f volk/lib/CMakeFiles/volk_obj.dir/build.make volk/lib/CMakeFiles/volk_obj.dir/build
make[2]: Entering directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
/usr/bin/cmake -E cmake_progress_report /home/pi/gnuradio/gnuradio-3.7.9/build/CMakeFiles
[ 0%] Building ASM object volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o
cd /home/pi/gnuradio/gnuradio-3.7.9/build/volk/lib && /usr/bin/cc -DGR_PERFORMANCE_COUNTERS -DHAVE_DLFCN_H -DHAVE_FENV_H -DHAVE_POSIX_MEMALIGN -mfpu=neon -g -O3 -DNDEBUG -I/home/pi/gnuradio/gnuradio-3.7.9/build/volk/include -I/home/pi/gnuradio/gnuradio-3.7.9/volk/include -I/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels -I/home/pi/gnuradio/gnuradio-3.7.9/build/volk/lib -I/home/pi/gnuradio/gnuradio-3.7.9/volk/lib -I/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon -I/usr/include -fPIC -o CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o -c /home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s: Assembler messages:
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s:46: Error: selected processor does not support ARM mode `sbfx r11,r1,#2,#1'
volk/lib/CMakeFiles/volk_obj.dir/build.make:1479: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o' failed
make[2]: *** [volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o] Error 1
make[2]: Leaving directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
CMakeFiles/Makefile2:233: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/all' failed
make[1]: *** [volk/lib/CMakeFiles/volk_obj.dir/all] Error 2
make[1]: Leaving directory '/home/pi/gnuradio/gnuradio-3.7.9/build'
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
sudo poweroff

Randomness ::

Prevajaš s "sistemskim" gcc-jem: /usr/bin/cc

Pred prevajanjem gnuradia moraš pognati cmake tako:
cmake -DCMAKE_TOOLCHAIN_FILE=/home/matej/RaspberryPi/CMakeToolChain/Toolchain-RaspberryPi.cmake ..

(Vidim sicer, da si to že poskusil.) S tem cmake-u nastaviš ta pravi C in C++ compiler. Še vedno pa boš moral cmake-u povedati tudi, kje naj išče boost knjižnice. Možno je, da boš moral svoj Toolchain-RaspberyPi.cmake file dopolniti še s kako cmake spremenljivko, npr. CMAKE_SYS_ROOT in CMAKE_STAGING_PREFIX. Poglej si mogoče še https://cmake.org/cmake/help/v3.0/manua....

Randomness ::

Se opravičujem, sem šele sedaj videl, da si nazadnje prevajal direktno na RPiju. Mogoče poskusi nastaviti gcc-ju ustrezne flage. Nekaj v smislu

cmake .. -DCMAKE_C_FLAGS="-O2 -mcpu=cortex-a7 -mfpu=neon-vfpv4" -DCMAKE_CXX_FLAGS="-mcpu=cortex-a7 -mfpu=neon-vfpv4"

Možno je sicer, da gcc, ki ga uporabljaš, res ne podpira te ARM arhitekture in boš moral stvar vseeno prevesti s crosscompilerjem.

Zgodovina sprememb…

poweroff ::

Hmm, zdaj javi tole:

[ 1%] Building ASM object volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s: Assembler messages:
/home/pi/gnuradio/gnuradio-3.7.9/volk/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s:46: Error: selected processor does not support ARM mode `sbfx r11,r1,#2,#1'
volk/lib/CMakeFiles/volk_obj.dir/build.make:1479: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o' failed
make[2]: *** [volk/lib/CMakeFiles/volk_obj.dir/__/kernels/volk/asm/neon/volk_32f_x2_dot_prod_32f_neonasm_opts.s.o] Error 1
CMakeFiles/Makefile2:233: recipe for target 'volk/lib/CMakeFiles/volk_obj.dir/all' failed
make[1]: *** [volk/lib/CMakeFiles/volk_obj.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
sudo poweroff


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

msys2, mingw64 compiling

Oddelek: Programiranje
5834 (683) detroit
»

[Code:Blocks, c++] Program ne najde knjižnice

Oddelek: Programiranje
111360 (1139) gtu
»

Pomoč EEG

Oddelek: Pomoč in nasveti
51129 (1019) ducttape
»

siol iptv na vlc

Oddelek: Omrežja in internet
234021 (2861) šernk
»

OpenCV začetek

Oddelek: Programiranje
151250 (888) Icematxyz

Več podobnih tem