Skip to contentSkip to conversation

tests/tcg/meson.build: detect additional cross compilers

PATCH In review Pierrick Bouvier 2 participants 18 messages Sep 24 – Sep 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover tests/tcg/meson.build: detect additional cross compilers

This series solves:
- detect and choose host compiler for host target on fedora
- detect and choose cross compilers install with homebrew on macos

It adds a new cc_alt list field to test suite, to specify one or several cross compilers to try. If none is found, or none works, we fallback to containers as usual.

Tested on debian, macos, fedora, archlinux for x86 and aarch64 arch.

Based-on: [email protected] "[PATCH v2 0/6] tests/tcg: use x86_64 cross containers on all host architectures"

Pierrick Bouvier (4):
tests/tcg/meson.build: report correct cc in summary tests/tcg/meson.build: introduce cc_alt (alternative cross compiler) tests/tcg: add alternative cross-compilers for fedora tests/tcg: add alternative cross-compilers for macos (homebrew)

 .gitlab-ci.d/macos.yml               |  7 ----
 tests/tcg/aarch64/meson.build        |  2 ++
 tests/tcg/aarch64/system/meson.build |  1 +
 tests/tcg/aarch64_be/meson.build     |  1 +
 tests/tcg/arm/system/meson.build     |  1 +
 tests/tcg/i386/system/meson.build    |  1 +
 tests/tcg/meson.build                | 53 ++++++++++++++++------------
 tests/tcg/ppc64le/meson.build        |  1 +
 tests/tcg/riscv64/meson.build        |  2 ++
 tests/tcg/riscv64/system/meson.build |  1 +
 tests/tcg/s390x/meson.build          |  2 ++
 tests/tcg/s390x/system/meson.build   |  1 +
 tests/tcg/x86_64/meson.build         |  2 ++
 tests/tcg/x86_64/system/meson.build  |  1 +
 14 files changed, 47 insertions(+), 29 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 tests/tcg/meson.build: report correct cc in summary

Summary didn't consider that cc could have been set using --cross-cc* options, and was wrongly reporting default cc declared in test suite. Fix that by reporting path of compiler found.

---
 tests/tcg/meson.build | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/tcg/meson.build +4 -3
index 474e4d8f6e3..0006d192cab 100644
@@ -292,9 +292,10 @@ foreach target, plan: tcg_tests
 
   summary_cc = false
   if has_cc
-    summary_cc = plan['cc']
-    if not cc_from_system
-      summary_cc += ' (from \'qemu/' + plan['cc_dockerfile'] + '\' container)'
+    if cc_from_system
+      summary_cc = cc.full_path()
+    else
+      summary_cc = plan['cc'] + ' (from \'qemu/' + plan['cc_dockerfile'] + '\' container)'
     endif
   endif
   tcg_tests_summary += {'cc for ' + target: summary_cc}
Signature · 1 line
2.43.0
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] tests/tcg/meson.build: report correct cc in summary

Quoted 17 lines · Pierrick Bouvier

Summary didn't consider that cc could have been set using --cross-cc* options, and was wrongly reporting default cc declared in test suite. Fix that by reporting path of compiler found.

---
 tests/tcg/meson.build | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tests/tcg/meson.build +0 -0
index 474e4d8f6e3..0006d192cab 100644
@@ -292,9 +292,10 @@ foreach target, plan: tcg_tests
 
   summary_cc = false
   if has_cc

tests/tcg/meson.build foreach target, plan: tcg_tests · line 301

Quoted 10 lines
tests/tcg/meson.build +4 -3
-    summary_cc = plan['cc']
-    if not cc_from_system
-      summary_cc += ' (from \'qemu/' + plan['cc_dockerfile'] + '\' container)'
+    if cc_from_system
+      summary_cc = cc.full_path()
+    else
+      summary_cc = plan['cc'] + ' (from \'qemu/' + plan['cc_dockerfile'] + '\' container)'
     endif
   endif
   tcg_tests_summary += {'cc for ' + target: summary_cc}

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#3 lore raw

PATCH 2/4 tests/tcg/meson.build: introduce cc_alt (alternative cross compiler)

In reply to Pierrick Bouvier

This allows each target to provide an additional list of cross compilers to check. With this, we can detect default cc for common setups (debian/fedora/macos) without user having to provide a --cross-cc-* option.

In addition, it allows us to pick up host compilers for various hosts. (debian and archlinux have $arch-linux-gnu-gcc installed with gcc package by default, but not fedora).

---
 tests/tcg/meson.build | 46 +++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)
tests/tcg/meson.build +27 -19
index 0006d192cab..59ab73e1d10 100644
@@ -21,6 +21,7 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': 'cross_compiler',
+#     'cc_alt': ['list of alternative cross compilers', ...]
 #     'cc_dockerfile': 'name_of_dockerfile',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
