From c37f95aa74bc7a4d20548d6475a66190b28fc1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Mon, 21 Jun 2021 10:02:12 -0300 Subject: [PATCH 1/2] Fix cross building and archs other than x86_64/aarch64 - for defining compilation flags and any other information, it's the host machine (where the resulting binary will run) that matters, not the build machine - x86_64 optimizations should be enabled only for x86_64; there are many archs other than x86_64 and aarch64 --- meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 7203bfe..bbf0e67 100755 --- a/meson.build +++ b/meson.build @@ -20,13 +20,13 @@ add_global_arguments('-ffast-math','-fomit-frame-pointer','-fno-finite-math-only #install folder install_folder = join_paths(get_option('libdir'), 'lv2', meson.project_name()) -#get the build operating system and configure install path and shared object extension -current_os = build_machine.system() -current_arch = build_machine.cpu_family() +#get the host operating system and configure install path and shared object extension +current_os = host_machine.system() +current_arch = host_machine.cpu_family() cflags = [] -# Add x86_64 optimization where appropriate (not for ARM) -if current_arch != 'aarch64' +# Add x86_64 optimization +if current_arch == 'x86_64' cflags += ['-msse','-msse2','-mfpmath=sse'] endif @@ -82,4 +82,4 @@ nrepel_ttl = custom_target('nrepel_ttl', if sord_validate.found() test('LV2 validation', sord_validate, args : [run_command('find','./lv2 -name "*.ttl"').stdout(), run_command('find','. -name "*.ttl"').stdout()]) -endif \ No newline at end of file +endif From d0c2939de244a0b9912be02b43ad8d09d6b392bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Mon, 21 Jun 2021 10:09:49 -0300 Subject: [PATCH 2/2] Only use -ffast-math for x86_64 This compiler optimization is heavily tested only on x86_64 and can lead to issues on other archs, including hangs or wrong behavior. --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index bbf0e67..4022997 100755 --- a/meson.build +++ b/meson.build @@ -15,7 +15,7 @@ lv2_dep = dependency('lv2', required : true) nr_dep = [m_dep,fftw_dep,lv2_dep] #compiler default flags -add_global_arguments('-ffast-math','-fomit-frame-pointer','-fno-finite-math-only','-Wno-unused-function',language : 'c') +add_global_arguments('-fomit-frame-pointer','-fno-finite-math-only','-Wno-unused-function',language : 'c') #install folder install_folder = join_paths(get_option('libdir'), 'lv2', meson.project_name()) @@ -27,7 +27,7 @@ cflags = [] # Add x86_64 optimization if current_arch == 'x86_64' - cflags += ['-msse','-msse2','-mfpmath=sse'] + cflags += ['-ffast-math','-msse','-msse2','-mfpmath=sse'] endif # Add osx multiarch flags when appropriate