php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70269 Tons of warnings and 1 error when building on Mac OS X
Submitted: 2015-08-14 11:36 UTC Modified: 2018-04-08 17:39 UTC
From: rj at obsigna dot com Assigned: cmb (profile)
Status: Not a bug Package: *Compile Issues
PHP Version: 5.6.12 OS: Mac OS X 10.10.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rj at obsigna dot com
New email:
PHP Version: OS:

 

 [2015-08-14 11:36 UTC] rj at obsigna dot com
Description:
------------
I need PostgreSQL support and therefore I frequently build a custom PHP on my Mac. This time, I built PHP 5.6.12, using the steps below. On Mac OS X, the default compiler is clang. And clang found a hell lot of warnings, many of which seem to be real issues and not clang peculiarities. For example, I saw several like this one:

/Users/rolf/Installation/php-5.6.12/ext/date/php_date.c:2254:6: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value

If the incriminated code is used for datetime calculatios with input values after the year 2038, then it would fail miserably.

Yet another example:

/Users/rolf/Installation/php-5.6.12/ext/pdo/pdo_stmt.c:469:19: warning: comparison of unsigned expression < 0 is always false

The compilation usually bails out with the following error:

/Users/rolf/Installation/php-5.6.12/ext/sqlite3/libsqlite/sqlite3.c:23512:3: error: SQLite will not work correctly with the -ffast-math option of GCC.
# error SQLite will not work correctly with the -ffast-math option of GCC.

I usually replace that error declaration in sqlite3.c with a warning one, because clang is not GCC and -ffast-math takes NOT part in the compiler flags.


My Steps for building PHP on Mac OS X follow:

$ cd ~/Installation
$ export CFLAGS="-Ofast -g0 -Wno-deprecated-declarations"
$ curl -L http://br1.php.net/get/php-5.6.12.tar.bz2/from/this/mirror -o php-5.6.12.tar.bz2
$ tar -oxjf php-5.6.12.tar.bz2
$ cd php-5.6.12

$ sed -e "s/# error SQLite will not work correctly with the \-ffast\-math option of GCC./# warning SQLite will not work correctly with the \-ffast\-math option of GCC./" -i "" ext/sqlite3/libsqlite/sqlite3.c

$ ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib=/usr --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dba --enable-sockets --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-pgsql=/usr/local/pgsql --with-mysql-sock=/var/mysql/mysql.sock --with-mysql=mysqlnd --with-openssl=/usr --with-xmlrpc --with-xsl=/usr --with-iconv=/usr

$make | tee ../Warnings-php-5.6.12.txt


You can download the file "Warnings-php-5.6.12.txt" on "http://blog.obsigna.net/downloads/Warnings-php-5.6.12.txt". I will remove it in 30 days.

Best regards

Rolf



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-08 17:39 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2018-04-08 17:39 UTC] cmb@php.net
> libsqlite/sqlite3.c:23512:3: error: SQLite will not work
> correctly with the -ffast-math option of GCC.

This would be an issue in libsqlite, so should be reported
upstream[1].

Regarding the warnings: it is certainly good to fix the underlying
issues (patches and pull requests are welcome), if there are any,
but per se these do not qualify as bug.

[1] <http://sqlite.org/index.html>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC