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

RESOLVED FIXED in Firefox 52

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: kuoe0.tw, Assigned: drh)

Tracking

({regression})

unspecified
mozilla54
x86_64
Mac OS X
regression
Points:
---

Firefox Tracking Flags

(firefox52 fixed, firefox53 fixed, firefox54 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

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

[1]: http://stackoverflow.com/questions/42234112/osx-10-8-5-gcc-fails-to-recognise-clang5-extension-builtin-mul-overflow
(Reporter)

Comment 1

2 years ago
Created attachment 8837918 [details]
compile.log
(Reporter)

Comment 2

2 years ago
Created attachment 8837919 [details] [diff] [review]
workaround
Blocks: 1339321
Component: Build Config → Storage
Product: Core → Toolkit
(Reporter)

Updated

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)
(Assignee)

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 :)

Updated

2 years ago
Flags: needinfo?(drh)

Comment 7

2 years ago
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
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
bugherder
https://hg.mozilla.org/mozilla-central/rev/1c0172148097
Status: NEW → RESOLVED
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.