51Degrees / Device-Detection

THE Fastest and most Accurate device detection for C / PHP / Perl / Python and Node.js - professionally maintained device data
https://51degrees.com/device-detection
Other
112 stars 46 forks source link

Build error for php7.1 #20

Closed onesvat closed 6 years ago

onesvat commented 6 years ago

Hello,

I am trying to install php extension api. I have received some errors on built stage.

Here is my system :

Ubuntu 16.04
PHP 7.1.11
g++ 5.4.0 

The error that I receive when try to make install

/root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp: In function ‘void _wrap_Provider_reloadFromMemory(zend_execute_data*, zval*)’:
/root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp:3583:63: error: no matching function for call to ‘Provider::reloadFromMemory(const string&, int&)’
       (arg1)->reloadFromMemory((std::string const &)*arg2,arg3);;
                                                               ^
In file included from /root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp:1083:0:
/root/Device-Detection/php/trie/src/trie/Provider.hpp:108:8: note: candidate: void Provider::reloadFromMemory(void*, int)
   void reloadFromMemory(void *source, int length);
        ^
/root/Device-Detection/php/trie/src/trie/Provider.hpp:108:8: note:   no known conversion for argument 1 from ‘const string {aka const std::__cxx11::basic_string<char>}’ to ‘void*’
/root/Device-Detection/php/trie/src/trie/Provider.hpp:109:8: note: candidate: void Provider::reloadFromMemory(unsigned char*, int)
   void reloadFromMemory(unsigned char source[], int length);
        ^
/root/Device-Detection/php/trie/src/trie/Provider.hpp:109:8: note:   no known conversion for argument 1 from ‘const string {aka const std::__cxx11::basic_string<char>}’ to ‘unsigned char*’
In file included from /usr/include/php/20160303/main/php_ini.h:24:0,
                 from /usr/include/php/20160303/main/fopen_wrappers.h:26,
                 from /usr/include/php/20160303/main/php.h:408,
                 from /root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp:751:
/root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp: In function ‘int zm_startup_FiftyOneDegreesTrieV3(int, int)’:
/usr/include/php/20160303/Zend/zend_ini.h:141:73: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 #define INI_STR(name) zend_ini_string_ex((name), sizeof(name)-1, 0, NULL)
                                                                         ^
/root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp:4065:19: note: in expansion of macro ‘INI_STR’
  char *filePath = INI_STR("FiftyOneDegreesTrieV3.data_file");
                   ^
/usr/include/php/20160303/Zend/zend_ini.h:141:73: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
 #define INI_STR(name) zend_ini_string_ex((name), sizeof(name)-1, 0, NULL)
                                                                         ^
/root/Device-Detection/php/trie/src/trie/51Degrees_PHP.cpp:4066:23: note: in expansion of macro ‘INI_STR’
  char *propertyList = INI_STR("FiftyOneDegreesTrieV3.property_list");
                       ^
Makefile:199: recipe for target 'src/trie/51Degrees_PHP.lo' failed
make: *** [src/trie/51Degrees_PHP.lo] Error 1
JoshGrew51D commented 6 years ago

The output of the errors above are from the make install command.

This issue is due to the fact that the system was unable to locate the SWIG library required for the ./configure PHP7=1 install which is 1 step before.

With PHP7 and above it is best to use the latest development release SWIG 4 and ensure the files are available in the file path below:

'/usr/local/share/swig/[swigversion]/'