@@ -210,7 +211,7 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags',
+    allowed = ['cc', 'cc_alt', 'cc_dockerfile', 'cc_feat_cflags',
                'folder', 'gdb_arch', 'gdb_feat_version', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
@@ -218,15 +219,18 @@ foreach target, plan: tcg_tests
     endif
   endforeach
 
-  cc = find_program(plan['cc'], required : false)
+  cc_list = [plan['cc']]
+  if 'cc_alt' in plan
+    cc_list += plan['cc_alt']
+  endif
+
   cc_cflags = []
-
   check_flags = []
   check_required = false
   cross_cc = get_option('tcg_tests_cross_cc_' + cc_arch)
   if cross_cc != ''
-    # we make sure cross cc exists
-    cc = find_program(cross_cc, required: true)
+    # prepend requested cross_cc
+    cc_list = [cross_cc, cc_list]
     check_required = true
   endif
   cross_cflags = get_option('tcg_tests_cross_cflags_' + cc_arch)
@@ -236,22 +240,26 @@ foreach target, plan: tcg_tests
     check_flags = cc_cflags
     check_required = true
   endif
-
-  cc_from_system = cc.found()
-  has_cc = cc.found()
-  if has_cc
-    if target.endswith('softmmu')
-      check_flags += ['-nostdlib', '-ffreestanding', '-r']
-    else
-      check_flags += ['-static']
-    endif
-
-    cmd = run_command([cc, files('test_cc.c'), check_flags, '-o', '/dev/null'],
-                      check: check_required)
-    has_cc = cmd.returncode() == 0
-    cc_from_system = has_cc
+  if target.endswith('softmmu')
+    check_flags += ['-nostdlib', '-ffreestanding', '-r']
+  else
+    check_flags += ['-static']
   endif
 
+  has_cc = false
+  foreach possible_cc: cc_list
+    cc = find_program(possible_cc, required: check_required)
+    if cc.found()
+      cmd = run_command([cc, files('test_cc.c'), check_flags, '-o', '/dev/null'],
+                        check: check_required)
+      if cmd.returncode() == 0
+        has_cc = true
+        break
+      endif
+    endif
+  endforeach
+
+  cc_from_system = has_cc
   build_test_depends = []
   build_test_depend_files = []
 
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH 2/4] tests/tcg/meson.build: introduce cc_alt (alternative cross compiler)

Quoted 36 lines · Pierrick Bouvier

This allows each target to provide an additional list of cross compilers to check. With this, we can detect default cc for common setups (debian/fedora/macos) without user having to provide a --cross-cc-* option.

In addition, it allows us to pick up host compilers for various hosts. (debian and archlinux have $arch-linux-gnu-gcc installed with gcc package by default, but not fedora).

---
 tests/tcg/meson.build | 46 +++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)
tests/tcg/meson.build +2 -1
index 0006d192cab..59ab73e1d10 100644
@@ -21,6 +21,7 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': 'cross_compiler',
+#     'cc_alt': ['list of alternative cross compilers', ...]
 #     'cc_dockerfile': 'name_of_dockerfile',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
@@ -210,7 +211,7 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags',
+    allowed = ['cc', 'cc_alt', 'cc_dockerfile', 'cc_feat_cflags',
                'folder', 'gdb_arch', 'gdb_feat_version', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +

tests/tcg/meson.build foreach target, plan: tcg_tests · line 225

Quoted 8 lines
tests/tcg/meson.build +4 -1
@@ -218,15 +219,18 @@ foreach target, plan: tcg_tests
     endif
   endforeach
 
-  cc = find_program(plan['cc'], required : false)
+  cc_list = [plan['cc']]
+  if 'cc_alt' in plan
+    cc_list += plan['cc_alt']
+  endif

If you're combining these into a list anyway, why not just have 'cc' be a list of CC names to begin with and not bother with a separate 'cc_alt' field ?

Quoted 59 lines
tests/tcg/meson.build +21 -17
+
   cc_cflags = []
-
   check_flags = []
   check_required = false
   cross_cc = get_option('tcg_tests_cross_cc_' + cc_arch)
   if cross_cc != ''
-    # we make sure cross cc exists
-    cc = find_program(cross_cc, required: true)
+    # prepend requested cross_cc
+    cc_list = [cross_cc, cc_list]
     check_required = true
   endif
   cross_cflags = get_option('tcg_tests_cross_cflags_' + cc_arch)
@@ -236,22 +240,26 @@ foreach target, plan: tcg_tests
     check_flags = cc_cflags
     check_required = true
   endif
-
-  cc_from_system = cc.found()
-  has_cc = cc.found()
-  if has_cc
-    if target.endswith('softmmu')
-      check_flags += ['-nostdlib', '-ffreestanding', '-r']
-    else
-      check_flags += ['-static']
-    endif
-
-    cmd = run_command([cc, files('test_cc.c'), check_flags, '-o', '/dev/null'],
-                      check: check_required)
-    has_cc = cmd.returncode() == 0
-    cc_from_system = has_cc
+  if target.endswith('softmmu')
+    check_flags += ['-nostdlib', '-ffreestanding', '-r']
+  else
+    check_flags += ['-static']
   endif
 
+  has_cc = false
+  foreach possible_cc: cc_list
+    cc = find_program(possible_cc, required: check_required)
+    if cc.found()
+      cmd = run_command([cc, files('test_cc.c'), check_flags, '-o', '/dev/null'],
+                        check: check_required)
+      if cmd.returncode() == 0
+        has_cc = true
+        break
+      endif
+    endif
+  endforeach
+
+  cc_from_system = has_cc
   build_test_depends = []
   build_test_depend_files = []
 
Signature · 1 line
2.43.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#5 lore raw

Re: [PATCH 2/4] tests/tcg/meson.build: introduce cc_alt (alternative cross compiler)

Quoted 40 lines · Daniel P. Berrangé
Quoted 39 lines · Pierrick Bouvier

This allows each target to provide an additional list of cross compilers to check. With this, we can detect default cc for common setups (debian/fedora/macos) without user having to provide a --cross-cc-* option.

In addition, it allows us to pick up host compilers for various hosts. (debian and archlinux have $arch-linux-gnu-gcc installed with gcc package by default, but not fedora).

---
 tests/tcg/meson.build | 46 +++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)
