Skip to content

Problems with PHP module version #284

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

Closed
actopolus opened this issue Jul 24, 2019 · 16 comments
Closed

Problems with PHP module version #284

actopolus opened this issue Jul 24, 2019 · 16 comments

Comments

@actopolus
Copy link

actopolus commented Jul 24, 2019

OS: Debian GNU/Linux 8.11 (jessie) (Same on Ubuntu 18.04.2 LTS)
Unit version: 1.9.0 (from github repo)

Problem:
Php version doesn't change when configurator responses "Reconfiguration done.". Php version always targets on newer version. When "type" for application php "7.1.30", phpinfo shows 7.2.20.

Env
It has two modules for php 7.1 and php 7.2, and simple script with phpinfo():

Unit build configuration:

unit version: 1.9.0
configured as ./configure --debug --prefix=/usr --state=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tests --openssl --modules=/usr/lib/unit/modules

Unit log:

module: php 7.1.30-2+0\~20190710.21+debian8\~1.gbp011d3c "/usr/lib/unit/modules/php71.unit.so"
module: php 7.2.20-1+0\~20190710.23+debian8\~1.gbp2428c5 "/usr/lib/unit/modules/php72.unit.so"

Unit config:

{
	"listeners": {
		"*:8300": {
			"application": "exa"
		}
	},

	"applications": {
		"exa": {
			"type": "php 7.1.30",
			"processes": 2,
			"user": "www-data",
			"group": "www-data",
			"root": "/var/www/example",
			"script": "index.php",
			"environment": {
				"APPLICATION_TYPE": "applications",
				"APPLICATION_ENV": "Testing"
			}
		}
	}
}

Steps to reproduce:

  • Checkout repos
  • Configure unit 1.9.0 (sudo ./configure --debug --prefix=/usr --state=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tests --openssl --modules=/usr/lib/unit/modules)
  • Build unit (make)
  • Install unit (make install)
  • Install php7.1-dev, libphp7.1-embed
  • Configure module php7.1 (sudo ./configure php --module=php71 --config=/usr/bin/php-config7.1 --lib-path=/usr/lib/php/7.1/sapi)
  • Build php71 (make php71)
  • Install php71 (make php71-install)
  • Configure simple app with phpinfo and type "php 7.1.30"
  • See phpinfo (shows version 7.1.30)
  • Install php7.2-dev, libphp7.2-embed
  • Configure module php7.2 (sudo ./configure php --module=php72 --config=/usr/bin/php-config7.2 --lib-path=/usr/lib/php/7.2/sapi)
  • Build php72 (make php72)
  • Install php72 (make php72-install)
  • Restart unit for module discovery
  • See phpinfo (shows version 7.2, when type is "php 7.1.30")
@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

Please make sure that the issue isn't caused by the browser cache showing you previous version of phpinfo() page.

$ grep module unit.log
2019/07/24 12:30:12 [notice] 9473#9473 module: php 5.6.38-pl0-gentoo "build/php56.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: php 7.0.32 "build/php70.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: php 7.1.23 "build/php71.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: php 7.2.11 "build/php72.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: python 2.7.10 "build/py27.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: python 3.3.5 "build/py33.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: python 3.4.5 "build/py34.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: ruby 2.2.6 "build/ruby.unit.so"
2019/07/24 12:30:12 [notice] 9473#9473 module: ruby 2.3.6 "build/ruby23.unit.so"
$ build/unitd --control 127.0.0.1:8443 --modules build --state build
$ cat test.json
{
        "listeners": {
                "127.0.0.1:8888": {
                        "pass": "applications/php"
                }
        },

        "applications": {
                "php": {
                        "type": "php 5.6.38",
                        "script": "phpinfo.php",
                        "root": "/home/vbart/Development/tests/"
                }
        }
}
$ curl -X PUT [email protected] 127.1:8443/config
{
        "success": "Reconfiguration done."
}
$ curl 127.1:8888 | grep 'PHP Version'
...
<h1 class="p">PHP Version 5.6.38-pl0-gentoo</h1>
$ curl -X PUT -d '"php 7.0.32"' 127.1:8443/config/applications/php/type
{
        "success": "Reconfiguration done."
}
$ curl 127.1:8888 | grep 'PHP Version'
...
<h1 class="p">PHP Version 7.0.32</h1>
$ curl -X PUT -d '"php 7.1.23"' 127.1:8443/config/applications/php/type   
{
        "success": "Reconfiguration done."
}
$ curl 127.1:8888 | grep 'PHP Version'
...
<h1 class="p">PHP Version 7.1.23</h1>
$ curl -X PUT -d '"php 7.2.11"' 127.1:8443/config/applications/php/type    
{
        "success": "Reconfiguration done."
}
$ curl 127.1:8888 | grep 'PHP Version'
...
<h1 class="p">PHP Version 7.2.11</h1>

