Compilation error "use of unknown builtin '__builtin_add_overflow'" occurs when compiling sqlite3.c on macOS

RESOLVED FIXED in Firefox 52



2 years ago
2 years ago


(Reporter:, Assigned: drh)




Firefox Tracking Flags

(firefox52 fixed, firefox53 fixed, firefox54 fixed)



(2 attachments)



2 years ago
The following errors occur when I build gecko.

> gecko-dev/db/sqlite3/src/sqlite3.c:28836:10: error: use of unknown builtin '__builtin_add_overflow'
> gecko-dev/db/sqlite3/src/sqlite3.c:28856:10: error: use of unknown builtin '__builtin_sub_overflow'
> gecko-dev/db/sqlite3/src/sqlite3.c:28871:10: error: use of unknown builtin '__builtin_mul_overflow'

-- My system info --
OS:  OS X 10.10.5
GCC: Apple LLVM version 7.0.2 (clang-700.1.81)
G++: Apple LLVM version 7.0.2 (clang-700.1.81)

On this question[1] on StackOverflow, it indicates Apple version of Clang does not support the builtin functions. It works after removing all `CLANG_VERSION>=4000000`.


Comment 1

2 years ago
Posted file compile.log

Comment 2

2 years ago
Posted patch workaroundSplinter Review
Blocks: 1339321
Component: Build Config → Storage
Product: Core → Toolkit


2 years ago
Attachment #8837919 - Attachment description: patch → workaround
Attachment #8837919 - Attachment filename: patch → workaround.patch
Richard, were you planning a 3.17.1, or should we just land the upstream fix locally? We are open to both possibilities, so no reason to do a dot release just for us, if you don't have other urgent fixes to release.
Flags: needinfo?(drh)

Comment 5

2 years ago
There are no plans at the moment to do 3.17.1.  The clang incompatibility on older versions of Xcode is not considered a serious enough problem as it can easily be patched around without changing SQLite by updating to the latest Xcode version or by compiling with -DSQLITE_DISABLE_INTRINSIC.  No other issues have been observed with 3.17.0.

But if you would like us to do a 3.17.1 release, just ask and we will.
Nah, it's easy enough for us to just import the upstream fix :)
Flags: needinfo?(drh)

Comment 7

2 years ago
Pushed by
Remove the CLANG_VERSION macro from the in-tree SQLite. r=mak
The fix from comment 7 was folded into the Aurora/Beta uplift in bug 1339321, so we should be good to go.
Assignee: nobody → drh
status-firefox52: --- → fixed
status-firefox53: --- → fixed
status-firefox54: --- → affected
Keywords: regression
Tangentially, since the upstream solution was to just remove the version check, and since upstream is Cced here, I'll mention that while clang doesn't have consistent versioning, it has feature testing, which is the recommended way to check whether something is supported:

#if __has_feature(__builtin_add_overflow)

Comment 10

2 years ago
Last Resolved: 2 years ago
status-firefox54: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.