[MDEV-15435] clang: error: unknown argument: '-fwhole-program' Created: 2018-02-28  Updated: 2021-10-08

Status: Open
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.2.12
Fix Version/s: 10.2

Type: Bug Priority: Minor
Reporter: Ryan Carsten Schmidt Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: None
Environment:

OS X Mavericks 10.9.5, Xcode 6.2


Issue Links:
Relates
relates to MDEV-19129 Build Failure on OSX Closed

 Description   

mariadb 10.2.12 fails to build on OS X Mavericks 10.9.5 with the error:

clang: error: unknown argument: '-fwhole-program'

This is with clang version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) as provided by Xcode 6.2, which is the last version of Xcode that is compatible with Mavericks.

Newer versions of clang, such as the one in macOS High Sierra 10.13.3 display this warning instead:

clang: warning: optimization flag '-fwhole-program' is not supported [-Wignored-optimization-argument]

Here is the commit where the "feature" of ignoring this flag was added to clang:

https://github.com/llvm-mirror/clang/commit/226bee35958fc978afb818b247601bcfa01d31fa

Looking at the mariadb build system, it deliberately adds -fwhole-program only on Apple systems. But this appears to be pointless since Apple systems default to clang which doesn't support that option. Here is the commit where the flag was added to mariadb, though the commit is huge and doesn't explain itself:

https://github.com/MariaDB/server/commit/f853a99a4fad0f390d6b1f6c46648302ca6cf310

For more information, and build logs, see https://trac.macports.org/ticket/55915



 Comments   
Comment by Ryan Carsten Schmidt [ 2018-11-26 ]

Just a reminder that this is still a problem.

Comment by Christopher Alexander Chavez [ 2020-08-24 ]

MacPorts has since encountered source code incompatibilities in the latest versions of mariadb 10.2 and later with clang from Xcode 8.3.3 and earlier ('mutable' and 'const' cannot be mixed; see https://trac.macports.org/ticket/60805), but is able to work around this issue by using an alternative compiler (e.g. MacPorts-provided clang 9.0).

Generated at Thu Feb 08 08:21:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.