LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Building PHP-7.3 and PHP-7.4 on Slackware-14.2 (https://www.linuxquestions.org/questions/slackware-14/building-php-7-3-and-php-7-4-on-slackware-14-2-a-4175671161/)

andrixnet 03-11-2020 04:40 PM

Building PHP-7.3 and PHP-7.4 on Slackware-14.2
 
Can anyone please help me with build instructions / scripts to build PHP-7.3.x and PHP-7.4.x respectively on Slackware-14.2 ?

Thank you.

ehartman 03-11-2020 05:10 PM

Quote:

Originally Posted by andrixnet (Post 6099599)
Can anyone please help me with build instructions / scripts to build PHP-7.3.x and PHP-7.4.x respectively on Slackware-14.2 ?

As far as I know (but someone will correct me when I'm wrong, I'm sure <grin>) you cannot, the support libraries PHP-7 needs just aren't there for 14.2, it is too old for that.
So you will have to update to -current for PHP 7, it has 7.4.3 already built.

astrogeek 03-11-2020 05:31 PM

I have built and deployed PHP-7.x beginning from PHP-7.1 through PHP-7.4.2, including some 7.3 updates, on Slackware 14.2 (both 32 and 64 bit), although I have not kept separate build notes for 7.3.x and 7.4.x.

I began with the Slackbuild Patrick posted to your previous thread, modified options to suit my uses, installed a few required packages as needed to resolve build errors, and have had no problems.

In upgrading since the 7.1 build I have had to build and install the following, but not sure which was for a specific PHP version:

alpine (Not sure where I got Slackbuild, try -current)
libsodium (get it from SBo)
oniguruma (SBo)
pcre2 (Built using Slackbuild from -current)
libedit (From -current)

So, to summarize:

1. Get Slackbuild from the link provided by Patrick included above
2. Install above dependencies, possibly others, as indicated by build errors and READMEs

Hope this is enough to get you started, ask here if you encounter anything you cannot resolve!

And perhaps others with more specific knowledge of the requirements will chime in here too.

Good luck!

(Updated to correct original Slackbuild source)
ADDITIONAL COMMENTS: Sorry for posting this piecemeal, that kind of day...

I got around to my build system and looked into how I have actually been doing this instead of reliance on snapshots from memory...

At 7.2.11 I did indeed switch to using the Slackbuild from -current with the following important change (also PHP >7.2 requires libsodium):

Code:

--with-readline
# --without-readline
# --with-libedit

At 7.3 I tested building with libedit and made the switch by building and installing libedit using the Slackbuild from -current. But I continue to build with earlier Alpine and make this change:

Code:

#ALPINE=2.21
ALPINE=2.20

It appears I added pcre2 at 7.4 and removed a few compile options such as --with-gd, --enable-wddx --enable-zip. Run .configure and check the resulting config.log. I also added oniguruma from SBo at 7.4.

I have made a few other changes to the build options in the Slackbuild, but nothing noteworthy that I am aware of. The main point I would make is that PHP up to 7.4.2 builds and works easily on Slackware 14.2 with only a few added dependencies and simple tweaking of the Slackbuild from -current. Just look at the config.log and build errors to sort out the necessary additions and changes - no secret sauce to add that I have encountered!

ljb643 03-12-2020 06:38 PM

I built php-7.3.14 and 7.4.2 on Slackware-14.2 with no extra libraries needed. (Going to upgrade to 7.3.15 and 7.4.3 soon.)

It all depends on what PHP extensions you need. If you are packaging PHP for other people to use, like Slackware and Slackbuilds does, you probably want as many extensions as possible, to give end users a wide range. That's going to be hard, and you will need extra libraries and dependencies. But if you are building it for yourself, for your own server, you should have a good idea of what extensions you need. Building PHP with only the extensions you need cuts way down on the dependencies. And remember, it is possible to build and add extensions later without recompiling all of PHP.

The only change I had to make to build php-7.3 and php-7.4 versus older versions was to add --with-pic to the configure command. Otherwise, the final link fails with "read-only segment has dynamic IFUNC relocations; recompile with -fPIC". Don't know what that really means, but the fix worked.

andrixnet 03-14-2020 02:55 AM

Thank you very much.
I will try to document my progress (in the hope it will also help others).

andrixnet 05-03-2020 03:37 AM

Trying to build php-7.3.17 using the php-7.4 build script from -current:
  • pcre2 is a requried dependency (installed via SBo)
  • libedit is a required dependency (installed via SBo)
  • libsodium is a required dependency (installed via SBo)
  • argon2 is a required dependency (installed via SBo)

I preferred to install dependencies rather then configure them out.

It builds without oniguruma as a requirement, one may add it from SBo at your desire.

@astrogeek: thank you very much for your recommendations.

PROBLEMCHYLD 05-05-2020 07:45 PM

1 Attachment(s)
I use this method and everything is working well

https://www.linuxquestions.org/quest...6/#post6080766

andrixnet 04-30-2021 02:30 AM

Trying to build PHP-7.4 today on Slackware-14.2 got a lot easier.

Dependencies:
  • pcre2
  • libedit
  • libsodium
  • oniguruma
  • argon2
  • tidy-html5


They can be build using either SBo or build scripts from -current in L section. Install each library.


You will need alpine version 2.24 (also found in -current) in N section, package source only.

You should check /usr/local/lib(64)? for directory named c-client. If present, remove it before building. (not removing it will result in errors if it is from an older alpine)

Build PHP-7.4 using build script from -current.

Stop Apache: /etc/rc.d/rc.httpd stop
Install new PHP package. Overwrite (or merge) /etc/php.ini.new -> /etc/php.ini
Start Apache: /etc/rc.d/rc.httpd start

Check /var/log/httpd/error_log to confirm PHP module load was successful.

Indus.Lord 05-03-2021 07:54 AM

Apline ldap failure during php-7.4 on slackware 14.2
 
Trying to use nextcloud, hence landed here to upgrade php on 14.2 slack.

Checked/got all dependencies, as mentioned by @andrixnet got alpine 2.4 and php-7.4 from -current.

But both alpine and hence php builds fail due to


Code:


/bin/sh ../libtool  --tag=CC  --mode=link gcc -pthread -O2 -fPIC  -L/usr/lib  -o pico main.o utf8stub.o ../c-client/utf8.o libpico.a osdep/libpicoosd.a ../pith/osdep/libpithosd.a ../pith/charconv/libpithcc.a  -lcrypt -lldap -lssl -lcrypto -ldl  -lncurses -llber
libtool: link: gcc -pthread -O2 -fPIC -o pico main.o utf8stub.o ../c-client/utf8.o  -L/usr/lib libpico.a osdep/libpicoosd.a ../pith/osdep/libpithosd.a ../pith/charconv/libpithcc.a -lcrypt /usr/lib/libldap.so /usr/lib/libsasl2.so -lssl -lcrypto -ldl -lncurses /usr/lib/liblber.so -lresolv -pthread
/usr/lib/libldap.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:526: recipe for target 'pico' failed
make[3]: *** [pico] Error 1
make[3]: Leaving directory '/tmp/alpine-2.24/pico'
Makefile:593: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1


willysr 05-03-2021 08:37 AM

are you using wrong package for ldap-client?
The error message file in wrong format usually happened when you install a package for different architecture

Indus.Lord 05-03-2021 08:55 AM

Initially I thought it's because "usr/lib" and "usr/lib64" but doesn't look like it.

Code:

bash-4.3$ cd ../lib64/
bash-4.3$ ll liblda*
-rw-r--r-- 1 root root    877 Oct 23  2015 libldap.la
-rw-r--r-- 1 root root    898 Oct 23  2015 libldap_r.la
-rwxr-xr-x 1 root root 326112 Oct 23  2015 libldap_r-2.4.so.2.10.5
-rwxr-xr-x 1 root root 300704 Oct 23  2015 libldap-2.4.so.2.10.5
lrwxrwxrwx 1 root root    23 Dec  6 12:22 libldap_r.so -> libldap_r-2.4.so.2.10.5
lrwxrwxrwx 1 root root    23 Dec  6 12:22 libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.10.5
lrwxrwxrwx 1 root root    21 Dec  6 12:22 libldap.so -> libldap-2.4.so.2.10.5
lrwxrwxrwx 1 root root    21 Dec  6 12:22 libldap-2.4.so.2 -> libldap-2.4.so.2.10.5
bash-4.3$ pwd
/usr/lib64
bash-4.3$ cd ../lib

bash-4.3$ ll liblda*
-rw-r--r-- 1 root root    871 Oct 26  2015 libldap.la
-rw-r--r-- 1 root root    892 Oct 26  2015 libldap_r.la
-rwxr-xr-x 1 root root 329552 Oct 26  2015 libldap_r-2.4.so.2.10.5
-rwxr-xr-x 1 root root 303728 Oct 26  2015 libldap-2.4.so.2.10.5
lrwxrwxrwx 1 root root    23 Feb 12 09:33 libldap_r.so -> libldap_r-2.4.so.2.10.5
lrwxrwxrwx 1 root root    21 Feb 12 09:33 libldap.so -> libldap-2.4.so.2.10.5
lrwxrwxrwx 1 root root    21 Feb 12 09:33 libldap-2.4.so.2 -> libldap-2.4.so.2.10.5
lrwxrwxrwx 1 root root    23 Feb 12 09:33 libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.10.5
bash-4.3$

Package installed should be openldap-client-2.4.42

Code:


slackpkg search ldap

Looking for ldap in package list. Please wait... DONE

The list below shows all packages with name matching "ldap".

[ installed ] - openldap-client-2.4.42-x86_64-1


andrixnet 05-03-2021 12:46 PM

Quote:

Originally Posted by Indus.Lord (Post 6247513)
Trying to use nextcloud, hence landed here to upgrade php on 14.2 slack.

Checked/got all dependencies, as mentioned by @andrixnet got alpine 2.4 and php-7.4 from -current.

But both alpine and hence php builds fail due to


Code:

/usr/lib/libldap.so: error adding symbols: File in wrong format

Have you checked this: https://www.linuxquestions.org/quest...at-4175439373/ ?

My build experience is on x64 machine, all libraries are in lib64 directories.
lib{$LIBDIRSUFFIX} where $LIBDIRSUFFIX=64 (detected in an if block depending on $ARCH). Do check out your architecture and the results of the tests. Or maybe you have a wrong package installed (built for x86 on a x64 system and only now surfaced? dunno)

bassmadrigal 05-03-2021 01:30 PM

There is no /usr/lib/ldap* on the 64bit package, so if you have it and that's what the program is trying to use, then it is probably from a compat32 package. In that case, you might need to follow the multilib FAQ entry on SBo to get it to compile (or temporarily remove the compat32 openldap package during compilation).

Indus.Lord 05-03-2021 05:15 PM

Thank you very much both @andrixnet and @bassmadrigal

Not just LDFLAGS I had to push in additional configure flags to get alpine slackbuild to successfully complete

Code:

-- I edited alpine.Slackbuild and pushed in

  --with-ldap-lib-dir=/usr/lib64 \
  --with-ssl-lib-dir=/usr/lib64 \

That way I was able to get over the 32 bit lib being used

Now that alpine is done, on to PHP :-)


All times are GMT -5. The time now is 10:49 AM.