Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-23 Thread John Paul Adrian Glaubitz
Hi Otto!

On 12/22/18 5:31 PM, Otto Kekäläinen wrote:
> Do you have any estimate when you could finalize the patch, so it can be 
> included in the next upload?
Tomorrow or the day after tomorrow. I need to rest a bit today
and take care of the chores. It shouldn't take long to rebase
the patch.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-22 Thread Otto Kekäläinen
Hello John!

Do you have any estimate when you could finalize the patch, so it can be
included in the next upload?


John Paul Adrian Glaubitz  kirjoitti pe 21.
joulukuuta 2018 klo 19.20:

> Hello!
>
> On 12/16/18 10:37 PM, John Paul Adrian Glaubitz wrote:
> > That's odd. I rebased it against the latest mariadb-10.3 package in
> > experimental, i.e. version 1:10.3.11-1~exp1.
> >
> >> WIP at
> https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/c3bc7ec9634f8601a860602ccc6237630bda77ca
> >
> > Ok, I'll open a pull request in salsa.
>
> I haven't had the time to rebase the patch yet, I have had a full week
> schedule.
>
> But I don't understand why mariadb-10.3 was uploaded to unstable now
> without
> the patch. It's not helpful when the up-to-date version of the package
> drifts
> apart across architectures.
>
> Adrian
>
> --
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer - glaub...@debian.org
> `. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
>   `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>


Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-21 Thread Otto Kekäläinen
Hello!

pe 21. jouluk. 2018 klo 19.20 John Paul Adrian Glaubitz
(glaub...@physik.fu-berlin.de) kirjoitti:
>
> Hello!
>
> On 12/16/18 10:37 PM, John Paul Adrian Glaubitz wrote:
> > That's odd. I rebased it against the latest mariadb-10.3 package in
> > experimental, i.e. version 1:10.3.11-1~exp1.
> >
> >> WIP at 
> >> https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/c3bc7ec9634f8601a860602ccc6237630bda77ca
> >
> > Ok, I'll open a pull request in salsa.
>
> I haven't had the time to rebase the patch yet, I have had a full week 
> schedule.

If you do it today/this weekend, it will be included in next upload.

> But I don't understand why mariadb-10.3 was uploaded to unstable now without
> the patch. It's not helpful when the up-to-date version of the package drifts
> apart across architectures.

We had another mips fixing patch submitted which should have fixed
some issues and the upload seemed sensible, though it did not fix
after all.
Now there is a new MR at
https://salsa.debian.org/mariadb-team/mariadb-10.3/merge_requests/2
for further MIPS fixes.

Any further input/comments/patches are welcome so we get a new version
uploaded and the mariadb-10.3 quality on par with what mariadb-10.1
was in terms of arch compatibility.



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-21 Thread John Paul Adrian Glaubitz
Hello!

On 12/16/18 10:37 PM, John Paul Adrian Glaubitz wrote:
> That's odd. I rebased it against the latest mariadb-10.3 package in
> experimental, i.e. version 1:10.3.11-1~exp1.
> 
>> WIP at 
>> https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/c3bc7ec9634f8601a860602ccc6237630bda77ca
> 
> Ok, I'll open a pull request in salsa.

I haven't had the time to rebase the patch yet, I have had a full week schedule.

But I don't understand why mariadb-10.3 was uploaded to unstable now without
the patch. It's not helpful when the up-to-date version of the package drifts
apart across architectures.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-16 Thread John Paul Adrian Glaubitz
On 12/16/18 10:07 PM, Otto Kekäläinen wrote:
>>> We already have 21 patches and maintaining them year after year has
>>> its price, so I am more strict nowadays on making sure all patches are
>>> also on their way to upstream.
>> Well, it's a trivial bug and it fixes an FTBFS on release architectures :).
> 
> It looks like the libmysqld/CMakeLists.txt section does not apply.
> What did you rebase this on? How should this be corrected?

That's odd. I rebased it against the latest mariadb-10.3 package in
experimental, i.e. version 1:10.3.11-1~exp1.

> WIP at 
> https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/c3bc7ec9634f8601a860602ccc6237630bda77ca

