[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] 2 commits: build-sys: Fix atomic support detection

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Mon Jul 18 14:02:02 UTC 2022



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
fd81201f by Nicolas Cavallari at 2022-07-18T13:59:14+00:00
build-sys: Fix atomic support detection

Attempting to use atomics operations on an architecture that does not
support them generally results in a link error:

ld: /tmp/ccjYcMPP.o: in function `func':
testfile.c:(.text+0x1c): undefined reference to `__sync_bool_compare_and_swap_4'

The current build system uses cc.compiles() to check if atomic ops are
supported, but cc.compiles() does not attempt to link, so the test fails
to enable libatomics_opts.

Fix this by using cc.links() instead of cc.compiles().

Signed-off-by: Nicolas Cavallari <nicolas.cavallari at green-communications.fr>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/732>

- - - - -
baa3d24b by Nicolas Cavallari at 2022-07-18T13:59:14+00:00
build-sys: Add missing libatomic_ops dependencies

Add libatomic_ops dependencies to libraries/modules that showed a
failure on an arch that does not have native atomic operations support.

Not all optional dependencies were tested, so it is possible that
some optional modules are still missing libatomic_ops dependencies.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari at green-communications.fr>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/732>

- - - - -


5 changed files:

- meson.build
- src/meson.build
- src/modules/meson.build
- src/pulse/meson.build
- src/pulsecore/meson.build


Changes:

=====================================
meson.build
=====================================
@@ -498,22 +498,24 @@ endif
 
 need_libatomic_ops = false
 
-atomictest = '''void func() {
+atomictest = '''int main() {
   volatile int atomic = 2;
   __sync_bool_compare_and_swap (&atomic, 2, 3);
+  return 0;
 }
 '''
 
-if cc.compiles(atomictest)
+if cc.links(atomictest)
   cdata.set('HAVE_ATOMIC_BUILTINS', 1)
 
-  newatomictest = '''void func() {
+  newatomictest = '''int main() {
     int c = 0;
     __atomic_store_n(&c, 4, __ATOMIC_SEQ_CST);
+    return 0;
   }
   '''
 
-  if(cc.compiles(newatomictest))
+  if(cc.links(newatomictest))
     cdata.set('HAVE_ATOMIC_BUILTINS_MEMORY_MODEL', 1)
   endif
 


=====================================
src/meson.build
=====================================
@@ -205,7 +205,7 @@ else
       libm_dep, thread_dep, dl_dep, shm_dep, iconv_dep, sndfile_dep, dbus_dep,
       x11_dep, libsystemd_dep, glib_dep.partial_dependency(compile_args: true),
       gtk_dep.partial_dependency(compile_args: true), asyncns_dep, libintl_dep,
-      platform_dep, platform_socket_dep, execinfo_dep,
+      platform_dep, platform_socket_dep, execinfo_dep, libatomic_ops_dep,
     ],
     implicit_include_directories : false)
 


=====================================
src/modules/meson.build
=====================================
@@ -14,7 +14,7 @@ all_modules = [
   [ 'module-cli-protocol-tcp', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_TCP_SOCKETS'], [], libprotocol_cli ],
   [ 'module-cli-protocol-unix', 'module-protocol-stub.c', [], ['-DUSE_PROTOCOL_CLI', '-DUSE_UNIX_SOCKETS'], [], libprotocol_cli ],
   [ 'module-combine', 'module-combine.c' ],
-  [ 'module-combine-sink', 'module-combine-sink.c' ],
+  [ 'module-combine-sink', 'module-combine-sink.c', [], [], [libatomic_ops_dep] ],
 #  [ 'module-coreaudio-detect', 'macosx/module-coreaudio-detect.c' ],
 #  [ 'module-coreaudio-device', 'macosx/module-coreaudio-device.c' ],
   [ 'module-default-device-restore', 'module-default-device-restore.c', [], [], [], libprotocol_native ],
@@ -73,7 +73,7 @@ endif
 
 if host_machine.system() != 'windows'
   all_modules += [
-    [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [], librtp ],
+    [ 'module-rtp-recv', 'rtp/module-rtp-recv.c', [], [], [libatomic_ops_dep], librtp ],
     [ 'module-rtp-send', 'rtp/module-rtp-send.c' , [], [], [], librtp ],
   ]
 endif
@@ -243,7 +243,7 @@ module_echo_cancel_sources = [
 ]
 module_echo_cancel_orc_sources = []
 module_echo_cancel_flags = []
-module_echo_cancel_deps = []
+module_echo_cancel_deps = [libatomic_ops_dep]
 module_echo_cancel_libs = []
 
 if get_option('adrian-aec')


=====================================
src/pulse/meson.build
=====================================
@@ -85,7 +85,7 @@ libpulse = shared_library('pulse',
   link_args : [nodelete_link_args, versioning_link_args],
   install : true,
   install_rpath : privlibdir,
-  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep],
+  dependencies : [libm_dep, thread_dep, libpulsecommon_dep, dbus_dep, dl_dep, iconv_dep, libintl_dep, platform_dep, platform_socket_dep, libatomic_ops_dep],
   implicit_include_directories : false)
 
 libpulse_dep = declare_dependency(link_with: libpulse)


=====================================
src/pulsecore/meson.build
=====================================
@@ -251,7 +251,7 @@ libcli = shared_library('cli',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -268,7 +268,7 @@ libprotocol_cli = shared_library('protocol-cli',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libcli_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libcli_dep, libatomic_ops_dep],
   install : true,
   install_rpath : rpath_dirs,
   install_dir : modlibexecdir,
@@ -280,7 +280,7 @@ libprotocol_http = shared_library('protocol-http',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -292,7 +292,7 @@ libprotocol_native = shared_library('protocol-native',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, dbus_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, dbus_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,
@@ -304,7 +304,7 @@ libprotocol_simple = shared_library('protocol-simple',
   c_args : [pa_c_args, server_c_args, database_c_args],
   link_args : [nodelete_link_args],
   include_directories : [configinc, topinc],
-  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep],
+  dependencies : [libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep],
   install : true,
   install_rpath : privlibdir,
   install_dir : modlibexecdir,



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/81a051089f3a5890972006256737776d22de9883...baa3d24b760fe48d25d379b972728ea3ffa5492d

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/compare/81a051089f3a5890972006256737776d22de9883...baa3d24b760fe48d25d379b972728ea3ffa5492d
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20220718/7e294f1b/attachment-0001.htm>


More information about the pulseaudio-commits mailing list