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

Docker PHP 7.1 ZTS with Debian Jessie installation failed #355

Closed
sandrokeil opened this Issue Nov 7, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@sandrokeil
Copy link

sandrokeil commented Nov 7, 2017

I use the offical Docker PHP Image for my Dockerfile which uses Debian Jessie. It looks like all header files and PHP sources are available but I get the following errors (only an excerpt).

g++ -shared -g `php-config --ldflags` -Wl,-soname,libphpcpp.so.2.0 -o libphpcpp.so.2.0.0 shared/common/streambuf.o shared/common/modifiers.o shared/zend/inivalue.o shared/zend/exception_handler.o shared/zend/sapi.o shared/zend/streambuf.o shared/zend/iteratorimpl.o shared/zend/members.o shared/zend/global.o shared/zend/constantfuncs.o shared/zend/eval.o shared/zend/callable.o shared/zend/functor.o shared/zend/classbase.o shared/zend/ini.o shared/zend/script.o shared/zend/value.o shared/zend/extensionimpl.o shared/zend/hashmember.o shared/zend/exists.o shared/zend/streams.o shared/zend/zendcallable.o shared/zend/module.o shared/zend/zval.o shared/zend/base.o shared/zend/super.o shared/zend/constant.o shared/zend/classimpl.o shared/zend/globals.o shared/zend/namespace.o shared/zend/fatalerror.o shared/zend/function.o shared/zend/object.o shared/zend/file.o shared/zend/extension.o shared/zend/valueiterator.o
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
shared/zend/inivalue.o: In function `Php::IniValue::numericValue() const':
/tmp/php-cpp/zend/inivalue.cpp:21: undefined reference to `zend_ini_long'
shared/zend/inivalue.o: In function `Php::IniValue::rawValue() const':
/tmp/php-cpp/zend/inivalue.cpp:31: undefined reference to `zend_ini_string'
shared/zend/inivalue.o: In function `Php::IniValue::operator double() const':
/tmp/php-cpp/zend/inivalue.cpp:40: undefined reference to `zend_ini_double'
shared/zend/exception_handler.o: In function `Php::set_exception_handler(std::function<Php::Value (Php::Parameters&)> const&)':
/tmp/php-cpp/zend/exception_handler.cpp:29: undefined reference to `executor_globals'
/tmp/php-cpp/zend/exception_handler.cpp:32: undefined reference to `executor_globals'
/tmp/php-cpp/zend/exception_handler.cpp:38: undefined reference to `executor_globals'
shared/zend/exception_handler.o: In function `Php::set_error_handler(std::function<Php::Value (Php::Parameters&)> const&, Php::Error)':
/tmp/php-cpp/zend/exception_handler.cpp:53: undefined reference to `executor_globals'
/tmp/php-cpp/zend/exception_handler.cpp:56: undefined reference to `executor_globals'
shared/zend/exception_handler.o:/tmp/php-cpp/zend/exception_handler.cpp:62: more undefined references to `executor_globals' follow
shared/zend/exception_handler.o: In function `Php::error_reporting(Php::Error)':
/tmp/php-cpp/zend/exception_handler.cpp:81: undefined reference to `php_sprintf'
/tmp/php-cpp/zend/exception_handler.cpp:90: undefined reference to `zend_alter_ini_entry'
shared/zend/exception_handler.o: In function `zend_string_alloc':
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
shared/zend/exception_handler.o: In function `zend_string_release':
/usr/local/include/php/Zend/zend_string.h:272: undefined reference to `_efree'
shared/zend/sapi.o: In function `Php::sapi_name()':
/tmp/php-cpp/zend/sapi.cpp:25: undefined reference to `sapi_module'
shared/zend/streambuf.o: In function `Php::StreamBuf::sync()':
/tmp/php-cpp/zend/streambuf.cpp:35: undefined reference to `zend_error'
/tmp/php-cpp/zend/streambuf.cpp:40: undefined reference to `zend_write'
shared/zend/iteratorimpl.o: In function `Php::IteratorImpl::IteratorImpl(_zval_struct*, Php::Iterator*)':
/tmp/php-cpp/zend/iteratorimpl.cpp:24: undefined reference to `zend_iterator_init'
shared/zend/iteratorimpl.o: In function `Php::IteratorImpl::~IteratorImpl()':
/tmp/php-cpp/zend/iteratorimpl.cpp:40: undefined reference to `_zval_ptr_dtor'
shared/zend/iteratorimpl.o: In function `Php::IteratorImpl::key(_zend_object_iterator*, _zval_struct*)':
/tmp/php-cpp/zend/iteratorimpl.cpp:113: undefined reference to `_zval_ptr_dtor'
shared/zend/global.o: In function `zend_string_alloc':
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `__zend_malloc'
/usr/local/include/php/Zend/zend_string.h:122: undefined reference to `_emalloc'
shared/zend/global.o: In function `zend_string_release':
/usr/local/include/php/Zend/zend_string.h:272: undefined reference to `_efree'
shared/zend/global.o: In function `Php::Global::update()':
/tmp/php-cpp/zend/global.cpp:90: undefined reference to `executor_globals'
shared/zend/global.o: In function `_zend_handle_numeric_str':
/usr/local/include/php/Zend/zend_hash.h:291: undefined reference to `_zend_handle_numeric_str_ex'
shared/zend/global.o: In function `zend_symtable_update_ind':

PHP is compiled from source. Have you any hints for me how to solve this or what can be the problem?
/cc @schoentoon @jpuck

@sandrokeil

This comment has been minimized.

Copy link

sandrokeil commented Nov 8, 2017

Solved it with Alpine Linux.

@FabianPastor

This comment has been minimized.

Copy link

FabianPastor commented Apr 3, 2018

I had the same issue with php:7.2-zts-stretch and after being all day long crying i finally found a solution...

Before downloading PHP-CPP use docker-php-source extract.
Once you downloaded the PHP-CPP edit the Makefile on PHP_LINKER_FLAGS, delete the php-config stuff and add -I/usr/src/php -I/usr/src/php/main -I/usr/src/php/Zend -I/usr/src/php/TSRM -I/usr/src/php/ext -I/usr/src/php/ext/date/lib

Something like this.

RUN docker-php-source extract
RUN git clone https://github.com/CopernicaMarketingSoftware/PHP-CPP && \
    cd PHP-CPP && \
    mv Makefile Makefile.OLD && \
    sed 's|^PHP_LINKER_FLAGS.*|PHP_LINKER_FLAGS=${LINKER_FLAGS} -I/usr/src/php -I/usr/src/php/main -I/usr/src/php/Zend -I/usr/src/php/TSRM -I/usr/src/php/ext -I/usr/src/php/ext/date/lib|' Makefile.OLD > Makefile && \
    make -j$(nproc) && \
    make install

I am sure there are better ways to do the sed thing but it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment