[Sound-open-firmware] help with unit tests
Hello, this is the first post from a newb user so first of all kudos to everyone for this amazing project.
I have followed the build from scratch instructions and built successfully the apl firmware (from branch master), but am having trouble building the unit tests:
:~/lara/sof/sof/build_ut$ cmake -DTOOLCHAIN=xtensa-apl-elf -DROOT_DIR=`pwd`/../../xtensa-root/xtensa-apl-elf -DBUILD_UNIT_TESTS=ON .. -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut
:~/lara/sof/sof/build_ut$ make apollolake_defconfig [100%] Applying olddefconfig with apollolake_defconfig Using existing configuration '.config' as base Configuration written to '.config' [100%] Built target apollolake_defconfig
:~/lara/sof/sof/build_ut$ make -j4 -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut [ 0%] Built target ld_script_memory_mock [ 0%] Performing update step for 'cmocka_git' [ 0%] Generating /home/antonis/lara/sof/sof/build_ut/generated/include/config.h [ 0%] Built target genconfig Scanning dependencies of target audio_for_volume [ 0%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume_generic.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume_hifi3.c.o [ 3%] Linking C static library libaudio_for_volume.a [ 3%] Built target audio_for_volume Current branch master is up to date. [ 4%] Performing configure step for 'cmocka_git' -- The C compiler identification is GNU 8.1.0 -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- broken CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"/home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_809b9/fast" make[3]: Entering directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' /usr/bin/make -f CMakeFiles/cmTC_809b9.dir/build.make CMakeFiles/cmTC_809b9.dir/build make[4]: Entering directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -o CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -c /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_809b9 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_809b9.dir/link.txt --verbose=1 /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -o cmTC_809b9
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find _vectors.o: No such file or directory
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lsim
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhandlers-sim
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhal collect2: error: ld returned 1 exit status CMakeFiles/cmTC_809b9.dir/build.make:97: recipe for target 'cmTC_809b9' failed make[4]: *** [cmTC_809b9] Error 1 make[4]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_809b9/fast' failed make[3]: *** [cmTC_809b9/fast] Error 2 make[3]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:18 (project)
-- Configuring incomplete, errors occurred! See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeOutput.log". See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeError.log". test/cmocka/CMakeFiles/cmocka_git.dir/build.make:105: recipe for target 'cmocka_git/src/cmocka_git-stamp/cmocka_git-configure' failed make[2]: *** [cmocka_git/src/cmocka_git-stamp/cmocka_git-configure] Error 1 CMakeFiles/Makefile2:572: recipe for target 'test/cmocka/CMakeFiles/cmocka_git.dir/all' failed make[1]: *** [test/cmocka/CMakeFiles/cmocka_git.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2
It seems something that should be obvious is missing from my setup, even though i am able to build SOF binaries? Can you please advise?
my environment is
Ubuntu 18.04.1 LTS cmake version 3.10.2
regards and thanks
antonis
On Fri, 2019-02-08 at 20:36 +0200, kalamara@ceid.upatras.gr wrote:
Hello, this is the first post from a newb user so first of all kudos to everyone for this amazing project.
I have followed the build from scratch instructions and built successfully the apl firmware (from branch master), but am having trouble building the unit tests:
I think Janusz is is improving the UT cmocka infrastructure atm so there may be an issue with the updates. Janusz, any idea ?
More comments inline.
:~/lara/sof/sof/build_ut$ cmake -DTOOLCHAIN=xtensa-apl-elf -DROOT_DIR=`pwd`/../../xtensa-root/xtensa-apl-elf -DBUILD_UNIT_TESTS=ON .. -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut
:~/lara/sof/sof/build_ut$ make apollolake_defconfig [100%] Applying olddefconfig with apollolake_defconfig Using existing configuration '.config' as base Configuration written to '.config' [100%] Built target apollolake_defconfig
:~/lara/sof/sof/build_ut$ make -j4 -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut [ 0%] Built target ld_script_memory_mock [ 0%] Performing update step for 'cmocka_git' [ 0%] Generating /home/antonis/lara/sof/sof/build_ut/generated/include/config.h [ 0%] Built target genconfig Scanning dependencies of target audio_for_volume [ 0%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr c/audio/volume_generic.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr c/audio/volume.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr c/audio/volume_hifi3.c.o [ 3%] Linking C static library libaudio_for_volume.a [ 3%] Built target audio_for_volume Current branch master is up to date. [ 4%] Performing configure step for 'cmocka_git' -- The C compiler identification is GNU 8.1.0 -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- broken CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"/home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir:
/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_809b9/fast" make[3]: Entering directory
'/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' /usr/bin/make -f CMakeFiles/cmTC_809b9.dir/build.make CMakeFiles/cmTC_809b9.dir/build make[4]: Entering directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -o CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -c /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp/testC Compiler.c Linking C executable cmTC_809b9 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_809b9.dir/link.txt --verbose=1 /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -o cmTC_809b9
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
So it looks like cmocka build is locking for FW object files but cant find them. I assume the FW has been built prior to making the unit tests ?
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find _vectors.o: No such file or directory
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lsim
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhandlers-sim
/home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl- elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhal collect2: error: ld returned 1 exit status CMakeFiles/cmTC_809b9.dir/build.make:97: recipe for target 'cmTC_809b9' failed make[4]: *** [cmTC_809b9] Error 1 make[4]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_809b9/fast' failed make[3]: *** [cmTC_809b9/fast] Error 2 make[3]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:18 (project)
-- Configuring incomplete, errors occurred! See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeOutput.l og". See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeError.lo g". test/cmocka/CMakeFiles/cmocka_git.dir/build.make:105: recipe for target 'cmocka_git/src/cmocka_git-stamp/cmocka_git-configure' failed make[2]: *** [cmocka_git/src/cmocka_git-stamp/cmocka_git-configure] Error 1 CMakeFiles/Makefile2:572: recipe for target 'test/cmocka/CMakeFiles/cmocka_git.dir/all' failed make[1]: *** [test/cmocka/CMakeFiles/cmocka_git.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2
It seems something that should be obvious is missing from my setup, even though i am able to build SOF binaries? Can you please advise?
my environment is
Ubuntu 18.04.1 LTS cmake version 3.10.2
These versions should both be good.
Liam
regards and thanks
antonis
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
Hello,
TL;DR: Unit Tests are not supported for xtensa GCC toolchains at the moment (work in progress). You can run them only with xtensa xt-* toolchain that provides simulator (xt-run).
WHY ->
You need 2 things to run unit tests:
1) stdlib - Cmocka needs to write to standard output etc
Errors like these show that you have no standard C Runtime libe (crt):
ld: cannot find crt1-sim.o: No such file or directory ld: cannot find crt0.o: No such file or directory
so this is issue of gcc toolchain itself, I guess our maintainers can add stdlib to toolchains (newlib?).
2) Since these tests are for xtensa you cannot just run them on host, they need to be run in some kind of simulator/emulator - for xt we have xt-run, for GCC toolchains we plan to use qemu, however our qemu support is now limited only to testing if firmware boots properly, so there is some work required in qemu also.
If you have more questions feel free to write, I'll try to answer all of them.
Best regards,
Janusz
On 08.02.2019 19:36, kalamara@ceid.upatras.gr wrote:
Hello, this is the first post from a newb user so first of all kudos to everyone for this amazing project.
I have followed the build from scratch instructions and built successfully the apl firmware (from branch master), but am having trouble building the unit tests:
:~/lara/sof/sof/build_ut$ cmake -DTOOLCHAIN=xtensa-apl-elf -DROOT_DIR=`pwd`/../../xtensa-root/xtensa-apl-elf -DBUILD_UNIT_TESTS=ON .. -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut
:~/lara/sof/sof/build_ut$ make apollolake_defconfig [100%] Applying olddefconfig with apollolake_defconfig Using existing configuration '.config' as base Configuration written to '.config' [100%] Built target apollolake_defconfig
:~/lara/sof/sof/build_ut$ make -j4 -- Preparing Xtensa toolchain -- Configuring done -- Generating done -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut [ 0%] Built target ld_script_memory_mock [ 0%] Performing update step for 'cmocka_git' [ 0%] Generating /home/antonis/lara/sof/sof/build_ut/generated/include/config.h [ 0%] Built target genconfig Scanning dependencies of target audio_for_volume [ 0%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume_generic.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume.c.o [ 2%] Building C object test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/src/audio/volume_hifi3.c.o [ 3%] Linking C static library libaudio_for_volume.a [ 3%] Built target audio_for_volume Current branch master is up to date. [ 4%] Performing configure step for 'cmocka_git' -- The C compiler identification is GNU 8.1.0 -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- Check for working C compiler: /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- broken CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler
"/home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_809b9/fast" make[3]: Entering directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' /usr/bin/make -f CMakeFiles/cmTC_809b9.dir/build.make CMakeFiles/cmTC_809b9.dir/build make[4]: Entering directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -o CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -c /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTC_809b9 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_809b9.dir/link.txt --verbose=1 /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o -o cmTC_809b9 /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt1-sim.o: No such file or directory /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find crt0.o: No such file or directory /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find _vectors.o: No such file or directory /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lsim /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lc /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhandlers-sim /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: cannot find -lhal collect2: error: ld returned 1 exit status CMakeFiles/cmTC_809b9.dir/build.make:97: recipe for target 'cmTC_809b9' failed make[4]: *** [cmTC_809b9] Error 1 make[4]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_809b9/fast' failed make[3]: *** [cmTC_809b9/fast] Error 2 make[3]: Leaving directory '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:18 (project)
-- Configuring incomplete, errors occurred! See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeOutput.log". See also "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeError.log". test/cmocka/CMakeFiles/cmocka_git.dir/build.make:105: recipe for target 'cmocka_git/src/cmocka_git-stamp/cmocka_git-configure' failed make[2]: *** [cmocka_git/src/cmocka_git-stamp/cmocka_git-configure] Error 1 CMakeFiles/Makefile2:572: recipe for target 'test/cmocka/CMakeFiles/cmocka_git.dir/all' failed make[1]: *** [test/cmocka/CMakeFiles/cmocka_git.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2
It seems something that should be obvious is missing from my setup, even though i am able to build SOF binaries? Can you please advise?
my environment is
Ubuntu 18.04.1 LTS cmake version 3.10.2
regards and thanks
antonis
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
Kalispera and welcome.
On 2/8/19 12:36 PM, kalamara@ceid.upatras.gr wrote:
Hello, this is the first post from a newb user so first of all kudos to everyone for this amazing project.
I have followed the build from scratch instructions and built successfully the apl firmware (from branch master),
This is pretty good already for a start :-)
FWIW, there is an alternate way of getting everything in one shot with 'repo', there are build-scripts provided so that you can reproduce the same setup as other developers.
repo init -u https://github.com/thesofproject/sof-manifests
repo sync -c
then use the build scripts for firmware and Linux kernel as needed.
If I may ask, which platform are you targeting?
-Pierre
participants (4)
-
Jankowski, Janusz
-
kalamara@ceid.upatras.gr
-
Liam Girdwood
-
Pierre-Louis Bossart