Quantcast

Reporting some strange behaviour OSX 10.8.5/sqlite3.17

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Reporting some strange behaviour OSX 10.8.5/sqlite3.17

islaind
Hi there and many thanks for sqlite!

I am reporting a problem compiling latest sqlite(3.17) on MAC OSX 10.8.5

$ ./configure && make

Compilation fails with the following messages:
sqlite3.c:28836:10: error: use of unknown builtin '__builtin_add_overflow'
       [-Wimplicit-function-declaration]
   return __builtin_add_overflow(*pA, iB, pA);
          ^
sqlite3.c:28856:10: error: use of unknown builtin '__builtin_sub_overflow'
       [-Wimplicit-function-declaration]
   return __builtin_sub_overflow(*pA, iB, pA);
          ^
sqlite3.c:28856:10: note: did you mean '__builtin_add_overflow'?
sqlite3.c:28836:10: note: '__builtin_add_overflow' declared here
   return __builtin_add_overflow(*pA, iB, pA);
          ^
sqlite3.c:28871:10: error: use of unknown builtin '__builtin_mul_overflow'
       [-Wimplicit-function-declaration]
   return __builtin_mul_overflow(*pA, iB, pA);
          ^
sqlite3.c:28871:10: note: did you mean '__builtin_sub_overflow'?
sqlite3.c:28856:10: note: '__builtin_sub_overflow' declared here
   return __builtin_sub_overflow(*pA, iB, pA);
          ^
3 errors generated.
----------------------

The compilation settings/versions:
$ clang --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

The following program (borrowed from sqlite3.c)
         # define GCC_VERSION
(__GNUC__*1000000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
# define CLANG_VERSION
(__clang_major__*1000000+__clang_minor__*1000+__clang_patchlevel__)

     #include <stdio.h>

     int main(void){
             printf("CLANG_VERSION: %d\n", CLANG_VERSION);
             printf("GCC_VERSION: %d\n", GCC_VERSION);
     }

gives the following response on my system:
$ gcc a.c && a.out

CLANG_VERSION: 5001000
GCC_VERSION: 4002001

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

Your program compiles fine if I modify sqlite3.c not to use the builtin
functions the compiler complains about:
Clearly the test (e.g. line 28856 of sqlite3.c) :
#if GCC_VERSION>=5004000 || CLANG_VERSION>=4000000
   return __builtin_mul_overflow(*pA, iB, pA);

is not the correct one UNLESS my clang (which is version 5.1 or should i
say 'Apple' version 5.1?) does understands builtins and needs some
special flags to use them.

I have posted a question on stackoverflow
(http://stackoverflow.com/questions/42234112/osx-10-8-5-gcc-fails-to-recognise-clang5-extension-builtin-mul-overflow)
about this problem as I am trying to figure out whether it is my system
to be blamed and whether I have these builtins.

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

FYI, one response from stackoverflow might be helpful for your development:

"Testing the version of clang is usually a bad idea, upstream and Apple
have completely different versioning schemes... __has_builtin is the
recommended way to check for builtins on clang. – Marc Glisse"

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

Many thanks for providing sqlite and all the work you are doing,

Andreas Hadjiprocopis.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Loading...