@actopolus
Copy link
Author

Nope, it isn't browser cache

grep module unit.log
2019/07/24 15:41:03 [notice] 13264#13264 module: php 7.2.15-0ubuntu0.18.04.1 "/usr/lib/unit/modules/php.unit.so"
2019/07/24 15:41:03 [notice] 13264#13264 module: php 7.1.30-1+ubuntu18.04.1+deb.sury.org+1 "/usr/lib/unit/modules/php71.unit.so"

curl --unix-socket /var/run/control.unit.sock http://localhost/config
{
	"listeners": {
		"*:8300": {
			"application": "exa"
		},
		"*:9090": {
			"pass": "applications/exa"
		}
	},
	"applications": {
		"exa": {
			"type": "php 7.1",
			"processes": 20,
			"user": "www-data",
			"group": "www-data",
			"root": "/var/www/exa/applications/web",
			"script": "index.php",
			"environment": {
				"APPLICATION_TYPE": "applications",
				"APPLICATION_ENV": "Testing"
			}
		}
	}
}

curl 127.1:9090 | grep 'PHP Version'
PHP Version 7.3.7-1+ubuntu18.04.1+deb.sury.org+1

curl 127.1:8300 | grep 'PHP Version'
PHP Version 7.3.7-1+ubuntu18.04.1+deb.sury.org+1

Moreover, there isn't module with php 7.3 in discovery log and modules folder, but it picked

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

@actopolus Could you show output of $ /usr/bin/php-config7.1 and $ /usr/bin/php-config7.2?

@actopolus
Copy link
Author

actopolus commented Jul 24, 2019

@VBart

PHP 7.1

Options:
  --prefix            [/usr]
  --includes          [-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 ]
  --ldflags           [-L/usr/lib/php/20160303  -L/usr/lib/x86_64-linux-gnu]
  --libs              [-lcrypt   -lresolv -lcrypt -lz -lpcre -lrt -lm -ldl -lnsl  -lxml2 -lssl -lcrypto -lcrypt -lcrypt ]
  --extension-dir     [/usr/lib/php/20160303]
  --include-dir       [/usr/include/php/20160303]
  --man-dir           [/usr/share/man]
  --php-binary        [/usr/bin/php7.1]
  --php-sapis         [apache2handler embed cgi cli fpm ]
  --phpapi            [20160303]
  --configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/7.1/cli --with-config-file-scan-dir=/etc/php/7.1/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/build/php7.1-skXqsH/php7.1-7.1.30/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/7.1 --program-suffix=7.1 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl=yes --with-pcre-regex=/usr --enable-hash --with-mhash=/usr --enable-libxml --enable-session --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-dtrace --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fdebug-prefix-map=/build/php7.1-skXqsH/php7.1-7.1.30=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -g]
  --version           [7.1.30-1+ubuntu18.04.1+deb.sury.org+1]
  --vernum            [70130]

PHP 7.2

  --prefix            [/usr]
  --includes          [-I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib ]
  --ldflags           [-L/usr/lib/php/20170718  -L/usr/lib/x86_64-linux-gnu]
  --libs              [-lcrypt   -largon2 -lresolv -lcrypt -lz -lpcre -lrt -lm -ldl -lnsl  -lxml2 -lssl -lcrypto -lsodium -lcrypt -largon2 -largon2 -lcrypt ]
  --extension-dir     [/usr/lib/php/20170718]
  --include-dir       [/usr/include/php/20170718]
  --man-dir           [/usr/share/man]
  --php-binary        [/usr/bin/php7.2]
  --php-sapis         [embed cli ]
  --phpapi            [20170718]
  --configure-options [--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --disable-silent-rules --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --disable-phpdbg --with-config-file-path=/etc/php/7.2/cli --with-config-file-scan-dir=/etc/php/7.2/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --config-cache --cache-file=/build/php7.2-IYpx4e/php7.2-7.2.20/config.cache --libdir=${prefix}/lib/php --libexecdir=${prefix}/lib/php --datadir=${prefix}/share/php/7.2 --program-suffix=7.2 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-filter --with-openssl=yes --with-password-argon2=/usr --with-pcre-regex=/usr --enable-hash --with-mhash=/usr --enable-libxml --enable-session --with-sodium --with-system-tzdata --with-zlib=/usr --with-zlib-dir=/usr --enable-dtrace --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fdebug-prefix-map=/build/php7.2-IYpx4e/php7.2-7.2.20=. -fstack-protector-strong -Wformat -Werror=format-security -O2 -Wall -pedantic -fsigned-char -fno-strict-aliasing -g]
  --version           [7.2.20-1+ubuntu18.04.1+deb.sury.org+1]
  --vernum            [70220]

P.S.: php-config for php 7.2 was reinstalled because of testing other cases

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

@actopolus Could you also provide the output of commands below?

$ strings /usr/lib/php/7.1/sapi/libphp7.so | grep -F 7.
$ strings /usr/lib/php/7.2/sapi/libphp7.so | grep -F 7.

@actopolus
Copy link
Author

actopolus commented Jul 24, 2019

@VBart, there aren't libphp in sapi. They are in /usr/lib (is it possible problem?)

strings /usr/lib/libphp7.1.so | grep -F 7.
libphp7.so
7.1.30-1+ubuntu18.04.1+deb.sury.org+1
/build/php7.1-skXqsH/php7.1-7.1.30/ext/date/lib/parse_date.c
/build/php7.1-skXqsH/php7.1-7.1.30/ext/openssl/openssl.c
/build/php7.1-skXqsH/php7.1-7.1.30/ext/openssl/xp_ssl.c
/build/php7.1-skXqsH/php7.1-7.1.30/ext/session/mod_user_class.c
/build/php7.1-skXqsH/php7.1-7.1.30/ext/session/mod_user.c
/etc/php/7.1/embed
7.1.30-1+ubuntu18.04.1+deb.sury.sp|l
/build/php7.1-skXqsH/php7.1-7.1.30/ext/standard/assert.c
/build/php7.1-skXqsH/php7.1-7.1.30/main/main.c
X-Powered-By: PHP/7.1.30-1+ubuntu18.04.1+deb.sury.org+1
/usr/share/php/7.1
/etc/php/7.1/embed/conf.d
/build/php7.1-skXqsH/php7.1-7.1.30/main/streams/userspace.c
/build/php7.1-skXqsH/php7.1-7.1.30/Zend/zend_alloc.c
/build/php7.1-skXqsH/php7.1-7.1.30/Zend/zend_execute_API.c
/build/php7.1-skXqsH/php7.1-7.1.30/Zend/zend_objects_API.c
/build/php7.1-skXqsH/php7.1-7.1.30/Zend/zend_vm_execute.h
strings /usr/lib/libphp7.2.so | grep -F 7.
libphp7.so
2017.09
7.2.20-1+ubuntu18.04.1+deb.sury.org+1
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/date/lib/parse_date.c
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/openssl/openssl.c
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/openssl/xp_ssl.c
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/session/mod_user_class.c
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/session/mod_user.c
/etc/php/7.2/embed
7.2.20-1+ubuntu18.04.1+deb.sury.IPTC data too large
/build/php7.2-IYpx4e/php7.2-7.2.20/ext/standard/assert.c
/build/php7.2-IYpx4e/php7.2-7.2.20/main/main.c
X-Powered-By: PHP/7.2.20-1+ubuntu18.04.1+deb.sury.org+1
/usr/share/php/7.2
/etc/php/7.2/embed/conf.d
/build/php7.2-IYpx4e/php7.2-7.2.20/main/streams/userspace.c
/build/php7.2-IYpx4e/php7.2-7.2.20/Zend/zend_alloc.c
/build/php7.2-IYpx4e/php7.2-7.2.20/Zend/zend_execute_API.c
/build/php7.2-IYpx4e/php7.2-7.2.20/Zend/zend_vm_execute.h

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

