[MDEV-8403] Build on AIX: my_atomic.h", line 121.2: 1506-205 (S) #error atomic ops for this platform are not implemented Created: 2015-06-30  Updated: 2016-12-21  Resolved: 2016-12-21

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.1.6
Fix Version/s: 10.3.0

Type: Bug Priority: Minor
Reporter: Pete Lancashire Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None
Environment:

oslevel -s 7100-03-05-1524
xlc version 12.1.0.3
PATH /usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/buildsw/bin:/usr/bin/X11:/sbin:.:/usr/vac/bin:/usr/vacpp/bin
Environment Vars
OBJECT_MODE 64
CC xlc
CFLAGS -qmaxmem=-1 -qarch=pwr7 -qtune=pwr7 -qcache=auto -DSYSV -D_AIX -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O2 -I/usr/local/include
LDFLAGS -L/usr/local/lib64 -L/usr/local/lib -bmaxdata:0x80000000 -brtl
CXX xlc++_r
CXXFLAGS -qmaxmem=-1 -qarch=pwr7 -qtune=pwr7 -qcache=auto -DSYSV -D_AIX -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O5 -I/usr/local/include


Attachments: Text File CMakeCache.txt     File cmake.out     File env.out    
Issue Links:
Relates
relates to MDEV-7437 remove suport for "atomics" with rwlocks Closed
relates to MDEV-11212 Clean-up MariaDB atomic operations Closed

 Description   

Change optimization from O5 to O2 to see if could get past some errors but got this one

[ 16%] Building C object mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o
"/home/buildsw/packages/mariadb-server-10.1.6/include/my_atomic.h", line 121.2: 1506-205 (S) #error atomic ops for this platform are not implemented
"/home/buildsw/packages/mariadb-server-10.1.6/include/my_atomic.h", line 250.17: 1506-045 (S) Undeclared identifier ptr.
mysys/CMakeFiles/mysys.dir/build.make:2198: recipe for target 'mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o' failed
make[2]: *** [mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o] Error 1

Found this in the cmake

-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Success
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE - Failed
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64 - Success
-- Performing Test HAVE_IB_GCC_SYNC_SYNCHRONISE
-- Performing Test HAVE_IB_GCC_SYNC_SYNCHRONISE - Success
-- Performing Test HAVE_IB_GCC_ATOMIC_THREAD_FENCE
-- Performing Test HAVE_IB_GCC_ATOMIC_THREAD_FENCE - Failed
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success
-- Performing Test HAVE_C99_INITIALIZERS
-- Performing Test HAVE_C99_INITIALIZERS - Success
-- Looking for asprintf

It looks like the tests for gcc are wrong, should not even be trying gcc since the compiler is xlc_r

I have attached the output of the cmake pass



 Comments   
Comment by Pete Lancashire [ 2015-07-10 ]

Same result

CFLAGS   -O2 -qmaxmem=-1 -qarch=pwr7 -qtune=pwr7 -qcache=auto -I/usr/local/include
CXXFLAGS -O2 -qmaxmem=-1 -qarch=pwr7 -qtune=pwr7 -qcache=auto -I/usr/local/include

"/home/buildsw/packages/server/include/my_atomic.h", line 121.2: 1506-205 (S) #error atomic ops for this platform are not implemented
"/home/buildsw/packages/server/include/my_atomic.h", line 250.17: 1506-045 (S) Undeclared identifier ptr.
mysys/CMakeFiles/mysys.dir/build.make:2198: recipe for target 'mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o' failed
make[2]: *** [mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o] Error 1
CMakeFiles/Makefile2:7412: recipe for target 'mysys/CMakeFiles/mysys.dir/all' failed
make[1]: *** [mysys/CMakeFiles/mysys.dir/all] Error 2
Makefile:160: recipe for target 'all' failed

CMakeCache.txt

//Test HAVE_GCC_ATOMIC_BUILTINS
HAVE_GCC_ATOMIC_BUILTINS:INTERNAL=1

I've attached CMakeCache.txt

BTW even more cut down CFLAGS

  590  export CFLAGS='-qmaxmem=-1 -I/usr/local/include'
  591  export CXXFLAGS='-qmaxmem=-1 -I/usr/local/include'
  593  rm -rf server
  594  tar xf mariadb_10.1.6.tar;cd server
  595  cmake -DPLUGIN_XTRADB:STRING=NO .
  596  make

same

Comment by Sergey Vojtovich [ 2015-07-22 ]

We'd gladly fix this if we had AIX hosts around.

The fact that gcc tests succeed are actually good news: xlc_r has support for "GCC atomic memory access built-in functions". That is there is no need to implement special code for xlc. But it looks like include/atomic/nolock.h didn't like this fact: it only accepts GCC sync built-ins when compiler is gcc.

See also: http://www-01.ibm.com/support/docview.wss?uid=swg27024742&aid=1

Comment by Sergei Golubchik [ 2015-08-03 ]

you can try this patch:

--- a/include/atomic/nolock.h
+++ b/include/atomic/nolock.h
@@ -38,17 +38,12 @@
 */
 #  if defined(_MSC_VER)
 #    include "generic-msvc.h"
-#  elif __GNUC__
-#    if defined(HAVE_SOLARIS_ATOMIC)
+#  elif defined(HAVE_SOLARIS_ATOMIC)
 #      include "solaris.h"
 #    elif defined(HAVE_GCC_ATOMIC_BUILTINS)
 #      include "gcc_builtins.h"
-#    elif defined(__i386__) || defined(__x86_64__)
+#    elif __GNUC__ && (defined(__i386__) || defined(__x86_64__))
 #      include "x86-gcc.h"
-#    endif
-#  elif defined(HAVE_SOLARIS_ATOMIC)
-#    include "solaris.h"
-#  endif
 #endif

but make sure to run all related unit tests (my_atomic-t and lf-t) after your changes.

Comment by Aurélien LEQUOY [ 2015-08-27 ]

[ 18%] Building C object mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o
In file included from /root/mariadb-10.1.6/include/lf.h:19:0,
                 from /root/mariadb-10.1.6/mysys/lf_alloc-pin.c:104:
/root/mariadb-10.1.6/include/my_atomic.h:121:2: error: #error atomic ops for thi                                                                                                                                                             s platform are not implemented
/root/mariadb-10.1.6/include/my_atomic.h: In function ‘my_atomic_casptr’:
/root/mariadb-10.1.6/include/my_atomic.h:250:1: error: ‘ptr’ undeclared (first u                                                                                                                                                             se in this function)
/root/mariadb-10.1.6/include/my_atomic.h:250:1: note: each undeclared identifier                                                                                                                                                              is reported only once for each function it appears in
make[2]: *** [mysys/CMakeFiles/mysys.dir/lf_alloc-pin.c.o] Error 1
make[1]: *** [mysys/CMakeFiles/mysys.dir/all] Error 2
make: *** [all] Error 2
make  542.83s user 34.05s system 98% cpu 9:48.54 total
root has logged on pts/1 from 192.168.1.39.
2 root@bananapi ~/mariadb-10.1.6 #

this patch failed on BananaPi (ARM v7)

 
#  if defined(_MSC_VER)
#    include "generic-msvc.h"
#  elif defined(HAVE_SOLARIS_ATOMIC)
#      include "solaris.h"
#  elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#      include "gcc_builtins.h"
#  elif __GNUC__ && (defined(__i386__) || defined(__x86_64__))
#      include "x86-gcc.h"
#  endif

Comment by Aurélien LEQUOY [ 2015-08-27 ]

after dunno why gcc broken lol

