rint(double) was previously declared

Bug #1276027 reported by Goetz T. Fischer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Undecided
Unassigned
5.5
New
Undecided
Unassigned
5.6
New
Undecided
Unassigned
5.7
New
Undecided
Unassigned

Bug Description

linux debian6, sunpro 5.12, percona 5.5.35

"/devel/Percona-Server-5.5.35-rel33.0/include/my_global.h", line 1460: Error: rint(double) was previously declared "extern", not "inline".

----------------------------------------

 CMAKE_BUILD_TYPE
 CMAKE_INSTALL_PREFIX /server/p5535
 COMMUNITY_BUILD OFF
 ENABLED_PROFILING OFF
 ENABLE_DEBUG_SYNC OFF
 ENABLE_DTRACE OFF
 ENABLE_GCOV OFF
 INSTALL_LAYOUT STANDALONE
 MAX_INDEXES 64
 MYSQL_DATADIR /server/sqlroot
 MYSQL_MAINTAINER_MODE OFF
 WITHOUT_RESPONSE_TIME_DISTRIBU ON
 WITH_ARCHIVE_STORAGE_ENGINE OFF
 WITH_ASAN OFF
 WITH_BLACKHOLE_STORAGE_ENGINE OFF
 WITH_DEBUG OFF
 WITH_EMBEDDED_SERVER OFF
 WITH_EXTRA_CHARSETS all
 WITH_FEDERATED_STORAGE_ENGINE OFF
 WITH_INNOBASE_STORAGE_ENGINE ON
 WITH_LIBEDIT ON
 WITH_LIBWRAP OFF
 WITH_PAM OFF
 WITH_PARTITION_STORAGE_ENGINE ON
 WITH_PERFSCHEMA_STORAGE_ENGINE OFF
 WITH_PIC OFF
 WITH_READLINE OFF
 WITH_SSL no
 WITH_UNIT_TESTS OFF
 WITH_VALGRIND OFF
 WITH_ZLIB system

tags: added: upstream
Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Please, provide more details on build process, starting from exact cmake command line options used.

Send also the output of:

uname -a

I have problems trying to build recent Percona Server 5.5.x from bzr starting at cmake stage already (on x86_64 system):

...
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS - Failed
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64
-- Performing Test HAVE_IB_GCC_ATOMIC_BUILTINS_64 - Failed
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Failed
-- Check size of pthread_t
-- Check size of pthread_t - done
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Success
-- Configuring incomplete, errors occurred!
[openxs@chief percona-5.5]$ echo $CC
/opt/sun/sunstudio12.1/bin/cc
[openxs@chief percona-5.5]$ echo $CXX
/opt/sun/sunstudio12.1/bin/CC

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

cc: Sun C 5.12 Linux_i386 2011/11/16
CC: Sun C++ 5.12 Linux_i386 2011/11/16
Linux debian 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64 GNU/Linux

as for cmake, you have to remove the pre cmake 2.8 check from cmake/os/Linux.cmake line 26-33. that aside i set no other cmake options than what i posted.

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Had not tried on Debian yet, but (while fixing cmake etc helped to get build running on my Fedora) I had got all kinds of warnings and errors but this one.