@actopolus Yes, it's the cause of problem. While building modules you've specified --lib-path=/usr/lib/php/7.2/sapi, but as there is no libphp7.so in this path your system loader uses php library located in default system paths (which appears to be 7.3).

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

You can fix the problem by creating symlinks /usr/lib/php/7.1/sapi/libphp7.so -> /usr/lib/libphp7.1.so and /usr/lib/php/7.2/sapi/libphp7.so -> /usr/lib/libphp7.2.so.

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

Avoiding --lib-path= or specifying --lib-path=/usr/lib/ won't work in your case because Unit uses only the first version number in library name: -lphp7 as the only option on most systems.

@VBart
Copy link
Contributor

VBart commented Jul 24, 2019

Also from output of strings command, it seems both libraries libphp7.1.so and libphp7.2.so have identical soname libphp7.so, so there's no way for loader to differentiate them in the same directory.

@actopolus
Copy link
Author

@VBart, ok, thank you. I'll try.

@actopolus
Copy link
Author

You can fix the problem by creating symlinks /usr/lib/php/7.1/sapi/libphp7.so -> /usr/lib/libphp7.1.so and /usr/lib/php/7.2/sapi/libphp7.so -> /usr/lib/libphp7.2.so.

It's solution! Thank you!

@skillslasher
Copy link

skillslasher commented Sep 3, 2019

The same problem arose with connecting the php module. Unit was assembled from source with php7.3 module. As a result, I can’t load the configuration.

"error": "Invalid configuration.",
"detail": "The module to run "php73" is not found among the available application modules."

Ubuntu System Version 18.04.3 LTS
Unit assembly options:

./configure \
	--openssl \
	--group=www-data \
	--user=www-data \
	--no-ipv6 \
	--prefix=/etc/unit/ \
	--state=/var/lib/unit \
	--bindir=/usr/bin/ \
	--sbindir=/usr/sbin/ \
	--control=unix:/run/ctrl.unit.sock \
	--incdir=/usr/include/ \
	--libdir=/usr/lib/ \
	--log=/var/log/unit.log \
	--pid=/run/unit.pid \
	--modules=/usr/lib/unit/modules/

Php 7.3 module build options:

./configure php --module=php73 \
    --config=/usr/bin/php-config7.3 \
    --lib-path=/usr/lib/php/7.3/

When building on a similar test machine through checkinstall in the .deb package and then installing it on a working machine, everything was packed. But after installing on the working machine, libphp7.so did not appear which I received later by installing libphp7.3-embed and no /usr/bin/php-config7.3 on the system. Please tell me what is wrong with the assembly. And is it possible to solve this problem without assembling Unit again.
P.S. Do I understand correctly. If the module has a name in the php73.unit.so system, then do you need to specify php73 in the configuration?

@VBart
Copy link
Contributor

VBart commented Sep 3, 2019

The same problem arose with connecting the php module. Unit was assembled from source with php7.3 module. As a result, I can’t load the configuration.

"error": "Invalid configuration.",
"detail": "The module to run "php73" is not found among the available application modules."

This won't work as you have specified php version 73.*.*, instead of 7.3.*.

When building on a similar test machine through checkinstall in the .deb package and then installing it on a working machine, everything was packed. But after installing on the working machine, libphp7.so did not appear which I received later by installing libphp7.3-embed and no /usr/bin/php-config7.3 on the system. Please tell me what is wrong with the assembly.

