Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zephyr/CMakeLists.txt: remove '..' in include paths #7428

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Apr 10, 2023

zephyr/CMakeLists.txt: remove '..' in include paths

CMake seems to behave differently on Linux and Windows: it generates
different -I command line parameters. This results in spurious
__FILE__ mismatches and non-reproducible builds when using
CONFIG_ASSERT, see example in #7428.

On Windows, '..' seem resolved more often which also seems to convert
forward slashes to backslashes.

They are also less readable and wasting a bit of space. Remove them
using cmake_path(SET ...)


Zephyr's -fmacro-prefix-map is working and keeps the builds reproducible when using a recent enough toolchain.

As found in the CONFIG_ASSERT PR #6530 (comment) this is not true for old Xtensa toolchains which don't support -fmacro-prefix-map

@marc-hb
Copy link
Collaborator Author

marc-hb commented Apr 11, 2023

Some zephyr.lst differences in https://github.com/thesofproject/sof/actions/runs/4662244951/jobs/8252512487?pr=7428, interesting...

@marc-hb
Copy link
Collaborator Author

marc-hb commented Apr 11, 2023

The ASSERTs built on Windows have a mix of forward and backward slashes. There are 63 WEST_TOPDIR paths with forward slashes and 6 with backward slashes:

strings build-sof-staging/sof-info/mtl/stripped-zephyr.elf | grep TOPDIR

...
WEST_TOPDIR/sof/src/library_manager/lib_notification.c
WEST_TOPDIR/sof/src/samples/audio/detect_test.c
WEST_TOPDIR/sof/src/schedule/zephyr_ll.c
WEST_TOPDIR/sof/zephyr/include/rtos/task.h
WEST_TOPDIR/sof/zephyr/lib/cpu.c
WEST_TOPDIR/sof/zephyr/wrapper.c
WEST_TOPDIR/zephyr/arch/common/sw_isr_common.c
WEST_TOPDIR/zephyr/arch/xtensa/core/xtensa-asm2.c
WEST_TOPDIR/zephyr/arch/xtensa/include/kernel_arch_func.h
WEST_TOPDIR/zephyr/drivers/dai/intel/dmic/dmic.c

...
WEST_TOPDIR/zephyr/subsys/logging/log_output.c
WEST_TOPDIR/zephyr/subsys/pm/device_runtime.c
WEST_TOPDIR/zephyr/subsys/pm/pm.c
WEST_TOPDIR/zephyr/subsys/pm/policy.c
WEST_TOPDIR\sof\src\include\sof\audio\audio_stream.h
WEST_TOPDIR\sof\src\include\sof\audio\component_ext.h
WEST_TOPDIR\sof\src\include\sof\coherent.h
WEST_TOPDIR\sof\src\include\sof\schedule\ll_schedule_domain.h
WEST_TOPDIR\sof\src\platform\intel\ace\include\ace\lib\mailbox.h
WEST_TOPDIR\sof\xtos\include\sof\lib\mailbox.h

@stephanosio any idea?

EDIT, found something: all the paths with backward slashes have at least one .. on Linux:

WEST_TOPDIR/sof/src/lib/notifier.c
WEST_TOPDIR/sof/src/library_manager/lib_notification.c
WEST_TOPDIR/sof/src/samples/audio/detect_test.c
WEST_TOPDIR/sof/src/schedule/zephyr_ll.c
WEST_TOPDIR/sof/zephyr/../src/../xtos/include/sof/lib/mailbox.h
WEST_TOPDIR/sof/zephyr/../src/include/sof/audio/audio_stream.h
WEST_TOPDIR/sof/zephyr/../src/include/sof/audio/component_ext.h
WEST_TOPDIR/sof/zephyr/../src/include/sof/coherent.h
WEST_TOPDIR/sof/zephyr/../src/include/sof/schedule/ll_schedule_domain.h
WEST_TOPDIR/sof/zephyr/../src/platform/intel/ace/include/ace/lib/mailbox.h
WEST_TOPDIR/sof/zephyr/include/rtos/task.h
WEST_TOPDIR/sof/zephyr/lib/cpu.c
WEST_TOPDIR/sof/zephyr/wrapper.c

