Skip to contentSkip to conversation

build: explicitly enable SSE4 for x86 meson builds

PATCH Superseded Bruce Richardson 2 participants 4 messages Dec 17, 2019 – Jan 3, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: explicitly enable SSE4 for x86 meson builds

If the compiler does not recognise the specific CPU when building with the default "native" machine type, SSE4.2 instructions can be missing, causing a build error. Rather than advising the user to change the machine type, we can just turn on SSE4.2 directly. This can prevent issues with running automated tests with older compilers/distros on newer hardware.

Fixes a25a650be5f0 ("build: add infrastructure for meson and ninja builds")
---
 config/x86/meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
config/x86/meson.build +2 -4
index 8b0fa3e6f..0d60204a5 100644
@@ -15,11 +15,9 @@ if not is_windows
 endif
 
 # we require SSE4.2 for DPDK
-sse_errormsg = '''SSE4.2 instruction set is required for DPDK.
-Please set the machine type to "nehalem" or "corei7" or higher value'''
-
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
-	error(sse_errormsg)
+	message('SSE 4.2 not enabled by default, explicitly enabling')
+	machine_args += -msse4
 endif
 
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
Signature · 1 line
2.23.0
#1 lore raw

PATCH v2 1/1 build: explicitly enable sse4 for meson builds

If the compiler does not recognise the specific CPU when building with the default "native" machine type, sse4.2 instructions can be missing, causing a build error. Rather than advising the user to change the machine type, we can just turn on SSE4.2 directly. This can prevent issues with running automated tests with older compilers/distros on newer hardware.

---
V2: insert missing quotes around "-msse4"

---
 config/x86/meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
config/x86/meson.build +2 -4
index 8b0fa3e6f..adc857ba2 100644
@@ -15,11 +15,9 @@ if not is_windows
 endif
 
 # we require SSE4.2 for DPDK
-sse_errormsg = '''SSE4.2 instruction set is required for DPDK.
-Please set the machine type to "nehalem" or "corei7" or higher value'''
-
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
-	error(sse_errormsg)
+	message('SSE 4.2 not enabled by default, explicitly enabling')
+	machine_args += '-msse4'
 endif
 
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
Signature · 1 line
2.24.1
#2 lore raw

Re: [dpdk-dev] [PATCH v2] build: explicitly enable sse4 for meson builds

+stable

This patch is probably worthwhile taking into 19.11 and 18.11 branches to reduce chances of failures on CI of stable trees.

Quoted 6 lines · Bruce Richardson

If the compiler does not recognise the specific CPU when building with the default "native" machine type, sse4.2 instructions can be missing, causing a build error. Rather than advising the user to change the machine type, we can just turn on SSE4.2 directly. This can prevent issues with running automated tests with older compilers/distros on newer hardware.

Quoted 28 lines

---
V2: insert missing quotes around "-msse4"

---
 config/x86/meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
config/x86/meson.build +2 -4
index 8b0fa3e6f..adc857ba2 100644
@@ -15,11 +15,9 @@ if not is_windows
 endif
 
 # we require SSE4.2 for DPDK
-sse_errormsg = '''SSE4.2 instruction set is required for DPDK.
-Please set the machine type to "nehalem" or "corei7" or higher value'''
-
 if cc.get_define('__SSE4_2__', args: machine_args) == ''
-	error(sse_errormsg)
+	message('SSE 4.2 not enabled by default, explicitly enabling')
+	machine_args += '-msse4'
 endif
 
 base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
Signature · 1 line
2.24.1
Acked-by Applied
#3 lore raw

Re: [dpdk-dev] [PATCH v2] build: explicitly enable sse4 for meson builds

Quoted 5 lines · Bruce Richardson

+stable

This patch is probably worthwhile taking into 19.11 and 18.11 branches to reduce chances of failures on CI of stable trees.

+1

Quoted 10 lines · Bruce Richardson
Quoted 6 lines

If the compiler does not recognise the specific CPU when building with the default "native" machine type, sse4.2 instructions can be missing, causing a build error. Rather than advising the user to change the machine type, we can just turn on SSE4.2 directly. This can prevent issues with running automated tests with older compilers/distros on newer hardware.

Quoted 1 line

Applied, thanks.

--
David Marchand