tests/tcg/meson.build +2 -1
index 0006d192cab..59ab73e1d10 100644
@@ -21,6 +21,7 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': 'cross_compiler',
+#     'cc_alt': ['list of alternative cross compilers', ...]
 #     'cc_dockerfile': 'name_of_dockerfile',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
@@ -210,7 +211,7 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags',
+    allowed = ['cc', 'cc_alt', 'cc_dockerfile', 'cc_feat_cflags',
                'folder', 'gdb_arch', 'gdb_feat_version', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
@@ -218,15 +219,18 @@ foreach target, plan: tcg_tests
     endif
   endforeach
 
Quoted 10 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 225

Quoted 5 lines
tests/tcg/meson.build +4 -1
-  cc = find_program(plan['cc'], required : false)
+  cc_list = [plan['cc']]
+  if 'cc_alt' in plan
+    cc_list += plan['cc_alt']
+  endif

If you're combining these into a list anyway, why not just have 'cc' be a list of CC names to begin with and not bother with a separate 'cc_alt' field ?

It's just a semantic choice, since cc has to be provided in docker container, while cc_alt do not. I can add a comment if it makes sense for you with this explanation.

Quoted 2 lines

With regards,
Daniel

#6 lore raw

Re: [PATCH 2/4] tests/tcg/meson.build: introduce cc_alt (alternative cross compiler)

Quoted 52 lines · Pierrick Bouvier
Quoted 40 lines · Daniel P. Berrangé
Quoted 39 lines · Pierrick Bouvier

This allows each target to provide an additional list of cross compilers to check. With this, we can detect default cc for common setups (debian/fedora/macos) without user having to provide a --cross-cc-* option.

In addition, it allows us to pick up host compilers for various hosts. (debian and archlinux have $arch-linux-gnu-gcc installed with gcc package by default, but not fedora).

---
 tests/tcg/meson.build | 46 +++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)
tests/tcg/meson.build +2 -1
index 0006d192cab..59ab73e1d10 100644
@@ -21,6 +21,7 @@ tcg_tests = {}
 # {
 #   'name_of_target': {
 #     'cc': 'cross_compiler',
+#     'cc_alt': ['list of alternative cross compilers', ...]
 #     'cc_dockerfile': 'name_of_dockerfile',
 #     'cc_feat_cflags': {
 #       'name': ['feature cflags'],
@@ -210,7 +211,7 @@ foreach target, plan: tcg_tests
 
   # return a clear error if user misspell a target entry
   foreach key, _ : plan