./configure
configure.pl : calling cmake /root/mariadb-10.1.6
-- Running cmake version 2.8.9
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.
 
  It fails with the following output:
 
   Change Dir: /root/mariadb-10.1.6/CMakeFiles/CMakeTmp
 
 
 
  Run Build Command:/usr/bin/make "cmTryCompileExec3840924219/fast"
 
  /usr/bin/make -f CMakeFiles/cmTryCompileExec3840924219.dir/build.make
  CMakeFiles/cmTryCompileExec3840924219.dir/build
 
  make[1]: Entering directory `/root/mariadb-10.1.6/CMakeFiles/CMakeTmp'
 
  /usr/bin/cmake -E cmake_progress_report
  /root/mariadb-10.1.6/CMakeFiles/CMakeTmp/CMakeFiles 1
 
  Building C object
  CMakeFiles/cmTryCompileExec3840924219.dir/testCCompiler.c.o
 
  /usr/bin/gcc -qmaxmem=-1 -I/usr/local/include -o
  CMakeFiles/cmTryCompileExec3840924219.dir/testCCompiler.c.o -c
  /root/mariadb-10.1.6/CMakeFiles/CMakeTmp/testCCompiler.c
 
  gcc: error: unrecognized option ‘-qmaxmem=-1
 
  make[1]: *** [CMakeFiles/cmTryCompileExec3840924219.dir/testCCompiler.c.o]
  Error 1
 
  make[1]: Leaving directory `/root/mariadb-10.1.6/CMakeFiles/CMakeTmp'
 
  make: *** [cmTryCompileExec3840924219/fast] Error 2
 
 
 
 
 
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:88 (PROJECT)
 
 
-- Configuring incomplete, errors occurred!
 

Comment by Aurélien LEQUOY [ 2015-08-27 ]

 
#  if defined(_MSC_VER)
#    include "generic-msvc.h"
#  elif defined(HAVE_SOLARIS_ATOMIC)
#      include "solaris.h"
#  elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#      include "gcc_builtins.h"
#  elif __GNUC__ && (defined(__i386__) || defined(__x86_64__))
#      include "x86-gcc.h"
#  endif
#  endif
 

you forgot one #endif but it's work finally

Comment by Aurélien LEQUOY [ 2015-11-28 ]

this is still open ?

on MariaDB 10.1.8 & 10.1.9 + Galera this work perfectly on ARM v71 without any patch

Comment by Daniel Black [ 2015-11-29 ]

current implementation:

include/atomic/nolock.h

#  if defined(_MSC_VER)
#    include "generic-msvc.h"
#  elif __GNUC__
#    if defined(HAVE_SOLARIS_ATOMIC)
#      include "solaris.h"
#    elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#      include "gcc_builtins.h"
#    elif defined(__i386__) || defined(__x86_64__)
#      include "x86-gcc.h"
#    endif
#  elif defined(HAVE_SOLARIS_ATOMIC)
#    include "solaris.h"
#  endif
#endif

glad it works for you.

Comment by Nathan Malinoski [ 2016-08-11 ]

I'm also experiencing this error building mariadb-10.1.16 on Gentoo sparc.

System uname: Linux-4.7.0-gentoo-sparc64-sun4u-with-gentoo-2.2
KiB Mem: 3102920 total, 2084064 free
KiB Swap: 2096376 total, 2096376 free
Timestamp of repository gentoo: Sun, 07 Aug 2016 09:00:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
ccache version 3.2.4 [disabled]
app-shells/bash: 4.3_p42-r1::gentoo
dev-lang/perl: 5.20.2::gentoo
dev-lang/python: 2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/ccache: 3.2.4::gentoo
dev-util/cmake: 3.2.2::gentoo
dev-util/pkgconfig: 0.28-r2::gentoo
sys-apps/baselayout: 2.2::gentoo
sys-apps/openrc: 0.19.1::gentoo
sys-apps/sandbox: 2.10-r1::gentoo
sys-devel/autoconf: 2.69::gentoo
sys-devel/automake: 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils: 2.25.1-r1::gentoo
sys-devel/gcc: 4.9.3::gentoo
sys-devel/gcc-config: 1.7.3::gentoo
sys-devel/libtool: 2.4.6::gentoo
sys-devel/make: 4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc: 2.22-r4::gentoo

Comment by Sergey Vojtovich [ 2016-12-21 ]

This was fixed in MDEV-11212 in 10.3. Unfortunately fixes were not accepted to earlier versions.

Generated at Thu Feb 08 07:26:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.