-
Notifications
You must be signed in to change notification settings - Fork 322
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
Tools: Testbench: Avoid need linux kernel headers in build #7244
Tools: Testbench: Avoid need linux kernel headers in build #7244
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this was successfully tested as part of larger
tools/fuzzer/CMakeLists.txt
Outdated
@@ -40,6 +40,7 @@ target_include_directories(sof-fuzzer PRIVATE | |||
"${SOF_ROOT_SOURCE_DIRECTORY}/src/arch/host/include" | |||
"${SOF_ROOT_SOURCE_DIRECTORY}/src/platform/library/include" | |||
"${SOF_ROOT_SOURCE_DIRECTORY}" | |||
"/usr/include/alsa/sound/uapi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a CMake macro (with this as the default) as the ALSA lib prefix can be different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change avoids build fail with xcc toolchain that can't use the gcc toolchain headers from the system where the ALSA headers are located.
On second thought this is way too much of a hack.
Instead ask CMake to copy /usr/include/alsa/sound/uapi/asoc.h
into something like build_dir/alsa/sound/uapi/asoc.h
Something like this UNTESTED:
# configuration time
configure_file ( /usr/include/alsa/sound/uapi/asoc.h ${CMAKE_CURRENT_BINARY_DIR}/alsa/sound/uapi/asoc.h
# build time
target_include_directories(sometarget ${CMAKE_CURRENT_BINARY_DIR})
https://www.google.com/search?q=cmake+generated+header
PS: I ran pkg-config --cflags-only-I alsa
and made sure it's empty on Ubuntu, Fedora and Arch Linux. In other words the location is standard.
Thanks for checking @marc-hb - @singalsu I would make sure the comment about running |
88b596f
to
9fb2197
Compare
@lgirdwood @marc-hb I tried to add pkg-config to build. Is this how you wanted it to be? |
No this is very far from what I suggested, sorry for the confusion. - I mentioned - There are 3 different |
This is actually the example given in https://cmake.org/cmake/help/latest/command/configure_file.html ! Two differences:
|
I tried to manually set the path that pkg-config to /foo and checked that the build tried to find headers from /foo/alsa/sound/uapi
I could test it only by setting other_alsa_include_path to /foo and check that code build failed with -I/foo/alsa/sound/uapi seen in the command line. But not a real test, agree.
OK, I'll learn about that
Yep, will try :) |
I just realized you may need the Unless we switch to I'm not sure. However I'm sure that we would have EVEN MORE problems like this if we switch to |
9fb2197
to
a14774e
Compare
I tried to replace PRIVATE with SYSTEM. The cmake errors with that. Changing to SYSTEM PRIVATE works. But I have no idea what I'm doing. Is this better? |
a14774e
to
f204d33
Compare
This patch adds simplified linux/types.h into testbench headers to enable include of ALSA asoc.h to build without other difficult kernel headers content. The CMakeLists.txt files are updated to make a build time copy of asoc.h to subdirectory include of the build directories. The new directory is added to headers path. This change avoids build fail with xcc toolchain that can't use the gcc toolchain headers from the system where the ALSA headers are located. Suggested-by: Marc Herbert <[email protected]> Signed-off-by: Seppo Ingalsuo <[email protected]>
f204d33
to
ef99cc8
Compare
Only suspend/resume and PM failures in MTL https://sof-ci.01.org/sofpr/PR7244/build4801/devicetest Everything else green including all cavs2.5 https://sof-ci.01.org/sofpr/PR7244/build4802/devicetest |
This patch adds a simplified linux/types.h into testbench headers to enable include of ALSA asoc.h to build without other difficult kernel headers content.
The include path for asoc.h is changed in fuzzer, tplg_parser, and testbench to be without prefix alsa/sound/uapi to allow the Makefile headers path to specify only the uapi directory.
This change avoids build fail with xcc toolchain that can't use the gcc toolchain headers from the system where the ALSA headers are located.