meson.build | 27 ++++++++++++++++----------- hw/arm/meson.build | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-)
From: Thomas Huth <thuth@redhat.com>
Since commit 6f4e8a92bbd ("hw/arm: make most of the compilation units
common"), compilation of some arm machines (like musicpal) fails on
certain host systems like OpenBSD 7.6/7.7 since headers like <epoxy/gl.h>
don't reside in /usr/include and we currently don't add the right
CFLAGS for the common files to include the additional header search
paths. Add a loop similar to what we already did in commit 727bb5b477e6
to fix it.
With this fix applied, we can now also drop the explicit dependency
on pixman for the arm musicpal machine.
Fixes: 6f4e8a92bbd ("hw/arm: make most of the compilation units common")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[thuth: Add commit message + changes in hw/arm/meson.build]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
v2: Change the subject of the patch according to Paolo's suggestion
meson.build | 27 ++++++++++++++++-----------
hw/arm/meson.build | 2 +-
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/meson.build b/meson.build
index 5ac64075be7..7131aa2b21d 100644
--- a/meson.build
+++ b/meson.build
@@ -3228,6 +3228,7 @@ config_devices_mak_list = []
config_devices_h = {}
config_target_h = {}
config_target_mak = {}
+config_base_arch_mak = {}
disassemblers = {
'alpha' : ['CONFIG_ALPHA_DIS'],
@@ -3419,6 +3420,11 @@ foreach target : target_dirs
config_all_devices += config_devices
endif
config_target_mak += {target: config_target}
+
+ # build a merged config for all targets with the same TARGET_BASE_ARCH
+ target_base_arch = config_target['TARGET_BASE_ARCH']
+ config_base_arch = config_base_arch_mak.get(target_base_arch, {}) + config_target
+ config_base_arch_mak += {target_base_arch: config_base_arch}
endforeach
target_dirs = actual_target_dirs
@@ -4099,28 +4105,27 @@ common_all = static_library('common',
# construct common libraries per base architecture
hw_common_arch_libs = {}
-foreach target : target_dirs
- config_target = config_target_mak[target]
- target_base_arch = config_target['TARGET_BASE_ARCH']
+foreach target_base_arch, config_base_arch : config_base_arch_mak
+ if target_base_arch in hw_common_arch
+ base_arch_hw = hw_common_arch[target_base_arch].apply(config_base_arch, strict: false)
+ base_arch_common = common_ss.apply(config_base_arch, strict: false)
- # check if already generated
- if target_base_arch in hw_common_arch_libs
- continue
- endif
+ lib_deps = base_arch_hw.dependencies()
+ foreach dep : base_arch_common.dependencies()
+ lib_deps += dep.partial_dependency(compile_args: true, includes: true)
+ endforeach
- if target_base_arch in hw_common_arch
target_inc = [include_directories('target' / target_base_arch)]
- src = hw_common_arch[target_base_arch]
lib = static_library(
'hw_' + target_base_arch,
build_by_default: false,
- sources: src.all_sources() + genh,
+ sources: base_arch_hw.sources() + genh,
include_directories: common_user_inc + target_inc,
implicit_include_directories: false,
# prevent common code to access cpu compile time
# definition, but still allow access to cpu.h
c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
- dependencies: src.all_dependencies())
+ dependencies: lib_deps)
hw_common_arch_libs += {target_base_arch: lib}
endif
endforeach
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 5098795f61d..8e3bf495dbf 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -8,7 +8,7 @@ arm_common_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
arm_common_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
arm_common_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c'))
-arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [pixman, files('musicpal.c')])
+arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c'))
arm_common_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
arm_common_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
arm_common_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
--
2.49.0
Hi Thomas,
On 5/13/25 4:56 AM, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
>
> Since commit 6f4e8a92bbd ("hw/arm: make most of the compilation units
> common"), compilation of some arm machines (like musicpal) fails on
> certain host systems like OpenBSD 7.6/7.7 since headers like <epoxy/gl.h>
> don't reside in /usr/include and we currently don't add the right
> CFLAGS for the common files to include the additional header search
> paths. Add a loop similar to what we already did in commit 727bb5b477e6
> to fix it.
>
> With this fix applied, we can now also drop the explicit dependency
> on pixman for the arm musicpal machine.
>
> Fixes: 6f4e8a92bbd ("hw/arm: make most of the compilation units common")
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> [thuth: Add commit message + changes in hw/arm/meson.build]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Change the subject of the patch according to Paolo's suggestion
>
> meson.build | 27 ++++++++++++++++-----------
> hw/arm/meson.build | 2 +-
> 2 files changed, 17 insertions(+), 12 deletions(-)
Thanks for the patch.
I didn't run into any issue when building for {linux, macos, windows,
freebsd}, so I assumed it was safe to do things this way and specific
dependencies could just be listed with associated sources.
It seems like there are cracks in this approach, so adding all the
dependencies per base arch is a good idea.
Any chance you could base it on this commit [1] (and add it for new
libraries as well)?
This is going to be pulled very shortly (as part of a wider series), and
the same fix will be needed.
[1] 20250512180502.2395029-4-pierrick.bouvier@linaro.org
Thanks,
Pierrick
On 5/13/25 4:20 PM, Pierrick Bouvier wrote:
> Hi Thomas,
>
> On 5/13/25 4:56 AM, Thomas Huth wrote:
>> From: Thomas Huth <thuth@redhat.com>
>>
>> Since commit 6f4e8a92bbd ("hw/arm: make most of the compilation units
>> common"), compilation of some arm machines (like musicpal) fails on
>> certain host systems like OpenBSD 7.6/7.7 since headers like <epoxy/gl.h>
>> don't reside in /usr/include and we currently don't add the right
>> CFLAGS for the common files to include the additional header search
>> paths. Add a loop similar to what we already did in commit 727bb5b477e6
>> to fix it.
>>
>> With this fix applied, we can now also drop the explicit dependency
>> on pixman for the arm musicpal machine.
>>
>> Fixes: 6f4e8a92bbd ("hw/arm: make most of the compilation units common")
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> [thuth: Add commit message + changes in hw/arm/meson.build]
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> v2: Change the subject of the patch according to Paolo's suggestion
>>
>> meson.build | 27 ++++++++++++++++-----------
>> hw/arm/meson.build | 2 +-
>> 2 files changed, 17 insertions(+), 12 deletions(-)
>
>
> Thanks for the patch.
> I didn't run into any issue when building for {linux, macos, windows,
> freebsd}, so I assumed it was safe to do things this way and specific
> dependencies could just be listed with associated sources.
> It seems like there are cracks in this approach, so adding all the
> dependencies per base arch is a good idea.
>
> Any chance you could base it on this commit [1] (and add it for new
> libraries as well)?
>
> This is going to be pulled very shortly (as part of a wider series), and
> the same fix will be needed.
> [1] 20250512180502.2395029-4-pierrick.bouvier@linaro.org
>
[1] was merged.
I'm working on a series integrating your work, and doing further
cleanups on meson side, so you can leave it for now.
Thanks,
Pierrick
On 5/15/25 5:35 PM, Pierrick Bouvier wrote:
> On 5/13/25 4:20 PM, Pierrick Bouvier wrote:
>> Hi Thomas,
>>
>> On 5/13/25 4:56 AM, Thomas Huth wrote:
>>> From: Thomas Huth <thuth@redhat.com>
>>>
>>> Since commit 6f4e8a92bbd ("hw/arm: make most of the compilation units
>>> common"), compilation of some arm machines (like musicpal) fails on
>>> certain host systems like OpenBSD 7.6/7.7 since headers like <epoxy/gl.h>
>>> don't reside in /usr/include and we currently don't add the right
>>> CFLAGS for the common files to include the additional header search
>>> paths. Add a loop similar to what we already did in commit 727bb5b477e6
>>> to fix it.
>>>
>>> With this fix applied, we can now also drop the explicit dependency
>>> on pixman for the arm musicpal machine.
>>>
>>> Fixes: 6f4e8a92bbd ("hw/arm: make most of the compilation units common")
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> [thuth: Add commit message + changes in hw/arm/meson.build]
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>> v2: Change the subject of the patch according to Paolo's suggestion
>>>
>>> meson.build | 27 ++++++++++++++++-----------
>>> hw/arm/meson.build | 2 +-
>>> 2 files changed, 17 insertions(+), 12 deletions(-)
>>
>>
>> Thanks for the patch.
>> I didn't run into any issue when building for {linux, macos, windows,
>> freebsd}, so I assumed it was safe to do things this way and specific
>> dependencies could just be listed with associated sources.
>> It seems like there are cracks in this approach, so adding all the
>> dependencies per base arch is a good idea.
>>
>> Any chance you could base it on this commit [1] (and add it for new
>> libraries as well)?
>>
>> This is going to be pulled very shortly (as part of a wider series), and
>> the same fix will be needed.
> > [1] 20250512180502.2395029-4-pierrick.bouvier@linaro.org
>>
>
> [1] was merged.
> I'm working on a series integrating your work, and doing further
> cleanups on meson side, so you can leave it for now.
>
Posted here:
https://lore.kernel.org/qemu-devel/20250516052708.930928-1-pierrick.bouvier@linaro.org
Regards,
Pierrick
© 2016 - 2025 Red Hat, Inc.