Ok, I'll open a pull request in salsa.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-16 Thread Otto Kekäläinen
su 16. jouluk. 2018 klo 22.10 John Paul Adrian Glaubitz
(glaub...@physik.fu-berlin.de) kirjoitti:
>
> On 12/16/18 9:04 PM, Otto Kekäläinen wrote:
> > Can you please provide a link to where you upstreamed it?
>
> It's in the "Forwarded" field of this bug report. It's pointing to:
>
> > https://github.com/MariaDB/server/pull/979

Right. I added it into the patch itself now so that it is easy to track.

> > We already have 21 patches and maintaining them year after year has
> > its price, so I am more strict nowadays on making sure all patches are
> > also on their way to upstream.
> Well, it's a trivial bug and it fixes an FTBFS on release architectures :).

It looks like the libmysqld/CMakeLists.txt section does not apply.
What did you rebase this on? How should this be corrected?

WIP at 
https://salsa.debian.org/mariadb-team/mariadb-10.3/commit/c3bc7ec9634f8601a860602ccc6237630bda77ca



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-16 Thread John Paul Adrian Glaubitz
On 12/16/18 9:04 PM, Otto Kekäläinen wrote:
> Can you please provide a link to where you upstreamed it?

It's in the "Forwarded" field of this bug report. It's pointing to:

> https://github.com/MariaDB/server/pull/979

> We already have 21 patches and maintaining them year after year has
> its price, so I am more strict nowadays on making sure all patches are
> also on their way to upstream.
Well, it's a trivial bug and it fixes an FTBFS on release architectures :).

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#915046: [debian-mysql] Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-16 Thread Otto Kekäläinen
> Attaching an updated version of the patch.
>
> Please note, without the patch, mariadb-10.3 will not build on mips32 and
> several other 32-bit platforms.

Thanks!

Can you please provide a link to where you upstreamed it?

We already have 21 patches and maintaining them year after year has
its price, so I am more strict nowadays on making sure all patches are
also on their way to upstream.



Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-12-16 Thread John Paul Adrian Glaubitz
Hello!

Attaching an updated version of the patch.

Please note, without the patch, mariadb-10.3 will not build on mips32 and
several other 32-bit platforms.

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Link against libatomic where necessary
Author: John Paul Adrian Glaubitz 
Last-Update: 2018-12-16

--- mariadb-10.3-10.3.11.orig/configure.cmake
+++ mariadb-10.3-10.3.11/configure.cmake
@@ -923,6 +923,21 @@ int main()
 }"
 HAVE_GCC_ATOMIC_BUILTINS)
 CHECK_CXX_SOURCE_COMPILES("
+#include 
+int main() {
+uint64_t x = 1;
+__atomic_add_fetch(, 0, __ATOMIC_RELAXED);
+return x;
+}
+" HAVE__ATOMIC_ADD_FETCH)
+if (NOT HAVE__ATOMIC_ADD_FETCH)
+check_library_exists(atomic __atomic_add_fetch_8 "" HAVE_LIBATOMIC)
+if (HAVE_LIBATOMIC)
+SET(CMAKE_REQUIRED_LIBRARIES atomic)
+SET(LIBATOMIC atomic)
+endif()
+endif()
+CHECK_CXX_SOURCE_COMPILES("
 int main()
 {
   long long int var= 1;
--- mariadb-10.3-10.3.11.orig/libmysqld/CMakeLists.txt
+++ mariadb-10.3-10.3.11/libmysqld/CMakeLists.txt
@@ -145,7 +145,7 @@ ENDIF()
 
 
 SET(LIBS 
-  dbug strings mysys mysys_ssl pcre vio 
+  dbug strings mysys mysys_ssl pcre vio ${LIBATOMIC}
   ${ZLIB_LIBRARY} ${SSL_LIBRARIES} 
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL}
   ${MYSQLD_STATIC_PLUGIN_LIBS}
--- mariadb-10.3-10.3.11.orig/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.11/sql/CMakeLists.txt
@@ -169,7 +169,8 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
   ${WSREP_LIB}
   ${SSL_LIBRARIES}
-  ${LIBSYSTEMD})
+  ${LIBSYSTEMD}
+  ${LIBATOMIC})
 
 IF(WIN32)
   SET(MYSQLD_SOURCE main.cc nt_servc.cc message.rc)
--- mariadb-10.3-10.3.11.orig/storage/perfschema/unittest/CMakeLists.txt
+++ mariadb-10.3-10.3.11/storage/perfschema/unittest/CMakeLists.txt
@@ -29,4 +29,4 @@ ADD_DEPENDENCIES(pfs_server_stubs GenErr
 
 MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
  pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs pfs_misc
-  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
+  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs ${LIBATOMIC})
--- mariadb-10.3-10.3.11.orig/unittest/mysys/CMakeLists.txt
+++ mariadb-10.3-10.3.11/unittest/mysys/CMakeLists.txt
@@ -15,7 +15,7 @@
 
 MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
  aes
- LINK_LIBRARIES mysys)
+ LINK_LIBRARIES mysys ${LIBATOMIC})
 MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
 
 ADD_DEFINITIONS(${SSL_DEFINES})