Please check the HowTo on building module packages:
https://unit.nginx.org/howto/modules/#deb-packages

Do I understand correctly. If the module has a name in the php73.unit.so system, then do you need to specify php73 in the configuration?

No, it's absolutely irrelevant. The filename doesn't matter at all. You have to specify application type and (optionally) actual version of the module. See the documentation on the type option: https://unit.nginx.org/configuration/#applications

@skillslasher
Copy link

I have previously used this manual. I could not build the php7.3 module.
Unit Flags:

./configure \
	--prefix=/usr \
	--state=/var/lib/unit \
	--control=unix:/var/run/control.unit.sock \
	--pid=/var/run/unit.pid \
	--log=/var/log/unit.log \
	--tests --openssl \
	--modules=/usr/lib/unit/modules \
	--libdir=/usr/lib/x86_64-linux-gnu \
	--cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.10.0/pkg/deb/debuild/unit-1.10.0=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
	--ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

Flags php module:

./configure php --module=php7.3 --config=php-config
	make php7.3

Error log during make:

build/echo '#define NXT_VERSION "1.10.0"' > build/nxt_version.h
build/echo '#define NXT_VERNUM  11000' >> build/nxt_version.h
cc -c -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g -g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.10.0/pkg/deb/debuild/unit-1.10.0=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC  -I src -I build   \
                      \
                     \
-o build/src/nxt_unit.o \
-MMD -MF build/src/nxt_unit.dep -MT build/src/nxt_unit.o \
src/nxt_unit.c
cc -c -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-prototypes -Werror -g -g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.10.0/pkg/deb/debuild/unit-1.10.0=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC  -I src -I build -I/usr/include/php/20180731 -I/usr/include/php/20180731/main -I/usr/include/php/20180731/TSRM -I/usr/include/php/20180731/Zend -I/usr/include/php/20180731/ext -I/usr/include/php/20180731/ext/date/lib \
-DNXT_ZEND_SIGNAL_STARTUP=1 \
-MMD -MF build/src/nxt_php_sapi-php7.3.dep -MT build/src/nxt_php_sapi-php7.3.o \
-o build/src/nxt_php_sapi-php7.3.o src/nxt_php_sapi.c
cc -shared -o build/php7.3.unit.so \
build/src/nxt_unit.o build/src/nxt_php_sapi-php7.3.o -lphp7  -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
build/src/nxt_unit.o: In function `nxt_unit_port_hash_find':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3981: undefined reference to `nxt_lvlhsh_delete'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3984: undefined reference to `nxt_lvlhsh_find'
build/src/nxt_unit.o: In function `nxt_unit_port_hash_lhq':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3930: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o: In function `nxt_unit_request_hash_find':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:4051: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:4058: undefined reference to `nxt_lvlhsh_delete'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:4061: undefined reference to `nxt_lvlhsh_find'
build/src/nxt_unit.o: In function `nxt_unit_process_lhq_pid':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3066: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o: In function `nxt_unit_process_find':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3145: undefined reference to `nxt_lvlhsh_delete'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3148: undefined reference to `nxt_lvlhsh_find'
build/src/nxt_unit.o: In function `nxt_unit_port_id_init':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o:/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3066: more undefined references to `nxt_murmur_hash2' follow
build/src/nxt_unit.o: In function `nxt_unit_process_get':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3084: undefined reference to `nxt_lvlhsh_find'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3111: undefined reference to `nxt_lvlhsh_insert'
build/src/nxt_unit.o: In function `nxt_unit_port_hash_add':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3957: undefined reference to `nxt_lvlhsh_insert'
build/src/nxt_unit.o: In function `nxt_unit_port_hash_lhq':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3930: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o: In function `nxt_unit_port_id_init':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o: In function `nxt_unit_request_hash_add':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:4023: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:4031: undefined reference to `nxt_lvlhsh_insert'
build/src/nxt_unit.o: In function `nxt_unit_port_id_init':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3378: undefined reference to `nxt_murmur_hash2'
build/src/nxt_unit.o: In function `nxt_unit_process_websocket':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:978: undefined reference to `nxt_websocket_frame_payload_len'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:981: undefined reference to `nxt_websocket_frame_header_size'
build/src/nxt_unit.o: In function `nxt_unit_websocket_sendv':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:2291: undefined reference to `nxt_websocket_frame_init'
build/src/nxt_unit.o: In function `nxt_unit_process_pop_first':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_unit.c:3168: undefined reference to `nxt_lvlhsh_retrieve'
build/src/nxt_unit.o:(.data.rel.ro+0x20): undefined reference to `nxt_lvlhsh_alloc'
build/src/nxt_unit.o:(.data.rel.ro+0x28): undefined reference to `nxt_lvlhsh_free'
build/src/nxt_unit.o:(.data.rel.ro+0x60): undefined reference to `nxt_lvlhsh_alloc'
build/src/nxt_unit.o:(.data.rel.ro+0x68): undefined reference to `nxt_lvlhsh_free'
build/src/nxt_unit.o:(.data.rel.ro+0xa0): undefined reference to `nxt_lvlhsh_alloc'
build/src/nxt_unit.o:(.data.rel.ro+0xa8): undefined reference to `nxt_lvlhsh_free'
build/src/nxt_php_sapi-php7.3.o: In function `nxt_php_register_variables':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:868: undefined reference to `nxt_server'
build/src/nxt_php_sapi-php7.3.o: In function `nxt_php_disable':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:505: undefined reference to `nxt_malloc'
build/src/nxt_php_sapi-php7.3.o: In function `nxt_php_set_options':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:382: undefined reference to `nxt_conf_next_object_member'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:387: undefined reference to `nxt_conf_get_string'
build/src/nxt_php_sapi-php7.3.o: In function `nxt_php_request_handler':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:619: undefined reference to `nxt_malloc'
build/src/nxt_php_sapi-php7.3.o: In function `nxt_php_init':
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:272: undefined reference to `nxt_malloc'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:298: undefined reference to `nxt_conf_get_object_member'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:301: undefined reference to `nxt_conf_get_string'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:303: undefined reference to `nxt_malloc'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:318: undefined reference to `nxt_conf_get_object_member'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:321: undefined reference to `nxt_conf_get_object_member'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:334: undefined reference to `nxt_pid'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:334: undefined reference to `nxt_runtime_port_find'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:344: undefined reference to `nxt_fd_blocking'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:352: undefined reference to `nxt_fd_blocking'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:224: undefined reference to `nxt_malloc'
/tmp/unit.ZEyojT/unit-1.10.0/src/nxt_php_sapi.c:253: undefined reference to `nxt_malloc'
collect2: error: ld returned 1 exit status
build/Makefile:1654: recipe for target 'build/php7.3.unit.so' failed
make: *** [build/php7.3.unit.so] Error 1

Tell me how to solve, please.

@VBart
Copy link
Contributor

VBart commented Sep 4, 2019

I have previously used this manual. I could not build the php7.3 module.
Unit Flags:

./configure \
	--prefix=/usr \
	--state=/var/lib/unit \
	--control=unix:/var/run/control.unit.sock \
	--pid=/var/run/unit.pid \
	--log=/var/log/unit.log \
	--tests --openssl \
	--modules=/usr/lib/unit/modules \
	--libdir=/usr/lib/x86_64-linux-gnu \
	--cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.10.0/pkg/deb/debuild/unit-1.10.0=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
	--ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

The problem caused by using -pie in your linker flags. You can't use PIE flag while building a shared object module. You should remove it:

./configure \
	--prefix=/usr \
	--state=/var/lib/unit \
	--control=unix:/var/run/control.unit.sock \
	--pid=/var/run/unit.pid \
	--log=/var/log/unit.log \
	--tests --openssl \
	--modules=/usr/lib/unit/modules \
	--libdir=/usr/lib/x86_64-linux-gnu \
	--cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/unit-1.10.0/pkg/deb/debuild/unit-1.10.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' \
	--ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed'

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

3 participants