openvenues / php-postal

PHP bindings to libpostal for for fast international street address parsing/normalization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make compilation error on Ubunutu 16.04

MajorChump opened this issue · comments

/bin/bash /tmp/php-postal/libtool --mode=compile cc -I. -I/tmp/php-postal -DPHP_ATOM_INC -I/tmp/php-postal/include -I/tmp/php-postal/main -I/tmp/php-postal -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/usr/local/include -I/usr/local/include -DHAVE_CONFIG_H -std=gnu99 -I/usr/local/include -c /tmp/php-postal/php_postal.c -o php_postal.lo
libtool: compile: cc -I. -I/tmp/php-postal -DPHP_ATOM_INC -I/tmp/php-postal/include -I/tmp/php-postal/main -I/tmp/php-postal -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/usr/local/include -I/usr/local/include -DHAVE_CONFIG_H -std=gnu99 -I/usr/local/include -c /tmp/php-postal/php_postal.c -fPIC -DPIC -o .libs/php_postal.o
In file included from /usr/include/php/20160303/main/php.h:414:0, from /tmp/php-postal/php_postal.c:25: /tmp/php-postal/php_postal.c: In function ‘zm_startup_postal’: /tmp/php-postal/php_postal.c:124:44: error: ‘ADDRESS_NONE’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_NONE", ADDRESS_NONE, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:124:44: note: each undeclared identifier is reported only once for each function it appears in REGISTER_LONG_CONSTANT("ADDRESS_NONE", ADDRESS_NONE, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:125:43: error: ‘ADDRESS_ANY’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ANY", ADDRESS_ANY, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:126:44: error: ‘ADDRESS_NAME’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_NAME", ADDRESS_NAME, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:127:52: error: ‘ADDRESS_HOUSE_NUMBER’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_HOUSE_NUMBER", ADDRESS_HOUSE_NUMBER, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:128:46: error: ‘ADDRESS_STREET’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_STREET", ADDRESS_STREET, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:129:44: error: ‘ADDRESS_UNIT’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_UNIT", ADDRESS_UNIT, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:130:48: error: ‘ADDRESS_LOCALITY’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_LOCALITY", ADDRESS_LOCALITY, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:131:46: error: ‘ADDRESS_ADMIN1’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ADMIN1", ADDRESS_ADMIN1, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:132:46: error: ‘ADDRESS_ADMIN2’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ADMIN2", ADDRESS_ADMIN2, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:133:46: error: ‘ADDRESS_ADMIN3’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ADMIN3", ADDRESS_ADMIN3, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:134:46: error: ‘ADDRESS_ADMIN4’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ADMIN4", ADDRESS_ADMIN4, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:135:51: error: ‘ADDRESS_ADMIN_OTHER’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ADMIN_OTHER", ADDRESS_ADMIN_OTHER, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:136:47: error: ‘ADDRESS_COUNTRY’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_COUNTRY", ADDRESS_COUNTRY, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:137:51: error: ‘ADDRESS_POSTAL_CODE’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_POSTAL_CODE", ADDRESS_POSTAL_CODE, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:138:52: error: ‘ADDRESS_NEIGHBORHOOD’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_NEIGHBORHOOD", ADDRESS_NEIGHBORHOOD, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c:139:43: error: ‘ADDRESS_ALL’ undeclared (first use in this function) REGISTER_LONG_CONSTANT("ADDRESS_ALL", ADDRESS_ALL, CONST_CS | CONST_PERSISTENT); ^ /usr/include/php/20160303/Zend/zend_constants.h:42:105: note: in definition of macro ‘REGISTER_LONG_CONSTANT’ #define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name)-1, (lval), (flags), module_number) ^ /tmp/php-postal/php_postal.c: In function ‘zim_Expand_expand_address’: /tmp/php-postal/php_postal.c:195:5: error: unknown type name ‘normalize_options_t’ normalize_options_t options = get_libpostal_default_options(); ^ /tmp/php-postal/php_postal.c:195:35: warning: implicit declaration of function ‘get_libpostal_default_options’ [-Wimplicit-function-declaration] normalize_options_t options = get_libpostal_default_options(); ^ /tmp/php-postal/php_postal.c:222:32: error: ‘MAX_LANGUAGE_LEN’ undeclared (first use in this function) if (lang_len > MAX_LANGUAGE_LEN) { ^ /tmp/php-postal/php_postal.c:232:24: error: request for member ‘languages’ in something not a structure or union options.languages = languages; ^ /tmp/php-postal/php_postal.c:233:24: error: request for member ‘num_languages’ in something not a structure or union options.num_languages = num_languages; ^ /tmp/php-postal/php_postal.c:240:20: error: request for member ‘address_components’ in something not a structure or union options.address_components = (uint16_t)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:246:20: error: request for member ‘latin_ascii’ in something not a structure or union options.latin_ascii = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:252:20: error: request for member ‘transliterate’ in something not a structure or union options.transliterate = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:258:20: error: request for member ‘strip_accents’ in something not a structure or union options.strip_accents = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:264:20: error: request for member ‘decompose’ in something not a structure or union options.decompose = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:270:20: error: request for member ‘lowercase’ in something not a structure or union options.lowercase = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:276:20: error: request for member ‘trim_string’ in something not a structure or union options.trim_string = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:282:20: error: request for member ‘drop_parentheticals’ in something not a structure or union options.drop_parentheticals = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:288:20: error: request for member ‘replace_numeric_hyphens’ in something not a structure or union options.replace_numeric_hyphens = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:294:20: error: request for member ‘delete_numeric_hyphens’ in something not a structure or union options.delete_numeric_hyphens = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:300:20: error: request for member ‘split_alpha_from_numeric’ in something not a structure or union options.split_alpha_from_numeric = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:306:20: error: request for member ‘replace_word_hyphens’ in something not a structure or union options.replace_word_hyphens = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:312:20: error: request for member ‘delete_word_hyphens’ in something not a structure or union options.delete_word_hyphens = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:318:20: error: request for member ‘delete_final_periods’ in something not a structure or union options.delete_final_periods = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:324:20: error: request for member ‘delete_acronym_periods’ in something not a structure or union options.delete_acronym_periods = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:330:20: error: request for member ‘drop_english_possessives’ in something not a structure or union options.drop_english_possessives = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:336:20: error: request for member ‘delete_apostrophes’ in something not a structure or union options.delete_apostrophes = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:342:20: error: request for member ‘expand_numex’ in something not a structure or union options.expand_numex = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:348:20: error: request for member ‘roman_numerals’ in something not a structure or union options.roman_numerals = (bool)Z_LVAL_P(val); ^ /tmp/php-postal/php_postal.c:354:25: warning: implicit declaration of function ‘expand_address’ [-Wimplicit-function-declaration] char **expansions = expand_address(address, options, &num_expansions); ^ /tmp/php-postal/php_postal.c:354:25: warning: initialization makes pointer from integer without a cast [-Wint-conversion] /tmp/php-postal/php_postal.c:362:5: warning: implicit declaration of function ‘expansion_array_destroy’ [-Wimplicit-function-declaration] expansion_array_destroy(expansions, num_expansions); ^ /tmp/php-postal/php_postal.c: In function ‘zim_Parser_parse_address’: /tmp/php-postal/php_postal.c:393:5: error: unknown type name ‘address_parser_options_t’ address_parser_options_t options = get_libpostal_address_parser_default_options(); ^ /tmp/php-postal/php_postal.c:393:40: warning: implicit declaration of function ‘get_libpostal_address_parser_default_options’ [-Wimplicit-function-declaration] address_parser_options_t options = get_libpostal_address_parser_default_options(); ^ /tmp/php-postal/php_postal.c:403:20: error: request for member ‘language’ in something not a structure or union options.language = language; ^ /tmp/php-postal/php_postal.c:410:20: error: request for member ‘country’ in something not a structure or union options.country = country; ^ /tmp/php-postal/php_postal.c:415:5: error: unknown type name ‘address_parser_response_t’ address_parser_response_t *response = parse_address(address, options); ^ /tmp/php-postal/php_postal.c:415:43: warning: implicit declaration of function ‘parse_address’ [-Wimplicit-function-declaration] address_parser_response_t *response = parse_address(address, options); ^ /tmp/php-postal/php_postal.c:415:43: warning: initialization makes pointer from integer without a cast [-Wint-conversion] In file included from /usr/include/php/20160303/main/php.h:40:0, from /tmp/php-postal/php_postal.c:25: /tmp/php-postal/php_postal.c:427:39: error: request for member ‘num_components’ in something not a structure or union array_init_size(&ret, response->num_components); ^ /usr/include/php/20160303/Zend/zend_API.h:381:56: note: in definition of macro ‘array_init_size’ #define array_init_size(arg, size) _array_init((arg), (size) ZEND_FILE_LINE_CC) ^ /tmp/php-postal/php_postal.c:433:40: error: request for member ‘num_components’ in something not a structure or union for (size_t i = 0; i < response->num_components; i++) { ^ In file included from /usr/include/php/20160303/main/php.h:40:0, from /tmp/php-postal/php_postal.c:25: /tmp/php-postal/php_postal.c:435:61: error: request for member ‘labels’ in something not a structure or union add_assoc_string(&component, LABEL_KEY, response->labels[i]); // , copy ^ /usr/include/php/20160303/Zend/zend_API.h:411:96: note: in definition of macro ‘add_assoc_string’ #define add_assoc_string(__arg, __key, __str) add_assoc_string_ex(__arg, __key, strlen(__key), __str) ^ /tmp/php-postal/php_postal.c:436:61: error: request for member ‘components’ in something not a structure or union add_assoc_string(&component, VALUE_KEY, response->components[i]); // , copy ^ /usr/include/php/20160303/Zend/zend_API.h:411:96: note: in definition of macro ‘add_assoc_string’ #define add_assoc_string(__arg, __key, __str) add_assoc_string_ex(__arg, __key, strlen(__key), __str) ^ /tmp/php-postal/php_postal.c:440:9: warning: implicit declaration of function ‘address_parser_response_destroy’ [-Wimplicit-function-declaration] address_parser_response_destroy(response); ^

Any ideas?

commented

Sounds like that's PHP7, which appears to be the default as of newer versions of Ubuntu.

This binding originally only supported 5.5 and 5.6. PR #5 added PHP7 support but overwrote the existing PHP5 functionality. Today I've merged #10 which adds PHP7 compatibility alongside the PHP5 codebase and uses compile-time checks to differentiate.

Pull latest and try again. Also might want to pull latest libpostal as I've added a small update today that will affect tests if you're running them.

Yeah that has resolved the issue. Thanks!