-    allowed = ['cc', 'cc_dockerfile', 'cc_feat_cflags',
+    allowed = ['cc', 'cc_alt', 'cc_dockerfile', 'cc_feat_cflags',
                'folder', 'gdb_arch', 'gdb_feat_version', 'qemu', 'tests']
     if key not in allowed
       error('unknown tcg test plan entry \'' + key + '\' for target ' + target +
@@ -218,15 +219,18 @@ foreach target, plan: tcg_tests
     endif
   endforeach
 
Quoted 10 lines

tests/tcg/meson.build foreach target, plan: tcg_tests · line 225

Quoted 5 lines
tests/tcg/meson.build +4 -1
-  cc = find_program(plan['cc'], required : false)
+  cc_list = [plan['cc']]
+  if 'cc_alt' in plan
+    cc_list += plan['cc_alt']
+  endif

If you're combining these into a list anyway, why not just have 'cc' be a list of CC names to begin with and not bother with a separate 'cc_alt' field ?

Quoted 3 lines

It's just a semantic choice, since cc has to be provided in docker container, while cc_alt do not. I can add a comment if it makes sense for you with this explanation.

Ok, I don't mind, was just wondering if there was some reason I was missing for the separation.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
Reviewed-by on v1 2/4
#7 lore raw

Re: [PATCH 2/4] tests/tcg/meson.build: introduce cc_alt (alternative cross compiler)

In reply to Pierrick Bouvier
Quoted 5 lines · Pierrick Bouvier

This allows each target to provide an additional list of cross compilers to check. With this, we can detect default cc for common setups (debian/fedora/macos) without user having to provide a --cross-cc-* option.

Quoted 8 lines

In addition, it allows us to pick up host compilers for various hosts. (debian and archlinux have $arch-linux-gnu-gcc installed with gcc package by default, but not fedora).

---
 tests/tcg/meson.build | 46 +++++++++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 19 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#8 lore raw

PATCH 3/4 tests/tcg: add alternative cross-compilers for fedora

In reply to Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

---
 tests/tcg/aarch64/meson.build        | 2 ++
 tests/tcg/aarch64/system/meson.build | 1 +
 tests/tcg/aarch64_be/meson.build     | 1 +
 tests/tcg/ppc64le/meson.build        | 1 +
 tests/tcg/riscv64/meson.build        | 2 ++
 tests/tcg/riscv64/system/meson.build | 1 +
 tests/tcg/s390x/meson.build          | 2 ++
 tests/tcg/s390x/system/meson.build   | 1 +
 tests/tcg/x86_64/meson.build         | 2 ++
 tests/tcg/x86_64/system/meson.build  | 1 +
 10 files changed, 14 insertions(+)
tests/tcg/aarch64/meson.build +2 -0
index cc2c59fb4b6..1cec335df04 100644
@@ -1,4 +1,5 @@
 cc = 'aarch64-linux-gnu-gcc'
+cc_alt = ['aarch64-redhat-linux-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 cc_feat_cflags = {
@@ -196,6 +197,7 @@ if 'qemu-aarch64' in emulators
   tcg_tests += {
     'aarch64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64',
tests/tcg/aarch64/system/meson.build +1 -0
index 6ba35a9f722..fb3b33861ea 100644
@@ -96,6 +96,7 @@ if 'qemu-system-aarch64' in emulators
   tcg_tests += {
     'aarch64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64/system',
tests/tcg/aarch64_be/meson.build +1 -0
index e45a49ec2da..509408de8e7 100644
@@ -10,6 +10,7 @@ if 'qemu-aarch64_be' in emulators
   tcg_tests += {
     'aarch64_be-linux-user': {
       'cc': 'aarch64-linux-gnu-gcc',
+      'cc_alt': ['aarch64-redhat-linux-gcc'],
       'cc_dockerfile': 'debian-all-test-cross',
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64_be',
tests/tcg/ppc64le/meson.build +1 -0
index a0f3e62e4d3..9f386287e7a 100644
@@ -2,6 +2,7 @@ if 'qemu-ppc64le' in emulators
   tcg_tests += {
     'ppc64le-linux-user': {
       'cc': 'powerpc64le-linux-gnu-gcc',
+      'cc_alt': ['ppc64le-redhat-linux-gcc'],
       'cc_dockerfile': 'debian-all-test-cross',
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'ppc64le',
tests/tcg/riscv64/meson.build +2 -0
index 5ee20a1e98d..91c840b0058 100644
@@ -1,4 +1,5 @@
 cc = 'riscv64-linux-gnu-gcc'
+cc_alt = ['riscv64-redhat-linux-gnu-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 subdir('system')
@@ -26,6 +27,7 @@ if 'qemu-riscv64' in emulators
   tcg_tests += {
     'riscv64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'riscv64',
       'gdb_arch': 'riscv64',
tests/tcg/riscv64/system/meson.build +1 -0
index 87c3f9f11ce..c87e3eee1ad 100644
@@ -65,6 +65,7 @@ if 'qemu-system-riscv64' in emulators
   tcg_tests += {
     'riscv64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'riscv64',
       'gdb_arch': 'riscv64',
tests/tcg/s390x/meson.build +2 -0
index 1f9aa57fc73..f2328d9e5cf 100644
@@ -1,4 +1,5 @@
 cc = 's390x-linux-gnu-gcc'
+cc_alt = ['s390x-redhat-linux-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 cc_feat_cflags = {
@@ -140,6 +141,7 @@ if 'qemu-s390x' in emulators
   tcg_tests += {
     's390x-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 's390x',
tests/tcg/s390x/system/meson.build +1 -0
index ef19c4831fd..359d124cc78 100644
@@ -82,6 +82,7 @@ if 'qemu-system-s390x' in emulators
   tcg_tests += {
     's390x-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 's390x',
tests/tcg/x86_64/meson.build +2 -0
index cfeef1d969c..968fe27cfc5 100644
@@ -1,4 +1,5 @@
 cc = 'x86_64-linux-gnu-gcc'
+cc_alt = ['x86_64-redhat-linux-gcc']
 cc_dockerfile = 'debian-amd64-cross'
 
 subdir('system')
@@ -72,6 +73,7 @@ if 'qemu-x86_64' in emulators
   tcg_tests += {
     'x86_64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'x86_64',
       'gdb_arch': 'x86_64',
tests/tcg/x86_64/system/meson.build +1 -0
index 43e7d7afa85..08b770d43ae 100644
@@ -52,6 +52,7 @@ if 'qemu-system-x86_64' in emulators
   tcg_tests += {
     'x86_64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'x86_64/system',
       'gdb_arch': 'x86_64',
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

Quoted 11 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Regardless of what installation arches Fedora targets, it ships cross compilers for pretty much everything. In F44 I see the following GCC available:

gcc-aarch64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-alpha-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-arc-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-arm-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-avr32-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-bfin-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-c6x-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-frv-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-h8300-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-hppa-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-hppa64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-ia64-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-loongarch64-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-m68k-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-microblaze-linux-gnu.x86_64      16.2.1-1.fc44 updates
gcc-mips64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-mn10300-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-openrisc-linux-gnu.x86_64        16.2.1-1.fc44 updates
gcc-powerpc64-linux-gnu.x86_64       16.2.1-1.fc44 updates
gcc-powerpc64le-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-ppc64-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-ppc64le-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv32-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-s390x-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-sparc64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-x86_64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-xtensa-linux-gnu.x86_64          16.2.1-1.fc44 updates
Quoted 163 lines
---
 tests/tcg/aarch64/meson.build        | 2 ++
 tests/tcg/aarch64/system/meson.build | 1 +
 tests/tcg/aarch64_be/meson.build     | 1 +
 tests/tcg/ppc64le/meson.build        | 1 +
 tests/tcg/riscv64/meson.build        | 2 ++
 tests/tcg/riscv64/system/meson.build | 1 +
 tests/tcg/s390x/meson.build          | 2 ++
 tests/tcg/s390x/system/meson.build   | 1 +
 tests/tcg/x86_64/meson.build         | 2 ++
 tests/tcg/x86_64/system/meson.build  | 1 +
 10 files changed, 14 insertions(+)
tests/tcg/aarch64/meson.build +2 -0
index cc2c59fb4b6..1cec335df04 100644
@@ -1,4 +1,5 @@
 cc = 'aarch64-linux-gnu-gcc'
+cc_alt = ['aarch64-redhat-linux-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 cc_feat_cflags = {
@@ -196,6 +197,7 @@ if 'qemu-aarch64' in emulators
   tcg_tests += {
     'aarch64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64',
tests/tcg/aarch64/system/meson.build +1 -0
index 6ba35a9f722..fb3b33861ea 100644
@@ -96,6 +96,7 @@ if 'qemu-system-aarch64' in emulators
   tcg_tests += {
     'aarch64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64/system',
tests/tcg/aarch64_be/meson.build +1 -0
index e45a49ec2da..509408de8e7 100644
@@ -10,6 +10,7 @@ if 'qemu-aarch64_be' in emulators
   tcg_tests += {
     'aarch64_be-linux-user': {
       'cc': 'aarch64-linux-gnu-gcc',
+      'cc_alt': ['aarch64-redhat-linux-gcc'],
       'cc_dockerfile': 'debian-all-test-cross',
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64_be',
tests/tcg/ppc64le/meson.build +1 -0
index a0f3e62e4d3..9f386287e7a 100644
@@ -2,6 +2,7 @@ if 'qemu-ppc64le' in emulators
   tcg_tests += {
     'ppc64le-linux-user': {
       'cc': 'powerpc64le-linux-gnu-gcc',
+      'cc_alt': ['ppc64le-redhat-linux-gcc'],
       'cc_dockerfile': 'debian-all-test-cross',
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'ppc64le',
tests/tcg/riscv64/meson.build +2 -0
index 5ee20a1e98d..91c840b0058 100644
@@ -1,4 +1,5 @@
 cc = 'riscv64-linux-gnu-gcc'
+cc_alt = ['riscv64-redhat-linux-gnu-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 subdir('system')
@@ -26,6 +27,7 @@ if 'qemu-riscv64' in emulators
   tcg_tests += {
     'riscv64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'riscv64',
       'gdb_arch': 'riscv64',
tests/tcg/riscv64/system/meson.build +1 -0
index 87c3f9f11ce..c87e3eee1ad 100644
@@ -65,6 +65,7 @@ if 'qemu-system-riscv64' in emulators
   tcg_tests += {
     'riscv64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'riscv64',
       'gdb_arch': 'riscv64',
tests/tcg/s390x/meson.build +2 -0
index 1f9aa57fc73..f2328d9e5cf 100644
@@ -1,4 +1,5 @@
 cc = 's390x-linux-gnu-gcc'
+cc_alt = ['s390x-redhat-linux-gcc']
 cc_dockerfile = 'debian-all-test-cross'
 
 cc_feat_cflags = {
@@ -140,6 +141,7 @@ if 'qemu-s390x' in emulators
   tcg_tests += {
     's390x-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 's390x',
tests/tcg/s390x/system/meson.build +1 -0
index ef19c4831fd..359d124cc78 100644
@@ -82,6 +82,7 @@ if 'qemu-system-s390x' in emulators
   tcg_tests += {
     's390x-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 's390x',
tests/tcg/x86_64/meson.build +2 -0
index cfeef1d969c..968fe27cfc5 100644
@@ -1,4 +1,5 @@
 cc = 'x86_64-linux-gnu-gcc'
+cc_alt = ['x86_64-redhat-linux-gcc']
 cc_dockerfile = 'debian-amd64-cross'
 
 subdir('system')
@@ -72,6 +73,7 @@ if 'qemu-x86_64' in emulators
   tcg_tests += {
     'x86_64-linux-user': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'x86_64',
       'gdb_arch': 'x86_64',
tests/tcg/x86_64/system/meson.build +1 -0
index 43e7d7afa85..08b770d43ae 100644
@@ -52,6 +52,7 @@ if 'qemu-system-x86_64' in emulators
   tcg_tests += {
     'x86_64-softmmu': {
       'cc': cc,
+      'cc_alt': cc_alt,
       'cc_dockerfile': cc_dockerfile,
       'folder': 'x86_64/system',
       'gdb_arch': 'x86_64',
Signature · 1 line
2.43.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#10 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

Quoted 37 lines · Daniel P. Berrangé
Quoted 11 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Regardless of what installation arches Fedora targets, it ships cross compilers for pretty much everything. In F44 I see the following GCC available:

gcc-aarch64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-alpha-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-arc-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-arm-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-avr32-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-bfin-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-c6x-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-frv-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-h8300-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-hppa-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-hppa64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-ia64-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-loongarch64-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-m68k-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-microblaze-linux-gnu.x86_64      16.2.1-1.fc44 updates
gcc-mips64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-mn10300-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-openrisc-linux-gnu.x86_64        16.2.1-1.fc44 updates
gcc-powerpc64-linux-gnu.x86_64       16.2.1-1.fc44 updates
gcc-powerpc64le-linux-gnu.x86_64     16.2.1-1.fc44 updates
Quoted 10 lines
gcc-ppc64-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-ppc64le-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv32-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-s390x-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-sparc64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-x86_64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-xtensa-linux-gnu.x86_64          16.2.1-1.fc44 updates

We want to detect host compiler here (redhat-* variants), as mentioned in commit description. It addresses original request from Paolo. Cross compilers above are already detected with current cc field.

Quoted 3 lines

With regards,
Daniel

#11 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

Quoted 49 lines · Pierrick Bouvier
Quoted 37 lines · Daniel P. Berrangé
Quoted 11 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Regardless of what installation arches Fedora targets, it ships cross compilers for pretty much everything. In F44 I see the following GCC available:

gcc-aarch64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-alpha-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-arc-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-arm-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-avr32-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-bfin-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-c6x-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-frv-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-h8300-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-hppa-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-hppa64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-ia64-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-loongarch64-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-m68k-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-microblaze-linux-gnu.x86_64      16.2.1-1.fc44 updates
gcc-mips64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-mn10300-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-openrisc-linux-gnu.x86_64        16.2.1-1.fc44 updates
gcc-powerpc64-linux-gnu.x86_64       16.2.1-1.fc44 updates
gcc-powerpc64le-linux-gnu.x86_64     16.2.1-1.fc44 updates
Quoted 10 lines
gcc-ppc64-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-ppc64le-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv32-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-s390x-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-sparc64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-x86_64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-xtensa-linux-gnu.x86_64          16.2.1-1.fc44 updates
Quoted 3 lines

We want to detect host compiler here (redhat-* variants), as mentioned in commit description. It addresses original request from Paolo. Cross compilers above are already detected with current cc field.

Oh, I see what you mean. Itis dealing with the naming difference between 'redhat-linux-gnu' and just 'linux-gnu' in the compilers for the native vs cross arch RPMs.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#12 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

Quoted 50 lines · Daniel P. Berrangé
Quoted 49 lines · Pierrick Bouvier
Quoted 47 lines · Daniel P. Berrangé
Quoted 11 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Regardless of what installation arches Fedora targets, it ships cross compilers for pretty much everything. In F44 I see the following GCC available:

gcc-aarch64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-alpha-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-arc-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-arm-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-avr32-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-bfin-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-c6x-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-frv-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-h8300-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-hppa-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-hppa64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-ia64-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-loongarch64-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-m68k-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-microblaze-linux-gnu.x86_64      16.2.1-1.fc44 updates
gcc-mips64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-mn10300-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-openrisc-linux-gnu.x86_64        16.2.1-1.fc44 updates
gcc-powerpc64-linux-gnu.x86_64       16.2.1-1.fc44 updates
gcc-powerpc64le-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-ppc64-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-ppc64le-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv32-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-s390x-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-sparc64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-x86_64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-xtensa-linux-gnu.x86_64          16.2.1-1.fc44 updates
Quoted 8 lines
Quoted 3 lines

We want to detect host compiler here (redhat-* variants), as mentioned in commit description. It addresses original request from Paolo. Cross compilers above are already detected with current cc field.

Oh, I see what you mean. Itis dealing with the naming difference between 'redhat-linux-gnu' and just 'linux-gnu' in the compilers for the native vs cross arch RPMs.

Right.
I'm not super familiar with Fedora, is there any fundamental difference between this toolchain and linux-gnu variant, in terms of ABI or anything else? Or is it just a distinction for "Our toolchain with additional patches" vs upstream one?

I tried to find some info, but didn't really find anything useful.

Quoted 3 lines

With regards,
Daniel

#13 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

Quoted 60 lines · Pierrick Bouvier
Quoted 50 lines · Daniel P. Berrangé
Quoted 49 lines · Pierrick Bouvier
Quoted 47 lines · Daniel P. Berrangé
Quoted 11 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Regardless of what installation arches Fedora targets, it ships cross compilers for pretty much everything. In F44 I see the following GCC available:

gcc-aarch64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-alpha-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-arc-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-arm-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-avr32-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-bfin-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-c6x-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-frv-linux-gnu.x86_64             16.2.1-1.fc44 updates
gcc-h8300-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-hppa-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-hppa64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-ia64-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-loongarch64-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-m68k-linux-gnu.x86_64            16.2.1-1.fc44 updates
gcc-microblaze-linux-gnu.x86_64      16.2.1-1.fc44 updates
gcc-mips64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-mn10300-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-openrisc-linux-gnu.x86_64        16.2.1-1.fc44 updates
gcc-powerpc64-linux-gnu.x86_64       16.2.1-1.fc44 updates
gcc-powerpc64le-linux-gnu.x86_64     16.2.1-1.fc44 updates
gcc-ppc64-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-ppc64le-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv32-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-riscv64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-s390x-linux-gnu.x86_64           16.2.1-1.fc44 updates
gcc-sparc64-linux-gnu.x86_64         16.2.1-1.fc44 updates
gcc-x86_64-linux-gnu.x86_64          16.2.1-1.fc44 updates
gcc-xtensa-linux-gnu.x86_64          16.2.1-1.fc44 updates
Quoted 8 lines
Quoted 3 lines

We want to detect host compiler here (redhat-* variants), as mentioned in commit description. It addresses original request from Paolo. Cross compilers above are already detected with current cc field.

Oh, I see what you mean. Itis dealing with the naming difference between 'redhat-linux-gnu' and just 'linux-gnu' in the compilers for the native vs cross arch RPMs.

Quoted 5 lines

Right.
I'm not super familiar with Fedora, is there any fundamental difference between this toolchain and linux-gnu variant, in terms of ABI or anything else? Or is it just a distinction for "Our toolchain with additional patches" vs upstream one?

Most of the downstream patches are common to both the native and cross GCC RPMs. I'm not aware of significant differences between the two that would matter for QEMU's needs.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
Reviewed-by on v1 3/4
#14 lore raw

Re: [PATCH 3/4] tests/tcg: add alternative cross-compilers for fedora

In reply to Pierrick Bouvier
Quoted 13 lines · Pierrick Bouvier

This allows to pick host compiler automatically on fedora, as those binaries are installed with 'gcc' package.

This covers all host arch supported to this day:
https://fedoraproject.org/wiki/Architectures
- x86_64
- aarch64
- ppc64le
- riscv64
- s390x
Note: QEMU and Fedora don't support 32-bit hosts anymore.

Quoted 12 lines
---
 tests/tcg/aarch64/meson.build        | 2 ++
 tests/tcg/aarch64/system/meson.build | 1 +
 tests/tcg/aarch64_be/meson.build     | 1 +
 tests/tcg/ppc64le/meson.build        | 1 +
 tests/tcg/riscv64/meson.build        | 2 ++
 tests/tcg/riscv64/system/meson.build | 1 +
 tests/tcg/s390x/meson.build          | 2 ++
 tests/tcg/s390x/system/meson.build   | 1 +
 tests/tcg/x86_64/meson.build         | 2 ++
 tests/tcg/x86_64/system/meson.build  | 1 +
 10 files changed, 14 insertions(+)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#15 lore raw

PATCH 4/4 tests/tcg: add alternative cross-compilers for macos (homebrew)

In reply to Pierrick Bouvier

Add support for cross compilers that can be installed with
homebrew: https://github.com/orgs/Homebrew/packages?tab=packages&q=-gcc
- i686-elf-gcc
- x86_64-elf-gcc
- aarch64-elf-gcc
- m68k-elf-gcc (ignored since we don't have system tests for m68k)
- riscv64-elf-gcc
- arm-none-eabi-gcc

Those toolchain target bare metal, so can be used for softmmu targets only (macos has no user target anyway).

With this, we can also cleanup our CI for MacOS since it does not require any --cross-prefix anymore.

---
 .gitlab-ci.d/macos.yml               | 7 -------
 tests/tcg/aarch64/system/meson.build | 2 +-
 tests/tcg/arm/system/meson.build     | 1 +
 tests/tcg/i386/system/meson.build    | 1 +
 tests/tcg/riscv64/system/meson.build | 2 +-
 tests/tcg/x86_64/system/meson.build  | 2 +-
 6 files changed, 5 insertions(+), 10 deletions(-)
.gitlab-ci.d/macos.yml +0 -7
index 40b9b637b3b..c798384392c 100644
@@ -41,10 +41,6 @@ aarch64-macos-15-build:
     PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
     CONFIGURE_ARGS:
         --target-list=aarch64-softmmu,arm-softmmu,i386-softmmu,x86_64-softmmu
-        --cross-prefix-aarch64=aarch64-elf-
-        --cross-prefix-arm=arm-none-eabi-
-        --cross-prefix-i386=i686-elf-
-        --cross-prefix-x86_64=x86_64-elf-
         --disable-plugins
     TEST_TARGETS: check-unit check-tcg
 
@@ -59,8 +55,5 @@ aarch64-macos-26-build:
     PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
     CONFIGURE_ARGS:
         --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
-        --cross-prefix-aarch64=aarch64-elf-
-        --cross-prefix-i386=i686-elf-
-        --cross-prefix-x86_64=x86_64-elf-
         --disable-plugins
     TEST_TARGETS: check-unit check-tcg
tests/tcg/aarch64/system/meson.build +1 -1
index fb3b33861ea..f9c4448abaf 100644
@@ -96,7 +96,7 @@ if 'qemu-system-aarch64' in emulators
   tcg_tests += {
     'aarch64-softmmu': {
       'cc': cc,
-      'cc_alt': cc_alt,
+      'cc_alt': cc_alt + ['aarch64-elf-gcc'],
       'cc_dockerfile': cc_dockerfile,
       'cc_feat_cflags': cc_feat_cflags,
       'folder': 'aarch64/system',
tests/tcg/arm/system/meson.build +1 -0
index 93d0cfec24e..89734f95605 100644
@@ -64,6 +64,7 @@ if 'qemu-system-arm' in emulators
   tcg_tests += {
     'arm-softmmu': {
       'cc': cc,
+      'cc_alt': ['arm-none-eabi-gcc'],
       'cc_dockerfile': cc_dockerfile,
       'folder': 'arm/system',
       'gdb_arch': 'arm',
tests/tcg/i386/system/meson.build +1 -0
index c3a19f43260..91c6e887191 100644
@@ -42,6 +42,7 @@ if 'qemu-system-i386' in emulators
   tcg_tests += {
     'i386-softmmu': {
       'cc': cc,
+      'cc_alt': ['i686-elf-gcc'],
       'cc_dockerfile': cc_dockerfile,
       'folder': 'i386/system',
       'gdb_arch': 'i386',
tests/tcg/riscv64/system/meson.build +1 -1
index c87e3eee1ad..c2d7d098871 100644
@@ -65,7 +65,7 @@ if 'qemu-system-riscv64' in emulators
   tcg_tests += {
     'riscv64-softmmu': {
       'cc': cc,
-      'cc_alt': cc_alt,
+      'cc_alt': cc_alt + ['riscv64-elf-gcc'],
       'cc_dockerfile': cc_dockerfile,
       'folder': 'riscv64',
       'gdb_arch': 'riscv64',
tests/tcg/x86_64/system/meson.build +1 -1
index 08b770d43ae..7d61257b771 100644
@@ -52,7 +52,7 @@ if 'qemu-system-x86_64' in emulators
   tcg_tests += {
     'x86_64-softmmu': {
       'cc': cc,
-      'cc_alt': cc_alt,
+      'cc_alt': cc_alt + ['x86_64-elf-gcc'],
       'cc_dockerfile': cc_dockerfile,
       'folder': 'x86_64/system',
       'gdb_arch': 'x86_64',
Signature · 1 line
2.43.0
Reviewed-by on v1 4/4
#16 lore raw

Re: [PATCH 4/4] tests/tcg: add alternative cross-compilers for macos (homebrew)

Quoted 16 lines · Pierrick Bouvier

Add support for cross compilers that can be installed with
homebrew: https://github.com/orgs/Homebrew/packages?tab=packages&q=-gcc
- i686-elf-gcc
- x86_64-elf-gcc
- aarch64-elf-gcc
- m68k-elf-gcc (ignored since we don't have system tests for m68k)
- riscv64-elf-gcc
- arm-none-eabi-gcc

Those toolchain target bare metal, so can be used for softmmu targets only (macos has no user target anyway).

With this, we can also cleanup our CI for MacOS since it does not require any --cross-prefix anymore.

Quoted 8 lines
---
 .gitlab-ci.d/macos.yml               | 7 -------
 tests/tcg/aarch64/system/meson.build | 2 +-
 tests/tcg/arm/system/meson.build     | 1 +
 tests/tcg/i386/system/meson.build    | 1 +
 tests/tcg/riscv64/system/meson.build | 2 +-
 tests/tcg/x86_64/system/meson.build  | 2 +-
 6 files changed, 5 insertions(+), 10 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
#17 lore raw
In reply to Pierrick Bouvier
Quoted 19 lines · Pierrick Bouvier

This series solves:
- detect and choose host compiler for host target on fedora
- detect and choose cross compilers install with homebrew on macos

It adds a new cc_alt list field to test suite, to specify one or several cross compilers to try. If none is found, or none works, we fallback to containers as usual.

Tested on debian, macos, fedora, archlinux for x86 and aarch64 arch.

Based-on: [email protected] "[PATCH v2 0/6] tests/tcg: use x86_64 cross containers on all host architectures"

Pierrick Bouvier (4):
tests/tcg/meson.build: report correct cc in summary tests/tcg/meson.build: introduce cc_alt (alternative cross compiler) tests/tcg: add alternative cross-compilers for fedora tests/tcg: add alternative cross-compilers for macos (homebrew)

Quoted 16 lines
 .gitlab-ci.d/macos.yml               |  7 ----
 tests/tcg/aarch64/meson.build        |  2 ++
 tests/tcg/aarch64/system/meson.build |  1 +
 tests/tcg/aarch64_be/meson.build     |  1 +
 tests/tcg/arm/system/meson.build     |  1 +
 tests/tcg/i386/system/meson.build    |  1 +
 tests/tcg/meson.build                | 53 ++++++++++++++++------------
 tests/tcg/ppc64le/meson.build        |  1 +
 tests/tcg/riscv64/meson.build        |  2 ++
 tests/tcg/riscv64/system/meson.build |  1 +
 tests/tcg/s390x/meson.build          |  2 ++
 tests/tcg/s390x/system/meson.build   |  1 +
 tests/tcg/x86_64/meson.build         |  2 ++
 tests/tcg/x86_64/system/meson.build  |  1 +
 14 files changed, 47 insertions(+), 29 deletions(-)

This was merged into master (efa3b9d5ac8024078225e1ab434411fdfe53b457).

Regards,
Pierrick