Moreover, I can not find any place in Percona Server code or in /usr/* or in /opt/sun/* where rint() is defined as extern, other than this:

/usr/include/boost/numeric/interval/detail/msvc_rounding_control.hpp:28:extern "C" { double rint(double); }
/usr/include/boost/numeric/interval/detail/c99sub_rounding_control.hpp:21:extern "C" { double rint(double); }

Maybe you can try to use grep -r on your system to find where this problem may come from?

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

solarisstudio12.3/prod/include/cc/tgmath.h line 123:

#undef rint
#define rint(x) __tgmath_rint(x)

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Yes, I found this:

[openxs@chief percona-5.5]$ grep -rn 'rint(x)' /opt/sun/*
/opt/sun/sunstudio12.1/prod/include/cc/tgmath.h:96:#define llrint(x) __tgmath_llrint(x)
/opt/sun/sunstudio12.1/prod/include/cc/tgmath.h:108:#define lrint(x) __tgmath_lrint(x)
/opt/sun/sunstudio12.1/prod/include/cc/tgmath.h:122:#define rint(x) __tgmath_rint(x)

But it does not explain where extern comes from and I do not see error about it. Now I see that my compiler version may be different, so still something to check and study.

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Can you, please, send a part of the log from your build process where this error message appears? I wonder what exact file is built/processed at the moment. I am still fighting with the build, but all I get for my_global.h is:

[ 0%] Building C object vio/CMakeFiles/vio.dir/vio.c.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: warning: macro redefined: __builtin_expect
[100%] Building C object vio/CMakeFiles/vio.dir/viosocket.c.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: warning: macro redefined: __builtin_expect
...

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

make[2]: Entering directory `/root/devel/Percona-Server-5.5.35-rel33.0'
/usr/bin/cmake -E cmake_progress_report /root/devel/Percona-Server-5.5.35-rel33.0/CMakeFiles
[ 31%] Building CXX object storage/blackhole/CMakeFiles/blackhole.dir/ha_blackhole.cc.o
cd /root/devel/Percona-Server-5.5.35-rel33.0/storage/blackhole && /opt/solarisstudio12.3/bin/CC -Dblackhole_EXPORTS -DHAVE_RESPONSE_TIME_DISTRIBUTION -DDBUG_OFF -DHAVE_CONFIG_H -DMYSQL_DYNAMIC_PLUGIN -fast -xarch=ssse3 -m64 -features=extensions -features=no%extinl -xlibmopt -w -noex -KPIC -I/root/devel/Percona-Server-5.5.35-rel33.0/include -I/root/devel/Percona-Server-5.5.35-rel33.0/sql -I/root/devel/Percona-Server-5.5.35-rel33.0/regex -o CMakeFiles/blackhole.dir/ha_blackhole.cc.o -c /root/devel/Percona-Server-5.5.35-rel33.0/storage/blackhole/ha_blackhole.cc
"/root/devel/Percona-Server-5.5.35-rel33.0/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
"/root/devel/Percona-Server-5.5.35-rel33.0/include/my_global.h", line 1460: Error: rint(double) was previously declared "extern", not "inline".
1 Error(s) and 1 Warning(s) detected.
make[2]: *** [storage/blackhole/CMakeFiles/blackhole.dir/ha_blackhole.cc.o] Error 2

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Upgraded to solarisstudio12.3, commented out cmake/os/Linux.cmake lines 26-33 and build almost worked. I've ended up with:

...
[ 84%] Building CXX object sql/CMakeFiles/sql.dir/sql_parse.cc.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
1 Warning(s) detected.
[ 84%] Building CXX object sql/CMakeFiles/sql.dir/query_response_time.cc.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 136: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 202: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 203: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 161: Error: Formal argument mp of type st_my_pthread_fastmutex_t* in call to my_pthread_fastmutex_lock(st_my_pthread_fastmutex_t*) is being passed const st_my_pthread_fastmutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 163: Error: Formal argument __mutex of type pthread_mutex_t* in call to pthread_mutex_unlock(pthread_mutex_t*) is being passed const pthread_mutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 168: Error: Formal argument mp of type st_my_pthread_fastmutex_t* in call to my_pthread_fastmutex_lock(st_my_pthread_fastmutex_t*) is being passed const st_my_pthread_fastmutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 170: Error: Formal argument __mutex of type pthread_mutex_t* in call to pthread_mutex_unlock(pthread_mutex_t*) is being passed const pthread_mutex_t*.
7 Error(s) and 1 Warning(s) detected.
make[2]: *** [sql/CMakeFiles/sql.dir/query_response_time.cc.o] Error 2
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :

Still can not reproduce for blackhole alone:

[openxs@chief blackhole]$ make clean
[openxs@chief blackhole]$ make
[ 0%] Built target mysqlservices
[ 29%] Built target strings
[ 95%] Built target mysys
[ 95%] Built target dbug
[ 95%] Built target comp_err
[ 95%] Built target GenError
[100%] Building CXX object storage/blackhole/CMakeFiles/blackhole.dir/ha_blackhole.cc.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
1 Warning(s) detected.
Linking CXX shared module ha_blackhole.so
[100%] Built target blackhole

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

have a look at the sunpro docs and the options i used. that should help with the vla issue you ran into

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote :
Download full text (3.4 KiB)

Just a status update. I keep trying with newer code and better match for your options, but still getting the same errors:

[ 89%] Building CXX object sql/CMakeFiles/sql.dir/query_response_time.cc.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 136: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 202: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 203: Error: An integer constant expression is required within the array subscript operator.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 161: Error: Formal argument mp of type st_my_pthread_fastmutex_t* in call to my_pthread_fastmutex_lock(st_my_pthread_fastmutex_t*) is being passed const st_my_pthread_fastmutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 163: Error: Formal argument __mutex of type pthread_mutex_t* in call to pthread_mutex_unlock(pthread_mutex_t*) is being passed const pthread_mutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 168: Error: Formal argument mp of type st_my_pthread_fastmutex_t* in call to my_pthread_fastmutex_lock(st_my_pthread_fastmutex_t*) is being passed const st_my_pthread_fastmutex_t*.
"/home/openxs/bzr2/percona-5.5/sql/query_response_time.cc", line 170: Error: Formal argument __mutex of type pthread_mutex_t* in call to pthread_mutex_unlock(pthread_mutex_t*) is being passed const pthread_mutex_t*.
7 Error(s) and 1 Warning(s) detected.
make[2]: *** [sql/CMakeFiles/sql.dir/query_response_time.cc.o] Error 2
make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
make: *** [all] Error 2
[openxs@chief blackhole]$ make
[ 4%] Built target mysqlservices
[ 32%] Built target strings
[ 96%] Built target mysys
[100%] Built target dbug
[100%] Built target comp_err
[100%] Built target GenError
[100%] Building CXX object storage/blackhole/CMakeFiles/blackhole.dir/ha_blackhole.cc.o
"/home/openxs/bzr2/percona-5.5/include/my_global.h", line 196: Warning (Anachronism): Attempt to redefine __builtin_expect without using #undef.
1 Warning(s) detected.
Linking CXX shared module ha_blackhole.so
[100%] Built target blackhole

instead of yours. Here is the way configured cmake (from fc -l):

1025 rm CMakeCache.txt
1026 CC=/home/openxs/SolarisStudio12.3-linux-x86-bin/solarisstudio12.3/prod/bin/cc CXX=/home/openxs/SolarisStudio12.3-linux-x86-bin/solarisstudio12.3/prod/bin/CC cmake . -DCOMMUNITY_BUILD=OFF -DENABLED_PROFILING=OFF -DENABLE_DEBUG_SYNC=OFF -DENABLE_DTRACE=OFF -DENABLE_GCOV=OFF -DINSTALL_LAYOUT=STANDALONE -DCMAKE_INSTALL_PREFIX=/home/openxs/dbs/p5.5sun -DMYSQL_MAINTAINER_MODE=OFF -DWITH_ARCHIVE_STORAGE_ENGINE=OFF -DWITH_BLACKHOLE_STORAGE_ENGINE=OFF -DWITH_DEBUG=OFF -DWITHOUT_RESPONCE_TIME_DISTRIBU=ON -DWITH_ASAN=OFF -DWITH_EMBEDDED_SERVER=OFF -DWITH_EXTRA_CHARSETS=all -DWITH_FEDERATED_STORAGE_ENGINE=OFF -DWITH_INNOBASE_STORAGE_ENGINE=ON -DWITH_...

Read more...

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

i didn't mean the cmake but compiler options. you also have to set cmake to verbose to actually see what's going on

Revision history for this message
Goetz T. Fischer (g-fischer) wrote :

this still happens with 5.6 on solaris 11, sunpro 12.3. it fails to define HAVE_RINT although rint() is available breaking the build then cause of a redefinition. removing mysql's definition does the job.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3090

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.