Closed Bug 1340028 Opened 5 years ago Closed 5 years ago

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

Categories

(Toolkit :: Storage, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox52 --- fixed
firefox53 --- fixed
firefox54 --- fixed

People

(Reporter: kuoe0.tw, Assigned: drh)

References

Details

(Keywords: regression)

Attachments

(2 files)

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`.

[1]: http://stackoverflow.com/questions/42234112/osx-10-8-5-gcc-fails-to-recognise-clang5-extension-builtin-mul-overflow
Attached file compile.log
Attached patch workaroundSplinter Review
Blocks: SQLite3.17.0
Component: Build Config → Storage
Product: Core → Toolkit
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)
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)
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1c0172148097
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
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)
https://hg.mozilla.org/mozilla-central/rev/1c0172148097
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.