You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pagespeed.apache.org by GitBox <gi...@apache.org> on 2021/11/07 06:13:32 UTC

[GitHub] [incubator-pagespeed-mod] acachy edited a comment on issue #2069: PSOL with bazel

acachy edited a comment on issue #2069:
URL: https://github.com/apache/incubator-pagespeed-mod/issues/2069#issuecomment-962558016


   > @acachy how did you manage to build?
   > 
   > I get a lot of errors like this: pagespeed/kernel/base/string_util.cc: In function 'GoogleString net_instaweb::internal::StrCatNineOrMore(const StringPiece*, ...)': pagespeed/kernel/base/string_util.cc:110:3: error: 'va_start' was not declared in this scope
   
   @eilandert, looks like you've already moved far enough in #2084
   
   My previous attempts were forgotten because of fail at the end...
   So I tried again on latest commit and here is a part of my deploy script for Debian, if you wanna try to repeate. Sorry for a lot of trash ways inside
   
   1. Prepare dir with sources
   ```
   echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" >> /etc/apt/sources.list
   wget --no-check-certificate -qO - https://bazel.build/bazel-release.pub.gpg | apt-key add - 2>&1
   apt-get install -y bazel-4.1.0
   apt-get install -y ninja-build 
   mkdir -p /usr/share/man/man1
   apt-get install -y openjdk-11-jre-headless
   
   mkdir /ngx
   cd /ngx
   wget https://github.com/nginx/nginx/archive/release-1.19.10.tar.gz
   tar xzf *gz
   rm *gz
   
   git clone https://github.com/apache/incubator-pagespeed-ngx.git
   cd incubator-pagespeed-ngx
   git reset --hard 9e70f6d
   git config --global url.https://github.com/apache/.insteadOf git://git.apache.org/
   git submodule update --init --recursive --jobs=16 --force
   cd ..
   
   git clone --recursive https://github.com/apache/incubator-pagespeed-mod.git
   cd incubator-pagespeed-mod
   git reset --hard 6199d78
   ```
   
   2. Bazel-build with few hacks 
   ```
   sed -i '1s/^/#include <cstdarg>\n/' pagespeed/kernel/base/string_util.cc
   bazel build -c fastbuild //pagespeed/kernel/... //pagespeed/automatic/... //pagespeed/system/... //pagespeed/controller/... //pagespeed/opt/... //base/... //net/instaweb/... //third_party/... mod_pagespeed
   sed -i -r 's/sys_siglist\[signum\]/strsignal(signum)/g' ./bazel-bin/../../../../../external/apr/threadproc/unix/signals.c
   bazel build -c fastbuild //pagespeed/kernel/... //pagespeed/automatic/... //pagespeed/system/... //pagespeed/controller/... //pagespeed/opt/... //base/... //net/instaweb/... //third_party/... mod_pagespeed
   ```
   
   3. Update pagespeed/automatic/bazel_merge.sh
   - Skip Envoy 
   - Change final destination path for lib
   
   ```
   #!/bin/bash
   
   ADIR=$(bazel info bazel-bin)
   ALIST=$(find $ADIR | grep \\.a$ | grep -v main | grep -v copy | grep -v envoy | xargs echo)
   
   for item in ${ALIST[*]}
   do
   echo $item
   done
   
   find $ADIR | grep \\.a$ | grep -v main | grep -v copy
   
   set -e
   echo "merging libs"
   ./merge_libraries.sh ~/pagespeed_automatic.a.dirty $ALIST > merge.log
   
   echo "renaming symbols"
   
   # XXX(oschaaf): objcopy 2.31 doesn't like clang-7's output unless we pass in -fno-addrsig
   # https://github.com/travitch/whole-program-llvm/issues/75
   # not passing this in will make the scripts that rename symbols fail
   ./rename_c_symbols.sh ~/pagespeed_automatic.a.dirty ~/pagespeed_automatic.a > symbol-rename.log
   rm ~/pagespeed_automatic.a.dirty
   cp ~/pagespeed_automatic.a ./../../bazel-out/k8-fastbuild/bin/pagespeed/automatic/
   mv ~/pagespeed_automatic.a ./
   echo "done"
   ```
   
   4. Create pagespeed_automatic.a
   ```
   cd pagespeed/automatic
   bash bazel_merge.sh
   ```
   
   5. Try to build nginx
   ```
   cd /ngx/nginx-release-1.19.10
   MOD_PAGESPEED_DIR="/ngx/incubator-pagespeed-mod" ./auto/configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --w
 ith-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_perl_module=dynamic --add-module=/ngx/incubator-pagespeed-ngx
   ```
   
   6. There are include-errors that can be seen in details at the end of ./objs/autoconf.err 
   I fix it step-by-step by searching paths with missing files and adding extra include-dirs to /ngx/incubator-pagespeed-ngx/config
   After few steps I have include rule like this:
   ```
   pagespeed_include="\
     $mod_pagespeed_dir \
     $mod_pagespeed_dir/third_party/chromium/src \
     $mod_pagespeed_dir/third_party/google-sparsehash/src/src \
     $mod_pagespeed_dir/third_party/google-sparsehash/gen/arch/$os_name/$arch_name/include \
     $mod_pagespeed_dir/third_party/grpc/src/include \
     $mod_pagespeed_dir/third_party/protobuf/src/src \
     $mod_pagespeed_dir/third_party/re2/src \
     $mod_pagespeed_dir/out/$buildtype/obj/gen \
     $mod_pagespeed_dir/out/$buildtype/obj/gen/protoc_out/instaweb \
     $mod_pagespeed_dir/third_party/apr/src/include \
     $mod_pagespeed_dir/third_party/aprutil/src/include \
     $mod_pagespeed_dir/third_party/apr/gen/arch/$os_name/$arch_name/include \
     $mod_pagespeed_dir/third_party/aprutil/gen/arch/$os_name/$arch_name/include \
     $mod_pagespeed_dir/bazel-out/../../../external/com_google_absl \
     $mod_pagespeed_dir/bazel-out/k8-fastbuild/bin/external/com_github_gflags_gflags/_virtual_includes/gflags \
     $mod_pagespeed_dir/bazel-out/k8-fastbuild/bin/external/glog/_virtual_includes/default_glog_headers \
     $mod_pagespeed_dir/bazel-out/k8-fastbuild/bin/external/google_sparsehash/_virtual_includes/google_sparsehash \
     $mod_pagespeed_dir/url"
   ```
   
   And my last error on attempt to use auto/configure:
   ```
   ...
   /usr/bin/ld: doctype.cc:(.text+0x430): undefined reference to `google::LogMessageFatal::~LogMessageFatal()'
   collect2: error: ld returned 1 exit status
   ```
   
   Probably we should use other include-paths (for most files there are different copies in different dirs) or better ways to fix include-errors
   I have no significant knowledge here, just tried to fix everything that I've seen


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@pagespeed.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org