EDIT: difference fixed by removing .. in sof/zephyr/CMakeLists.txt.

CMake seems to behave differently on Linux and Windows: it generates
different `-I` command line parameters. This results in spurious
`__FILE__` mismatches and non-reproducible builds when using
CONFIG_ASSERT, see example in thesofproject#7428.

On Windows, '..' seem resolved more often which also seems to convert
forward slashes to backslashes.

They are also less readable and wasting a bit of space. Remove them
using cmake_path(SET ...)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb marked this pull request as ready for review April 11, 2023 07:29
@marc-hb marc-hb changed the title [SKIP CI] .github/zephyr: build with the debug overlay and CONFIG_ASSERT .github/zephyr: build with the debug overlay and CONFIG_ASSERT Apr 11, 2023
@marc-hb marc-hb changed the title .github/zephyr: build with the debug overlay and CONFIG_ASSERT zephyr/CMakeLists.txt: remove '..' in include paths Apr 11, 2023
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One question , see inline comment

@@ -131,7 +131,7 @@ jobs:
- name: build
run: cd workspace && ./sof/zephyr/docker-run.sh
./sof/zephyr/docker-build.sh --cmake-args=-DEXTRA_CFLAGS=-Werror
--cmake-args=--warn-uninitialized ${{ matrix.IPC_platforms }}
--cmake-args=--warn-uninitialized -d ${{ matrix.IPC_platforms }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marc-hb Should we have both -d and non -d builds? If we can only have one, I'd say the non-debug build is more important to verify.

Copy link
Collaborator Author

@marc-hb marc-hb Apr 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be easy to build both -d and not but I'm concerned about the combinatorial explosion and making the small "checks" box at the bottom of the "Conversation" tab more unreadable than it already is. Or we could connsider that box a lost cause and get people into the habit of alway switching to the "Checks" tab? I could also save some space but grouping all IPC3 (imx and tgl) together.

Note quickbuild already builds without -d every time, however its log is often hard to find. This being said, I don't remember a case when -d was OK while the build failed without or vice-versa, so convenient access to logs of a problem that almost never happens is not critical.

Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @kv2019i on this one. As you said Marc, building whole array with -d flag would result in so many builds...
I think we should stick with just a "production" build.

EDIT:
And now I think about all those ASSERT macros that would not be verified by the "production" build.
@marc-hb I think we should run both. I know it's a lot of builds but well, its common practice for projects to build production and debug builds. Besides, I think debug_overlay may grow in future, we need to verify this too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github Actions allow "sparse" matrices. So I found a way to add -d only for MTL, submitted in

Make sure users do not misinterpret our single `debug_overlay.conf` file
as some kind of complex and elaborate "debug build" concept. Also save
users who want to see the file a lot of time by naming it directly in
the --help.

Empty layers of indirection are just spurious obfuscation.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Apr 14, 2023

@kv2019i , @aborisovich I removed the github checks changes for now, let's discuss them later in another PR. It's more urgent to fix CONFIG_ASSERT reproducibility than to test it. So this PR should be a no-brainer now.

EDIT, see also:

let's discuss them later in another PR.
EDIT:

@kv2019i kv2019i merged commit c3c7b33 into thesofproject:main Apr 24, 2023
31 of 35 checks passed
kv2019i pushed a commit that referenced this pull request Apr 24, 2023
CMake seems to behave differently on Linux and Windows: it generates
different `-I` command line parameters. This results in spurious
`__FILE__` mismatches and non-reproducible builds when using
CONFIG_ASSERT, see example in #7428.

On Windows, '..' seem resolved more often which also seems to convert
forward slashes to backslashes.

They are also less readable and wasting a bit of space. Remove them
using cmake_path(SET ...)

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb marc-hb deleted the gha-assert branch April 24, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants