Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 10.15 (Catalina) Build Errors #21

Open
vicchi opened this issue Dec 6, 2019 · 3 comments
Open

macOS 10.15 (Catalina) Build Errors #21

vicchi opened this issue Dec 6, 2019 · 3 comments

Comments

@vicchi
Copy link

vicchi commented Dec 6, 2019

I'm trying to build php-postal on my development MacBook Pro ...

macOS version: 10.15.1

CC version:

$ cc --version
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

PHP version:

$ php --version
PHP 7.4.0 (cli) (built: Nov 29 2019 16:18:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

... libpostal is previously built and installed into /opt/custom (so not to pollute Homebrew's install in /usr/local) and following along with the build steps in the README:

$ phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
$ export PKG_CONFIG_PATH=/opt/custom/lib/pkgconfig
$ ./configure --prefix=/opt/custom
<snip>
$ make
<snip>
cc -I. -I/Users/gary/Projects/custom/custom-libpostal/php-postal -DPHP_ATOM_INC -I/Users/gary/Projects/custom/custom-libpostal/php-postal/include -I/Users/gary/Projects/custom/custom-libpostal/php-postal/main -I/Users/gary/Projects/custom/custom-libpostal/php-postal -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib -I/opt/kamma/include -DHAVE_CONFIG_H -std=gnu99 -I/opt/custom/include -c /Users/gary/Projects/custom/custom-libpostal/php-postal/php_postal.c  -fno-common -DPIC -o .libs/php_postal.o
/Users/gary/Projects/custom/custom-libpostal/php-postal/php_postal.c:255:18: error: 
      expected ';' after expression
            ulong num_key;
                 ^
                 ;
/Users/gary/Projects/custom/custom-libpostal/php-postal/php_postal.c:255:13: error: 
      use of undeclared identifier 'ulong'
            ulong num_key;
            ^
/Users/gary/Projects/custom/custom-libpostal/php-postal/php_postal.c:255:19: error: 
      use of undeclared identifier 'num_key'
            ulong num_key;
                  ^
/Users/gary/Projects/custom/custom-libpostal/php-postal/php_postal.c:259:56: error: 
      use of undeclared identifier 'num_key'
            ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(val), num_key, key, php_lang) {
                                                       ^
4 errors generated.
make: *** [php_postal.lo] Error 1

Adding a very quick and dirty hack of adding typedef unsigned long ulong; into php_postal.h allows the build and test to run successfully.

However ... running sudo make install then fails with ...

$ sudo make install
Password:
mkdir: /usr/local/Cellar/php/7.4.0/pecl: File exists
mkdir: /usr/local/Cellar/php/7.4.0/pecl: No such file or directory
make: *** [install-modules] Error 1

Has anyone come across these issues or better yet, are in the process of fixing them?

@vicchi
Copy link
Author

vicchi commented Dec 24, 2019

Resolved part 1:

mkdir: /usr/local/Cellar/php/7.4.0/pecl: File exists
mkdir: /usr/local/Cellar/php/7.4.0/pecl: No such file or directory
make: *** [install-modules] Error 1

This seems to be linked to the changeover for Homebrew from supporting PHP extensions to requiring installation via pecl. If /usr/local/Cellar/php/[version]/pecl exists and if a symlink, removing this and running sudo make install installs successfully.

@vicchi
Copy link
Author

vicchi commented Dec 24, 2019

Resolved part 2: please see PR #23

@cmb69
Copy link

cmb69 commented Jun 7, 2020

Regarding part 2: this is due to the fallback definition of ulong having been removed in PHP 7.4. Would be fixed with PR #25 as well (there, I just replaced ulong with unsigned long).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants