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

SWIG PHP Bindings can't be built on Travis #5795

Closed
geographika opened this issue Apr 24, 2019 · 1 comment
Closed

SWIG PHP Bindings can't be built on Travis #5795

geographika opened this issue Apr 24, 2019 · 1 comment

Comments

@geographika
Copy link
Member

geographika commented Apr 24, 2019

After several failed attempts at building the new PHPNG SWIG bindings with Travis, I think I have found the reason.

The same version of PHP and SWIG builds fine on a clean Ubuntu Trusy machine, but not on Travis.

After trying to find the differences between the two setups using;

php -r 'echo phpinfo();'

The most likely culprit seems to be:

# Travis
Thread Safety => enabled
# local
Thread Safety => disabled

travis-ci/php-src-builder#24 mentions that

the current implementation only builds ZTS (Zend Thread Safety) builds of PHP.

And also:

PHP being ZTS by default is quite annoying for extension developers. Its not the default in PHP world.

Which is why Debian and local builds seem to be fine.

There is a pull request to add non-ZTS builds at travis-ci/php-src-builder#24

The error messages caused by this seem to match the ones mentioned by @AlexanderGabriel in swig/swig#1238 which he encountered with ZTS on Windows builds.

[ 94%] Building C object mapscript/phpng/CMakeFiles/php_mapscriptng.dir/mapscriptPHP7_wrap.c.o
/home/travis/build/geographika/mapserver/build/mapscript/phpng/mapscriptPHP7_wrap.c: In function ‘SWIG_FAIL’:
/home/travis/build/geographika/mapserver/build/mapscript/phpng/mapscriptPHP7_wrap.c:1045:27: error: ‘mapscript_globals’ undeclared (first use in this function)
 #define SWIG_ErrorCode() (mapscript_globals.error_code)

There seem to be a couple of options to get this working:

  • install PHP from another source and ignore the prebuilt Travis machines
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get install -y --allow-unauthenticated php7.0-dev
  • update to SWIG 4.0 (currently in beta, and seems to break the Python MapScript builds):
cd /tmp
sudo wget http://prdownloads.sourceforge.net/swig/swig-4.0.0-beta1.tar.gz
tar xf swig-4.0.0-beta1.tar.gz
cd swig-4.0.0-beta1 && ./configure --prefix=/usr && make && sudo make install
swig -version
@geographika
Copy link
Member Author

Fixed by updating to SWIG 4 in #5983

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

1 participant