Open Dreamsorcerer opened 8 months ago
@oschaaf Do you have the download link for the latest release?
Hmm, that is weird.. I could probably re-create the archive(s) and host them somewhere .. but this might resolve itself at some point in the future. Having said that, for ngx_pagespeed, one can just take the code as at is at latest commit on the main branch and use that instead... it's a long while ago but I think you can do that via
git clone git@github.com:WeAmp/ngx_pagespeed.git
cd ngx_pagespeed/
git checkout <branch>
scripts/build_ngx_pagespeed.sh [options]
I could probably re-create the archive(s) and host them somewhere
The apache-hosted ones are still available, but the last release was 7 years ago. In the changelog, it appears there is a post-apache release about 4 years ago, but no download links are given.
I'll try building it from master (I initially tried cloning it, but wasn't sure what other steps were needed).
Well, the branches on this repository only include releases from 10+ years ago...
Looks like some of the dependencies need to be updated to build from source:
$ scripts/build_ngx_pagespeed.sh -ms -b /path/to/build
Detected that we're running in an existing ngx_pagespeed checkout.
Detected debian-based distro.
Operating system dependencies are all set.
Cloning into '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/apr/src'...
fatal: unable to connect to git.apache.org:
git.apache.org[0: 65.108.73.173]: errno=Connection refused
git.apache.org[1: 2a01:4f9:6b:49a9::2]: errno=Cannot assign requested address
fatal: clone of 'git://git.apache.org/apr.git' into submodule path '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/apr/src' failed
Failed to clone 'third_party/apr/src'. Retry scheduled
Cloning into '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/aprutil/src'...
fatal: unable to connect to git.apache.org:
git.apache.org[0: 65.108.73.173]: errno=Connection refused
git.apache.org[1: 2a01:4f9:6b:49a9::2]: errno=Cannot assign requested address
fatal: clone of 'git://git.apache.org/apr-util.git' into submodule path '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/aprutil/src' failed
Failed to clone 'third_party/aprutil/src'. Retry scheduled
Cloning into '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/httpd/src'...
fatal: unable to connect to git.apache.org:
git.apache.org[0: 65.108.73.173]: errno=Connection refused
git.apache.org[1: 2a01:4f9:6b:49a9::2]: errno=Cannot assign requested address
fatal: clone of 'git://git.apache.org/httpd.git' into submodule path '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/httpd/src' failed
Failed to clone 'third_party/httpd/src'. Retry scheduled
Cloning into '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/httpd24/src'...
fatal: unable to connect to git.apache.org:
git.apache.org[0: 65.108.73.173]: errno=Connection refused
git.apache.org[1: 2a01:4f9:6b:49a9::2]: errno=Cannot assign requested address
fatal: clone of 'git://git.apache.org/httpd.git' into submodule path '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/httpd24/src' failed
Failed to clone 'third_party/httpd24/src'. Retry scheduled
Cloning into '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/apr/src'...
fatal: unable to connect to git.apache.org:
git.apache.org[0: 65.108.73.173]: errno=Connection refused
git.apache.org[1: 2a01:4f9:6b:49a9::2]: errno=Cannot assign requested address
fatal: clone of 'git://git.apache.org/apr.git' into submodule path '/ngx_pagespeed/testing-dependencies/mod_pagespeed/third_party/apr/src' failed
Failed to clone 'third_party/apr/src' a second time, aborting
fatal: Failed to recurse into submodule path 'testing-dependencies/mod_pagespeed'
/ngx_pagespeed/testing-dependencies/mod_pagespeed /ngx_pagespeed
install/build_env.sh: line 47: install/debian/build_env.sh: No such file or directory
Error: Failure running 'install/build_psol.sh --skip_tests --skip_packaging ', exiting.
So, ngx_pagespeed/testing-dependencies/mod_pagespeed/install/debian/build_env.sh
simply doesn't exist. Maybe I should try copying the one for ubuntu?
The rest of the errors appear to be submodules (ngx_pagespeed/testing-dependencies/mod_pagespeed/.gitmodules
) that are no longer hosted on git.apache.org, not sure what the correct URLs are for them?
The rest of the errors appear to be submodules (
ngx_pagespeed/testing-dependencies/mod_pagespeed/.gitmodules
) that are no longer hosted on git.apache.org, not sure what the correct URLs are for them?
Actually, it looks like mod_pagespeed has already been updated, we just need to change the submodule in ngx_pagespeed to a working version.
Changes I've made so far:
$skip_deps_arg
from build_psol.sh call. (scripts/build_ngx_pagespeed.sh) (Not sure why this was causing an issue, but it always just hit the usage error message and quit when it was present)Now I'm at:
[14:03:36] python3 build/gyp_chromium --depth=.
python3: can't open file '/ngx_pagespeed/testing-dependencies/mod_pagespeed/build/gyp_chromium': [Errno 2] No such file or directory
[14:03:36] Completed with exit status 2
That's awkward. So .. it seems ngx_pagespeed hasn't received much love for a long time. I'm positive it can be done to get it to work against the master branch of mod_pagespeed, as that produces a valid pagespeed_automatic.a
-- but then ngx_pagespeed would need to updated to accommodate all the changes to include c header locations (probably here plus probably in c sources).
So .. after having thought about this a little more, IMHO the only thing that makes sense to invest time into would be this approach. Reviving the old releases seems like a bad idea to me considering the old tooling and especially dependencies. The difference would be being fairly up-to-date instead of lagging behind (too) many years, and another perk is that it would be trivial to absorb further changes to mod_pagespeed.
Unfortunately I didn't get around to do this for a long time even though it has been in the back of my mind, and it looks like I will not have time to have a go at this in the foreseeable future either due to other obligations. Having said that, I think it would be doable for anyone willing to invest time into this.
I too have tried to build from source, giving up trying to run bazel-6.1.0 build -c opt //pagespeed/automatic:automatic
and getting
44.05 INFO: Repository libjpeg_turbo instantiated at:
44.05 /usr/src/modpagespeed/WORKSPACE:5:27: in <toplevel>
44.05 /usr/src/modpagespeed/bazel/repositories.bzl:155:17: in mod_pagespeed_dependencies
44.05 Repository rule http_archive defined at:
44.05 /home/developer/.cache/bazel/_bazel_developer/16bf67fc64820b22d75943c83e371f3a/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
44.40 WARNING: Download from https://chromium.googlesource.com/chromium/deps/libjpeg_turbo/+archive/ab7cd970a83609f98e8542cea8b81e8d92ddab83.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was ca27c4786eff545d41c231d6be85eddf0688aab394babc478964d6a99cf5eb93 but wanted 3a6b383a957d87b4d60b67e2e1a950c695ee3016e817d04a13af05b9a98c6aea
44.40 ERROR: An error occurred during the fetch of repository 'libjpeg_turbo':
44.40 Traceback (most recent call last):
44.40 File "/home/developer/.cache/bazel/_bazel_developer/16bf67fc64820b22d75943c83e371f3a/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
44.40 download_info = ctx.download_and_extract(
44.40 Error in download_and_extract: java.io.IOException: Error downloading [https://chromium.googlesource.com/chromium/deps/libjpeg_turbo/+archive/ab7cd970a83609f98e8542cea8b81e8d92ddab83.tar.gz] to /home/developer/.cache/bazel/_bazel_developer/16bf67fc64820b22d75943c83e371f3a/external/libjpeg_turbo/temp8853581405802437913/ab7cd970a83609f98e8542cea8b81e8d92ddab83.tar.gz: Checksum was ca27c4786eff545d41c231d6be85eddf0688aab394babc478964d6a99cf5eb93 but wanted 3a6b383a957d87b4d60b67e2e1a950c695ee3016e817d04a13af05b9a98c6aea
Which is... interesting... Maybe there was such a severe security issue that they overwrote git history? Not sure.
I did find a binary link!! https://archive.apache.org/dist/incubator/pagespeed/1.14.36.1/x64/psol-1.14.36.1-apache-incubating-x64.tar.gz
Hmm, I can reproduce that mismatch. It's weird, because this used to work in CI. The git commit still exists, but somehow the sha is different, very odd. I vaguely remember seeing this before a long time ago, I think that was another dependency, then this was local to some depending on the geographic location of the client.
It is bypassable by locally updating the hash to the expected value (over at https://github.com/We-Amp/mod_pagespeed/blob/master/bazel/repositories.bzl#L42)
As for building, I would recommend using the docker image defined at https://github.com/We-Amp/mod_pagespeed/blob/dff6f75e9b67175859a58e3ae899294bf00cde1c/.bazelrc#L318
OK, with that download link I got it building, but then I get:
> nginx -t
2024/05/18 13:12:34 [emerg] 992778#992778: dlopen() "/usr/share/nginx/modules/ngx_pagespeed.so" failed (/usr/share/nginx/modules/ngx_pagespeed.so: undefined symbol: pthread_mutex_consistent_np) in /etc/nginx/modules-enabled/50-mod-pagespeed.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
This looks like it's been reported before, and may just need a newer version of PSOL? https://github.com/apache/incubator-pagespeed-mod/issues/2083
In case it's useful, these are my build instructions for Debian, using lxc for the build process:
lxc-create -t download -n nginx -- -d debian -r bookworm -a amd64
lxc-start -n nginx; lxc-attach -n nginx; lxc-stop -n nginx
Running as root in LXC container:
dhclient
apt install build-essential libgd-dev libgeoip-dev libpcre2-dev libperl-dev libssl-dev libxslt1-dev unzip uuid-dev wget zlib1g-dev --no-install-recommends
wget http://deb.debian.org/debian/pool/main/n/nginx/nginx_1.22.1.orig.tar.gz
tar -xf nginx_1.22.1.orig.tar.gz
wget https://github.com/apache/incubator-pagespeed-ngx/archive/latest-stable.zip
unzip latest-stable.zip
cd incubator-pagespeed-ngx-latest-stable/
wget https://archive.apache.org/dist/incubator/pagespeed/1.14.36.1/x64/psol-1.14.36.1-apache-incubating-x64.tar.gz
tar -xzvf psol-1.14.36.1-apache-incubating-x64.tar.gz
cd ../nginx-1.22.1/
./configure --add-dynamic-module=../incubator-pagespeed-ngx-latest-stable # Append output of 'nginx -V' from server. Also add -DNGX_HTTP_HEADERS to end of --with-cc-opt.
# answer n to using release binaries
make modules
exit
Copy module to server:
cd ~/.local/share/lxc/nginx/rootfs/
scp nginx-1.22.1/objs/ngx_pagespeed.so myserver.example:/usr/share/nginx/modules/
On the server, run:
echo 'load_module modules/ngx_pagespeed.so;' > /usr/share/nginx/modules-available/mod-pagespeed.conf
ln -s /usr/share/nginx/modules-available/mod-pagespeed.conf /etc/nginx/modules-enabled/50-mod-pagespeed.conf
On laptop, destroy LXC container once modules are installed and working:
lxc-destroy -n nginx
The linked install instructions appear to need updating: https://www.modpagespeed.com/doc/build_ngx_pagespeed_from_source
e.g. It says to download the release from https://github.com/apache/incubator-pagespeed-ngx/archive/v${NPS_VERSION}.tar.gz But, it doesn't look like the current release is available there: https://github.com/apache/incubator-pagespeed-ngx/archive/v1.14.36.1-stable.tar.gz
The only releases on this Github project are from a decade ago too, so difficult to find the correct download link.