--- mariadb-10.3-10.3.11.orig/unittest/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.11/unittest/sql/CMakeLists.txt
@@ -27,7 +27,7 @@ ELSE()
   ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc)
 ENDIF()
 
-TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
+TARGET_LINK_LIBRARIES(explain_filename-t sql mytap ${LIBATOMIC})
 MY_ADD_TEST(explain_filename)
 
 ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc)


Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-11-30 Thread John Paul Adrian Glaubitz
Control: tags +patch

On 11/30/18 1:05 PM, John Paul Adrian Glaubitz wrote:
> Attaching a proof-of-concept patch which fixes the issue for me.
> 
> The patch shouldn't be used as-is as it links against libatomic
> unconditionally while it should only link against it when necessary.

Attaching a cleaned-up patch which does the -latomic linking conditionally.

I'll try to upstream it.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Link against libatomic where necessary
Author: John Paul Adrian Glaubitz 
Last-Update: 2018-11-30

Index: mariadb-10.3-10.3.0/configure.cmake
===
--- mariadb-10.3-10.3.0.orig/configure.cmake
+++ mariadb-10.3-10.3.0/configure.cmake
@@ -932,6 +932,21 @@ int main()
 }"
 HAVE_GCC_ATOMIC_BUILTINS)
 CHECK_CXX_SOURCE_COMPILES("
+#include 
+int main() {
+uint64_t x = 1;
+__atomic_add_fetch(, 0, __ATOMIC_RELAXED);
+return x;
+}
+" HAVE__ATOMIC_ADD_FETCH)
+if (NOT HAVE__ATOMIC_ADD_FETCH)
+check_library_exists(atomic __atomic_add_fetch_8 "" HAVE_LIBATOMIC)
+if (HAVE_LIBATOMIC)
+SET(CMAKE_REQUIRED_LIBRARIES atomic)
+SET(LIBATOMIC atomic)
+endif()
+endif()
+CHECK_CXX_SOURCE_COMPILES("
 int main()
 {
   long long int var= 1;
Index: mariadb-10.3-10.3.0/unittest/mysys/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/unittest/mysys/CMakeLists.txt
+++ mariadb-10.3-10.3.0/unittest/mysys/CMakeLists.txt
@@ -15,7 +15,7 @@
 
 MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
  aes
- LINK_LIBRARIES mysys)
+ LINK_LIBRARIES mysys ${LIBATOMIC})
 MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
 
 ADD_DEFINITIONS(${SSL_DEFINES})
Index: mariadb-10.3-10.3.0/storage/perfschema/unittest/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/storage/perfschema/unittest/CMakeLists.txt
+++ mariadb-10.3-10.3.0/storage/perfschema/unittest/CMakeLists.txt
@@ -29,4 +29,4 @@ ADD_DEPENDENCIES(pfs_server_stubs GenErr
 
 MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
  pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs pfs_misc
-  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
+  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs ${LIBATOMIC})
Index: mariadb-10.3-10.3.0/unittest/sql/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/unittest/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.0/unittest/sql/CMakeLists.txt
@@ -27,7 +27,7 @@ ELSE()
   ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc)
 ENDIF()
 
-TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
+TARGET_LINK_LIBRARIES(explain_filename-t sql mytap ${LIBATOMIC})
 MY_ADD_TEST(explain_filename)
 
 ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc)
Index: mariadb-10.3-10.3.0/sql/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.0/sql/CMakeLists.txt
@@ -178,7 +178,8 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
   ${WSREP_LIB}
   ${SSL_LIBRARIES}
-  ${LIBSYSTEMD})
+  ${LIBSYSTEMD}
+  ${LIBATOMIC})
 
 IF(WIN32)
   SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc)
Index: mariadb-10.3-10.3.0/libmysqld/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/libmysqld/CMakeLists.txt
+++ mariadb-10.3-10.3.0/libmysqld/CMakeLists.txt
@@ -140,7 +140,7 @@ ENDIF()
 
 
 SET(LIBS 
-  dbug strings mysys mysys_ssl pcre vio 
+  dbug strings mysys mysys_ssl pcre vio ${LIBATOMIC}
   ${ZLIB_LIBRARY} ${SSL_LIBRARIES} 
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL}
   ${MYSQLD_STATIC_PLUGIN_LIBS}


Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-11-30 Thread John Paul Adrian Glaubitz
Hi!

On 11/30/18 1:23 PM, Mathieu Malaterre wrote:
> src:tbb is unconditionally using -latomic for a few Debian releases
> now and this has not been an issue. libatomic will default to using
> the correct intrinsics on supported hardware, so the link step should
> even be able to drop totally deps to that lib.

Good point. FWIW, I just found this cmake code in fastnetmon [1].

Adrian

> [1] 
> https://github.com/pavel-odintsov/fastnetmon/pull/705/commits/1fdf32aec69bb17a37ba51f8d33b3c8fb8e2d0ab

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-11-30 Thread Mathieu Malaterre
On Fri, Nov 30, 2018 at 1:05 PM John Paul Adrian Glaubitz
 wrote:
>
> Hi!
>
> Attaching a proof-of-concept patch which fixes the issue for me.
>
> The patch shouldn't be used as-is as it links against libatomic
> unconditionally while it should only link against it when necessary.

src:tbb is unconditionally using -latomic for a few Debian releases
now and this has not been an issue. libatomic will default to using
the correct intrinsics on supported hardware, so the link step should
even be able to drop totally deps to that lib.



Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-11-30 Thread John Paul Adrian Glaubitz
Hi!

Attaching a proof-of-concept patch which fixes the issue for me.

The patch shouldn't be used as-is as it links against libatomic
unconditionally while it should only link against it when necessary.

A possible mechanism for conditional linking can be found in the hhvm
package [1].

Adrian

> [1] 
> https://sources.debian.org/src/hhvm/3.24.7+dfsg-2/hphp/hhvm/CMakeLists.txt/?hl=69#L54

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Description: Link mysql components against libatomic
Author: John Paul Adrian Glaubitz 
Last-Update: 2018-11-30

Index: mariadb-10.3-10.3.0/configure.cmake
===
--- mariadb-10.3-10.3.0.orig/configure.cmake
+++ mariadb-10.3-10.3.0/configure.cmake
@@ -931,6 +931,7 @@ int main()
   return 0;
 }"
 HAVE_GCC_ATOMIC_BUILTINS)
+SET(CMAKE_REQUIRED_LIBRARIES atomic)
 CHECK_CXX_SOURCE_COMPILES("
 int main()
 {
Index: mariadb-10.3-10.3.0/unittest/mysys/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/unittest/mysys/CMakeLists.txt
+++ mariadb-10.3-10.3.0/unittest/mysys/CMakeLists.txt
@@ -15,7 +15,7 @@
 
 MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring
  aes
- LINK_LIBRARIES mysys)
+ LINK_LIBRARIES mysys atomic)
 MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
 
 ADD_DEFINITIONS(${SSL_DEFINES})
