zephyr: twister failing locally - fails to link native_posix w/lld
Describe the bug
While following the contribution guide to create a PR for this comment, I realized that twister is failing on my local dev setup.
To Reproduce
Steps to reproduce the behavior:
These steps are subtly incorrect, see below comments for details. Please do not use them as-is.
git clone https://github.com/zephyrproject-rtos/zephyr.gitcd zephyrwest initwest update./scripts/twister(as an aside, is there a way to get twister to exit after the first failing test? I can’t seem to find an option for it.)- See errors on (seemingly) all posix tests, as well as a few other scattered failures.
Expected behavior
Testing that is documented as “please run […] locally before submitting your pull request to GitHub.” passes on trunk.
Impact
I have to guess as to if my PR changes actually break code or not, which may cause CI failures.
As per the documentation, “We highly recommend you run these tests locally to avoid any CI failures.”
Logs and console output
Including boilerplate (Zephyr base): /home/jharri/r/zephyr/cmake/app/boilerplate.cmake
-- Application: /home/jharri/r/zephyr/samples/philosophers
-- Zephyr version: 2.5.0-rc3 (/home/jharri/r/zephyr)
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.0") found components: Interpreter
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: native_posix
-- Cache files will be written to: /home/jharri/.cache/zephyr
CMake Warning at /home/jharri/r/zephyr/cmake/host-tools.cmake:31 (message):
Could NOT find dtc: Found unsuitable version "1.4.5", but required is at
least "1.4.6" (found /usr/bin/dtc). Optional devicetree error checking
with dtc will not be performed.
Call Stack (most recent call first):
/home/jharri/r/zephyr/cmake/app/boilerplate.cmake:516 (include)
/home/jharri/r/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
/home/jharri/r/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
CMakeLists.txt:4 (find_package)
-- Found toolchain: host (gcc/ld)
-- Found BOARD.dts: /home/jharri/r/zephyr/boards/posix/native_posix/native_posix.dts
-- Generated zephyr.dts: /home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher/zephyr/include/generated/device_extern.h
warning: The choice symbol LOG_MODE_IMMEDIATE (defined at subsys/logging/Kconfig.mode:15) was
selected (set =y), but no symbol ended up as the choice selection. See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_LOG_MODE_IMMEDIATE.html and/or look up
LOG_MODE_IMMEDIATE in the menuconfig/guiconfig interface. The Application Development Primer,
Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
helpful too.
Parsing /home/jharri/r/zephyr/Kconfig
Loaded configuration '/home/jharri/r/zephyr/boards/posix/native_posix/native_posix_defconfig'
Merged configuration '/home/jharri/r/zephyr/samples/philosophers/prj.conf'
Configuration saved to '/home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher/zephyr/.config'
Kconfig header saved to '/home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/gcc
CMake Deprecation Warning at ../../modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning at ../../CMakeLists.txt:1345 (message):
__ASSERT() statements are globally ENABLED
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jharri/r/zephyr/twister-out/native_posix/samples/philosophers/sample.kernel.philosopher
Scanning dependencies of target parse_syscalls_target
[ 1%] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[ 3%] Built target parse_syscalls_target
Scanning dependencies of target kobj_types_h_target
[ 4%] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h
[ 4%] Built target kobj_types_h_target
Scanning dependencies of target syscall_list_h_target
[ 5%] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[ 5%] Built target syscall_list_h_target
Scanning dependencies of target driver_validation_h_target
[ 6%] Generating include/generated/driver-validation.h
[ 6%] Built target driver_validation_h_target
Scanning dependencies of target offsets
[ 8%] Building C object zephyr/CMakeFiles/offsets.dir/arch/posix/core/offsets/offsets.c.obj
[ 8%] Built target offsets
Scanning dependencies of target offsets_h
[ 9%] Generating include/generated/offsets.h
[ 9%] Built target offsets_h
Scanning dependencies of target zephyr_generated_headers
[ 9%] Built target zephyr_generated_headers
Scanning dependencies of target app
[ 10%] Building C object CMakeFiles/app.dir/src/main.c.obj
[ 11%] Linking C static library app/libapp.a
[ 11%] Built target app
Scanning dependencies of target kernel
[ 12%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/device.c.obj
[ 13%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/errno.c.obj
[ 15%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/fatal.c.obj
[ 16%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/idle.c.obj
[ 17%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
[ 18%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
[ 19%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mailbox.c.obj
[ 20%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mem_slab.c.obj
[ 22%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/msg_q.c.obj
[ 23%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mutex.c.obj
[ 24%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/pipes.c.obj
[ 25%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/queue.c.obj
[ 26%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sched.c.obj
[ 27%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/sem.c.obj
[ 29%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/stack.c.obj
[ 30%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/system_work_q.c.obj
[ 31%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/thread.c.obj
[ 32%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/thread_abort.c.obj
[ 33%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/version.c.obj
[ 34%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/work_q.c.obj
[ 36%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/condvar.c.obj
[ 37%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/smp.c.obj
[ 38%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/banner.c.obj
[ 39%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timeout.c.obj
[ 40%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/timer.c.obj
[ 41%] Building C object zephyr/kernel/CMakeFiles/kernel.dir/mempool.c.obj
[ 43%] Linking C static library libkernel.a
[ 43%] Built target kernel
Scanning dependencies of target linker_script_target
[ 44%] Generating linker.cmd
[ 44%] Built target linker_script_target
Scanning dependencies of target zephyr
[ 45%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf.c.obj
[ 46%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32_sw.c.obj
[ 47%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc16_sw.c.obj
[ 48%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc8_sw.c.obj
[ 50%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc7_sw.c.obj
[ 51%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
[ 52%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
[ 53%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj
[ 54%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/notify.c.obj
[ 55%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
[ 56%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/onoff.c.obj
[ 58%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/rb.c.obj
[ 59%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/sem.c.obj
[ 60%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/thread_entry.c.obj
[ 61%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/timeutil.c.obj
[ 62%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/work_q.c.obj
[ 63%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap.c.obj
[ 65%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/heap-validate.c.obj
[ 66%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_complete.c.obj
[ 67%] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/assert.c.obj
[ 68%] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
[ 69%] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/console/native_posix_console.c.obj
[ 70%] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/timer/sys_clock_init.c.obj
[ 72%] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/timer/native_posix_timer.c.obj
[ 73%] Linking C static library libzephyr.a
[ 73%] Built target zephyr
Scanning dependencies of target arch__posix__core
[ 74%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/cpuhalt.c.obj
[ 75%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/fatal.c.obj
[ 76%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/irq.c.obj
[ 77%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/posix_core.c.obj
[ 79%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/swap.c.obj
[ 80%] Building C object zephyr/arch/arch/posix/core/CMakeFiles/arch__posix__core.dir/thread.c.obj
[ 81%] Linking C static library libarch__posix__core.a
[ 81%] Built target arch__posix__core
Scanning dependencies of target soc__posix__inf_clock
[ 82%] Building C object zephyr/soc/posix/inf_clock/CMakeFiles/soc__posix__inf_clock.dir/soc.c.obj
[ 83%] Linking C static library libsoc__posix__inf_clock.a
[ 83%] Built target soc__posix__inf_clock
Scanning dependencies of target boards__posix__native_posix
[ 84%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/hw_models_top.c.obj
[ 86%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/timer_model.c.obj
[ 87%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/native_rtc.c.obj
[ 88%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/irq_handler.c.obj
[ 89%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/irq_ctrl.c.obj
[ 90%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/main.c.obj
[ 91%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/tracing.c.obj
[ 93%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/cmdline_common.c.obj
[ 94%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/cmdline.c.obj
[ 95%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/cpu_wait.c.obj
[ 96%] Building C object zephyr/boards/posix/native_posix/CMakeFiles/boards__posix__native_posix.dir/hw_counter.c.obj
[ 97%] Linking C static library libboards__posix__native_posix.a
[ 97%] Built target boards__posix__native_posix
Scanning dependencies of target zephyr_prebuilt
[ 98%] Building C object zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj
[100%] Linking C executable zephyr.elf
ld: error: unable to INSERT AFTER/BEFORE .data: section not defined
collect2: error: ld returned 1 exit status
zephyr/CMakeFiles/zephyr_prebuilt.dir/build.make:111: recipe for target 'zephyr/zephyr.elf' failed
make[2]: *** [zephyr/zephyr.elf] Error 1
CMakeFiles/Makefile2:2211: recipe for target 'zephyr/CMakeFiles/zephyr_prebuilt.dir/all' failed
make[1]: *** [zephyr/CMakeFiles/zephyr_prebuilt.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
Similar failures appear on seemingly all posix tests. (And a few others, but this is the main commonality I noted.)
Also see the attached twister.zip (zipped because it’s a rather giant log file).
Overall:
INFO - 5016 of 5421 test configurations passed (92.53%), 405 failed, 9558 skipped with 0 warnings in 1920.87 seconds
INFO - In total 55296 test cases were executed, 124133 skipped on 323 out of total 329 platforms (98.18%)
INFO - 2920 test configurations executed on platforms, 2501 test configurations were only built.
Environment (please complete the following information):
- OS: Ubuntu 18.04.5 LTS
- Toolchain (e.g Zephyr SDK, …): how do I collect this information?
- Commit SHA or Version used:
jharri@jharri-compilebox-01 ~/r/zephyr (master) $ git log -n 1 --oneline
9f858ac1b6 (HEAD -> master, origin/master, origin/HEAD) tests: drivers: can: timing: Fix potential div by zero
Additional context
I see the DTS warning in the above; I don’t think it is related (The log message does say “Optional”, but famous last words?). Unfortunately, 1.4.5. is the latest version available in Ubuntu 18.04 LTS.
I’m probably just missing something obvious here. E.g. I’m using a different default ld version or something that the tests aren’t compatible with but don’t override.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (12 by maintainers)
Commits related to this issue
- ld.bfd: ensure that ld.bfd is preferred over ld. Fixes: #32237 When building for native_posix, then host tools are used. This means that gcc will link using `/usr/bin/ld` per default. If ld points ... — committed to tejlmand/zephyr by tejlmand 3 years ago
- ld.bfd: ensure that ld.bfd is preferred over ld. Fixes: #32237 When building for native_posix, then host tools are used. This means that gcc will link using `/usr/bin/ld` per default. If ld points ... — committed to zephyrproject-rtos/zephyr by tejlmand 3 years ago
Take a look at https://github.com/zephyrproject-rtos/zephyr/issues/14173
Yep, that’s exactly the case. I’ll retry with
west init -l .and let you know how it goes.