Index: mariadb-10.3-10.3.0/storage/perfschema/unittest/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/storage/perfschema/unittest/CMakeLists.txt
+++ mariadb-10.3-10.3.0/storage/perfschema/unittest/CMakeLists.txt
@@ -29,4 +29,4 @@ ADD_DEPENDENCIES(pfs_server_stubs GenErr
 
 MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom
  pfs_account-oom pfs_host-oom pfs_timer pfs_user-oom pfs pfs_misc
-  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs)
+  EXT "cc" LINK_LIBRARIES perfschema mysys pfs_server_stubs atomic)
Index: mariadb-10.3-10.3.0/unittest/sql/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/unittest/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.0/unittest/sql/CMakeLists.txt
@@ -27,7 +27,7 @@ ELSE()
   ADD_EXECUTABLE(explain_filename-t explain_filename-t.cc)
 ENDIF()
 
-TARGET_LINK_LIBRARIES(explain_filename-t sql mytap)
+TARGET_LINK_LIBRARIES(explain_filename-t sql mytap atomic)
 MY_ADD_TEST(explain_filename)
 
 ADD_EXECUTABLE(mf_iocache-t mf_iocache-t.cc ../../sql/mf_iocache_encr.cc)
Index: mariadb-10.3-10.3.0/sql/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/sql/CMakeLists.txt
+++ mariadb-10.3-10.3.0/sql/CMakeLists.txt
@@ -174,7 +174,7 @@ ADD_DEPENDENCIES(sql GenServerSource)
 ADD_DEPENDENCIES(sql GenDigestServerSource)
 DTRACE_INSTRUMENT(sql)
 TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} 
-  mysys mysys_ssl dbug strings vio pcre
+  mysys mysys_ssl dbug strings vio pcre atomic
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
   ${WSREP_LIB}
   ${SSL_LIBRARIES}
Index: mariadb-10.3-10.3.0/libmysqld/CMakeLists.txt
===
--- mariadb-10.3-10.3.0.orig/libmysqld/CMakeLists.txt
+++ mariadb-10.3-10.3.0/libmysqld/CMakeLists.txt
@@ -140,7 +140,7 @@ ENDIF()
 
 
 SET(LIBS 
-  dbug strings mysys mysys_ssl pcre vio 
+  dbug strings mysys mysys_ssl pcre vio atomic
   ${ZLIB_LIBRARY} ${SSL_LIBRARIES} 
   ${LIBWRAP} ${LIBCRYPT} ${LIBDL}
   ${MYSQLD_STATIC_PLUGIN_LIBS}


Bug#915046: mariadb-10.3: Please build with -latomic where necessary

2018-11-29 Thread John Paul Adrian Glaubitz
Source: mariadb-10.3
Version: 1:10.1.37-1
Severity: normal
User: debian-powe...@lists.debian.org
Usertags: powerpc

Hello!

On some 32-bit targets like mips or powerpc, the mariabdb-10.3 build fails
with:

 error: #error atomic ops for this platform are not implemented

This is because the test for C++11 atomics in configure.cmake fails:

CHECK_CXX_SOURCE_COMPILES("
 int main()
 {
  long long int var= 1;
  long long int *ptr= 
  return (int)__atomic_load_n(ptr, __ATOMIC_SEQ_CST);
 }"
HAVE_GCC_C11_ATOMICS)

Trying to build this code on ppc64 works fine:

glaubitz@redpanda:~/mariadb$ g++ cpp11test.cpp -o cpp11test
glaubitz@redpanda:~/mariadb$ ./cpp11test

On powerpc, we need -latomic otherwise the compilation fails
and HAVE_GCC_C11_ATOMICS is set to false:

root@kapitsa:~# g++ cpp11test.cpp -o cpp11test
/usr/bin/ld: /tmp/ccyivhlO.o: in function `main':
cpp11test.cpp:(.text+0x48): undefined reference to `__atomic_load_8'
collect2: error: ld returned 1 exit status
root@kapitsa:~#

root@kapitsa:~# g++ cpp11test.cpp -o cpp11test -latomic
root@kapitsa:~#

I have no idea, however, how to tell cmake here to pass -latomic, I'm
not a cmake expert.

Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913