apache / incubator-pagespeed-ngx

Automatic PageSpeed optimization module for Nginx
http://ngxpagespeed.com/
Apache License 2.0
4.37k stars 363 forks source link

Can not build it with nginx 1.20 on CentOS 7.9 #1733

Closed CHN-STUDENT closed 3 years ago

CHN-STUDENT commented 3 years ago

centos 7.9.2009 gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) nginx 1.20.0 libuuid-devel-2.23.2

./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1k --with-pcre=../pcre-8.44 --with-pcre-jit --with-ld-opt=-ljemalloc --add-module=./ngx_brotli --add-module=./incubator-pagespeed-ngx
checking for OS
 + Linux 3.10.0-1160.25.1.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
checking for gcc -pipe switch ... found
checking for --with-ld-opt="-ljemalloc" ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... not found
checking for eventfd() ... found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for strerrordesc_np() ... not found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for ioctl(FIONREAD) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
configuring additional modules
adding module in ./ngx_brotli
 + ngx_brotli was configured
adding module in ./incubator-pagespeed-ngx
mod_pagespeed_dir=./incubator-pagespeed-ngx/psol/include
build_from_source=false
checking for psol ... not found
./configure: error: module ngx_pagespeed requires the pagespeed optimization library.
Look in /root/oneinstack/src/nginx-1.20.0/objs/autoconf.err for more details.

----------------------------------------
checking for C compiler

----------------------------------------
checking for gcc -pipe switch

----------------------------------------
checking for --with-ld-opt="-ljemalloc"

----------------------------------------
checking for -Wl,-E switch

----------------------------------------
checking for gcc builtin atomic operations

----------------------------------------
checking for C99 variadic macros

----------------------------------------
checking for gcc variadic macros

----------------------------------------
checking for gcc builtin 64 bit byteswap

----------------------------------------
checking for unistd.h

----------------------------------------
checking for inttypes.h

----------------------------------------
checking for limits.h

----------------------------------------
checking for sys/filio.h

objs/autotest.c:3:23: fatal error: sys/filio.h: No such file or directory
 #include <sys/filio.h>
                       ^
compilation terminated.
----------

#include <sys/filio.h>

int main(void) {
    return 0;
}

----------
cc -o objs/autotest objs/autotest.c
----------

----------------------------------------
checking for sys/param.h

----------------------------------------
checking for sys/mount.h

----------------------------------------
checking for sys/statvfs.h

----------------------------------------
checking for crypt.h

----------------------------------------
checking for epoll

----------------------------------------
checking for EPOLLRDHUP

----------------------------------------
checking for EPOLLEXCLUSIVE

objs/autotest.c: In function 'main':
objs/autotest.c:9:43: error: 'EPOLLEXCLUSIVE' undeclared (first use in this function)
                       ee.events = EPOLLIN|EPOLLEXCLUSIVE;
                                           ^
objs/autotest.c:9:43: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/epoll.h>

int main(void) {
    int efd = 0, fd = 0;
                      struct epoll_event ee;
                      ee.events = EPOLLIN|EPOLLEXCLUSIVE;
                      ee.data.ptr = NULL;
                      epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for eventfd()

----------------------------------------
checking for O_PATH

----------------------------------------
checking for sendfile()

----------------------------------------
checking for sendfile64()

----------------------------------------
checking for sys/prctl.h

----------------------------------------
checking for prctl(PR_SET_DUMPABLE)

----------------------------------------
checking for prctl(PR_SET_KEEPCAPS)

----------------------------------------
checking for capabilities

----------------------------------------
checking for crypt_r()

----------------------------------------
checking for sys/vfs.h

----------------------------------------
checking for poll()

----------------------------------------
checking for /dev/poll

objs/autotest.c:4:25: fatal error: sys/devpoll.h: No such file or directory
 #include <sys/devpoll.h>
                         ^
compilation terminated.
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/devpoll.h>

int main(void) {
    int  n, dp; struct dvpoll  dvp;
                  dp = 0;
                  dvp.dp_fds = NULL;
                  dvp.dp_nfds = 0;
                  dvp.dp_timeout = 0;
                  n = ioctl(dp, DP_POLL, &dvp);
                  if (n == -1) return 1;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for kqueue

objs/autotest.c:4:23: fatal error: sys/event.h: No such file or directory
 #include <sys/event.h>
                       ^
compilation terminated.
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/event.h>

int main(void) {
    (void) kqueue();
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for crypt()

/tmp/cc2aNzvk.o: In function `main':
autotest.c:(.text+0xf): undefined reference to `crypt'
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>

int main(void) {
    crypt("test", "salt");;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for crypt() in libcrypt

----------------------------------------
checking for F_READAHEAD

objs/autotest.c: In function 'main':
objs/autotest.c:7:14: error: 'F_READAHEAD' undeclared (first use in this function)
     fcntl(0, F_READAHEAD, 1);;
              ^
objs/autotest.c:7:14: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

int main(void) {
    fcntl(0, F_READAHEAD, 1);;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for posix_fadvise()

----------------------------------------
checking for O_DIRECT

----------------------------------------
checking for F_NOCACHE

objs/autotest.c: In function 'main':
objs/autotest.c:7:14: error: 'F_NOCACHE' undeclared (first use in this function)
     fcntl(0, F_NOCACHE, 1);;
              ^
objs/autotest.c:7:14: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

int main(void) {
    fcntl(0, F_NOCACHE, 1);;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for directio()

objs/autotest.c: In function 'main':
objs/autotest.c:8:17: error: 'DIRECTIO_ON' undeclared (first use in this function)
     directio(0, DIRECTIO_ON);;
                 ^
objs/autotest.c:8:17: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
                  #include <sys/fcntl.h>

int main(void) {
    directio(0, DIRECTIO_ON);;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for statfs()

----------------------------------------
checking for statvfs()

----------------------------------------
checking for dlopen()

/usr/bin/ld: /tmp/cc8vfb69.o: undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//usr/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>
#include <dlfcn.h>

int main(void) {
    dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, "");
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for dlopen() in libdl

----------------------------------------
checking for sched_yield()

----------------------------------------
checking for sched_setaffinity()

----------------------------------------
checking for SO_SETFIB

objs/autotest.c: In function 'main':
objs/autotest.c:7:31: error: 'SO_SETFIB' undeclared (first use in this function)
     setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 0);
                               ^
objs/autotest.c:7:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>

int main(void) {
    setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for SO_REUSEPORT

----------------------------------------
checking for SO_ACCEPTFILTER

objs/autotest.c: In function 'main':
objs/autotest.c:7:31: error: 'SO_ACCEPTFILTER' undeclared (first use in this function)
     setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0);
                               ^
objs/autotest.c:7:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>

int main(void) {
    setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for SO_BINDANY

objs/autotest.c: In function 'main':
objs/autotest.c:7:31: error: 'SO_BINDANY' undeclared (first use in this function)
     setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0);
                               ^
objs/autotest.c:7:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>

int main(void) {
    setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for IP_TRANSPARENT

----------------------------------------
checking for IP_BINDANY

objs/autotest.c: In function 'main':
objs/autotest.c:8:31: error: 'IP_BINDANY' undeclared (first use in this function)
     setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0);
                               ^
objs/autotest.c:8:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
                  #include <netinet/in.h>

int main(void) {
    setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for IP_BIND_ADDRESS_NO_PORT

----------------------------------------
checking for IP_RECVDSTADDR

objs/autotest.c: In function 'main':
objs/autotest.c:8:31: error: 'IP_RECVDSTADDR' undeclared (first use in this function)
     setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0);
                               ^
objs/autotest.c:8:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
                  #include <netinet/in.h>

int main(void) {
    setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for IP_SENDSRCADDR

objs/autotest.c: In function 'main':
objs/autotest.c:8:31: error: 'IP_SENDSRCADDR' undeclared (first use in this function)
     setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0);
                               ^
objs/autotest.c:8:31: note: each undeclared identifier is reported only once for each function it appears in
----------

#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
                  #include <netinet/in.h>

int main(void) {
    setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for IP_PKTINFO

----------------------------------------
checking for IPV6_RECVPKTINFO

----------------------------------------
checking for TCP_DEFER_ACCEPT

----------------------------------------
checking for TCP_KEEPIDLE

----------------------------------------
checking for TCP_FASTOPEN

----------------------------------------
checking for TCP_INFO

----------------------------------------
checking for accept4()

----------------------------------------
checking for int size

----------------------------------------
checking for long size

----------------------------------------
checking for long long size

----------------------------------------
checking for void * size

----------------------------------------
checking for uint32_t

----------------------------------------
checking for uint64_t

----------------------------------------
checking for sig_atomic_t

----------------------------------------
checking for sig_atomic_t size

----------------------------------------
checking for socklen_t

----------------------------------------
checking for in_addr_t

----------------------------------------
checking for in_port_t

----------------------------------------
checking for rlim_t

----------------------------------------
checking for uintptr_t

----------------------------------------
checking for system byte ordering

----------------------------------------
checking for size_t size

----------------------------------------
checking for off_t size

----------------------------------------
checking for time_t size

----------------------------------------
checking for AF_INET6

----------------------------------------
checking for setproctitle()

/tmp/cctGmS9j.o: In function `main':
autotest.c:(.text+0xf): undefined reference to `setproctitle'
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

int main(void) {
    setproctitle("test");;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for pread()

----------------------------------------
checking for pwrite()

----------------------------------------
checking for pwritev()

----------------------------------------
checking for strerrordesc_np()

objs/autotest.c: In function 'main':
objs/autotest.c:7:16: warning: assignment makes pointer from integer without a cast [enabled by default]
     char *p; p = strerrordesc_np(0);
                ^
/tmp/ccQwe7zC.o: In function `main':
autotest.c:(.text+0x13): undefined reference to `strerrordesc_np'
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>
#include <string.h>

int main(void) {
    char *p; p = strerrordesc_np(0);
                  if (p == NULL) return 1;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for sys_nerr

/tmp/ccvScisG.o: In function `main':
autotest.c:(.text+0x6): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
135
----------------------------------------
checking for localtime_r()

----------------------------------------
checking for clock_gettime(CLOCK_MONOTONIC)

----------------------------------------
checking for posix_memalign()

----------------------------------------
checking for memalign()

----------------------------------------
checking for mmap(MAP_ANON|MAP_SHARED)

----------------------------------------
checking for mmap("/dev/zero", MAP_SHARED)

----------------------------------------
checking for System V shared memory

----------------------------------------
checking for POSIX semaphores

/usr/bin/ld: /tmp/ccIXOIMy.o: undefined reference to symbol 'sem_destroy@@GLIBC_2.2.5'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>

int main(void) {
    sem_t  sem;
                  if (sem_init(&sem, 1, 0) == -1) return 1;
                  sem_destroy(&sem);;
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for POSIX semaphores in libpthread

----------------------------------------
checking for struct msghdr.msg_control

----------------------------------------
checking for ioctl(FIONBIO)

----------------------------------------
checking for ioctl(FIONREAD)

----------------------------------------
checking for struct tm.tm_gmtoff

----------------------------------------
checking for struct dirent.d_namlen

objs/autotest.c: In function 'main':
objs/autotest.c:8:28: error: 'struct dirent' has no member named 'd_namlen'
     struct dirent  dir; dir.d_namlen = 0;
                            ^
objs/autotest.c:9:41: error: 'struct dirent' has no member named 'd_namlen'
                   printf("%d", (int) dir.d_namlen);
                                         ^
----------

#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
                  #include <stdio.h>

int main(void) {
    struct dirent  dir; dir.d_namlen = 0;
                  printf("%d", (int) dir.d_namlen);
    return 0;
}

----------
cc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -o objs/autotest objs/autotest.c -ljemalloc
----------

----------------------------------------
checking for struct dirent.d_type

----------------------------------------
checking for sysconf(_SC_NPROCESSORS_ONLN)

----------------------------------------
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE)

----------------------------------------
checking for openat(), fstatat()

----------------------------------------
checking for getaddrinfo()

----------------------------------------
checking for psol

./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(91.google_url.o.o): In function `net_instaweb::GoogleUrl::CanonicalizePath(base::BasicStringPiece<std::string>)':
google_url.cc:(.text._ZN12net_instaweb9GoogleUrl16CanonicalizePathEN4base16BasicStringPieceISsEE+0x191): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.string16.o.o): In function `std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> >::_M_check(unsigned long, char const*) const':
string16.cc:(.text._ZNKSbItN4base20string16_char_traitsESaItEE8_M_checkEmPKc[_ZNKSbItN4base20string16_char_traitsESaItEE8_M_checkEmPKc]+0x22): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.string16.o.o): In function `std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> >::at(unsigned long) const':
string16.cc:(.text._ZNKSbItN4base20string16_char_traitsESaItEE2atEm[_ZNKSbItN4base20string16_char_traitsESaItEE2atEm]+0x1c): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.string16.o.o): In function `std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> >::copy(unsigned short*, unsigned long, unsigned long) const':
string16.cc:(.text._ZNKSbItN4base20string16_char_traitsESaItEE4copyEPtmm[_ZNKSbItN4base20string16_char_traitsESaItEE4copyEPtmm]+0x63): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.string16.o.o): In function `std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> >::compare(unsigned long, unsigned long, std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> > const&) const':
string16.cc:(.text._ZNKSbItN4base20string16_char_traitsESaItEE7compareEmmRKS2_[_ZNKSbItN4base20string16_char_traitsESaItEE7compareEmmRKS2_]+0xb4): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.string16.o.o):string16.cc:(.text._ZNKSbItN4base20string16_char_traitsESaItEE7compareEmmRKS2_mm[_ZNKSbItN4base20string16_char_traitsESaItEE7compareEmmRKS2_mm]+0xd9): more undefined references to `std::__throw_out_of_range_fmt(char const*, ...)' follow
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(136.url_util.o.o): In function `url_canon::RawCanonOutputT<unsigned short, 1024>::Resize(int)':
url_util.cc:(.text._ZN9url_canon15RawCanonOutputTItLi1024EE6ResizeEi[_ZN9url_canon15RawCanonOutputTItLi1024EE6ResizeEi]+0x6f): undefined reference to `__cxa_throw_bad_array_new_length'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(136.url_util.o.o): In function `url_util::DecodeURLEscapeSequences(char const*, int, url_canon::CanonOutputT<unsigned short>*)':
url_util.cc:(.text._ZN8url_util24DecodeURLEscapeSequencesEPKciPN9url_canon12CanonOutputTItEE+0x2b4): undefined reference to `__cxa_throw_bad_array_new_length'
url_util.cc:(.text._ZN8url_util24DecodeURLEscapeSequencesEPKciPN9url_canon12CanonOutputTItEE+0x5d4): undefined reference to `__cxa_throw_bad_array_new_length'
url_util.cc:(.text._ZN8url_util24DecodeURLEscapeSequencesEPKciPN9url_canon12CanonOutputTItEE+0x674): undefined reference to `__cxa_throw_bad_array_new_length'
url_util.cc:(.text._ZN8url_util24DecodeURLEscapeSequencesEPKciPN9url_canon12CanonOutputTItEE+0x780): undefined reference to `__cxa_throw_bad_array_new_length'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(136.url_util.o.o):url_util.cc:(.text._ZN8url_util24DecodeURLEscapeSequencesEPKciPN9url_canon12CanonOutputTItEE+0x92e): more undefined references to `__cxa_throw_bad_array_new_length' follow
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(83.symbol_table.o.o): In function `net_instaweb::SymbolTable<net_instaweb::CaseFold>::Clear()':
symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_8CaseFoldEE5ClearEv[_ZN12net_instaweb11SymbolTableINS_8CaseFoldEE5ClearEv]+0x290): undefined reference to `std::length_error::length_error(char const*)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(83.symbol_table.o.o): In function `net_instaweb::SymbolTable<net_instaweb::CasePreserve>::Clear()':
symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_12CasePreserveEE5ClearEv[_ZN12net_instaweb11SymbolTableINS_12CasePreserveEE5ClearEv]+0x290): undefined reference to `std::length_error::length_error(char const*)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(83.symbol_table.o.o): In function `net_instaweb::SymbolTable<net_instaweb::CasePreserve>::Intern(base::BasicStringPiece<std::string> const&)':
symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE[_ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE]+0x936): undefined reference to `std::length_error::length_error(char const*)'
symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE[_ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE]+0xcf1): undefined reference to `std::length_error::length_error(char const*)'
symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE[_ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE]+0xfb7): undefined reference to `std::length_error::length_error(char const*)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(83.symbol_table.o.o):symbol_table.cc:(.text._ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE[_ZN12net_instaweb11SymbolTableINS_12CasePreserveEE6InternERKN4base16BasicStringPieceISsEE]+0x1108): more undefined references to `std::length_error::length_error(char const*)' follow
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(88.html_lexer.o.o): In function `net_instaweb::HtmlLexer::Parse(char const*, int)':
html_lexer.cc:(.text._ZN12net_instaweb9HtmlLexer5ParseEPKci+0x1a4a): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.command_line.o.o): In function `(anonymous namespace)::IsSwitch(std::string const&, std::string*, std::string*) [clone .constprop.66]':
command_line.cc:(.text._ZN12_GLOBAL__N_18IsSwitchERKSsPSsS2_.constprop.66+0x19b): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.command_line.o.o): In function `CommandLine::AppendSwitchNative(std::string const&, std::string const&)':
command_line.cc:(.text._ZN11CommandLine18AppendSwitchNativeERKSsS1_+0x760): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.file_path.o.o): In function `base::FilePath::FilePath(std::string const&)':
file_path.cc:(.text._ZN4base8FilePathC2ERKSs+0x5a): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.file_path.o.o): In function `base::FilePath::Extension() const':
file_path.cc:(.text._ZNK4base8FilePath9ExtensionEv+0xd7): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(1.file_path.o.o):file_path.cc:(.text._ZNK4base8FilePath14FinalExtensionEv+0xd7): more undefined references to `std::__throw_out_of_range_fmt(char const*, ...)' follow
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(136.url_canon_host.o.o): In function `url_canon::(anonymous namespace)::DoIDNHost(unsigned short const*, int, url_canon::CanonOutputT<char>*) [clone .constprop.12]':
url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0xf1): undefined reference to `__cxa_throw_bad_array_new_length'
url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0x2c1): undefined reference to `__cxa_throw_bad_array_new_length'
url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0x397): undefined reference to `__cxa_throw_bad_array_new_length'
url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0x3ed): undefined reference to `__cxa_throw_bad_array_new_length'
url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0x43f): undefined reference to `__cxa_throw_bad_array_new_length'
./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(136.url_canon_host.o.o):url_canon_host.cc:(.text._ZN9url_canon12_GLOBAL__N_19DoIDNHostEPKtiPNS_12CanonOutputTIcEE.constprop.12+0x515): more undefined references to `__cxa_throw_bad_array_new_length' follow
collect2: error: ld returned 1 exit status
----------

#include <sys/types.h>
#include <unistd.h>

#include "pagespeed/kernel/base/string.h"
#include "pagespeed/kernel/base/string_writer.h"
#include "pagespeed/kernel/base/null_message_handler.h"
#include "pagespeed/kernel/html/html_parse.h"
#include "pagespeed/kernel/html/html_writer_filter.h"

int main() {

  GoogleString output_buffer;
  net_instaweb::StringWriter write_to_string(&output_buffer);

  net_instaweb::NullMessageHandler handler;
  net_instaweb::HtmlParse html_parse(&handler);
  net_instaweb::HtmlWriterFilter html_writer_filter(&html_parse);

  html_writer_filter.set_writer(&write_to_string);
  html_parse.AddFilter(&html_writer_filter);

  html_parse.StartParse("http:example.com");
  html_parse.ParseText(
      "<html ><body ><h1 >Test</h1 ><p>Test Text</p></body></html>\n");
  html_parse.FinishParse();

  printf("parsed as: %s", output_buffer.c_str());
    return 0;
}

----------
cc -D_GLIBCXX_USE_CXX11_ABI=0 --std=c++11 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I ./incubator-pagespeed-ngx/psol/include -I ./incubator-pagespeed-ngx/psol/include/third_party/chromium/src -I ./incubator-pagespeed-ngx/psol/include/third_party/google-sparsehash/src/src -I ./incubator-pagespeed-ngx/psol/include/third_party/google-sparsehash/gen/arch/linux/x64/include -I ./incubator-pagespeed-ngx/psol/include/third_party/grpc/src/include -I ./incubator-pagespeed-ngx/psol/include/third_party/protobuf/src/src -I ./incubator-pagespeed-ngx/psol/include/third_party/re2/src -I ./incubator-pagespeed-ngx/psol/include/out/Release/obj/gen -I ./incubator-pagespeed-ngx/psol/include/out/Release/obj/gen/protoc_out/instaweb -I ./incubator-pagespeed-ngx/psol/include/third_party/apr/src/include -I ./incubator-pagespeed-ngx/psol/include/third_party/aprutil/src/include -I ./incubator-pagespeed-ngx/psol/include/third_party/apr/gen/arch/linux/x64/include -I ./incubator-pagespeed-ngx/psol/include/third_party/aprutil/gen/arch/linux/x64/include -I ./incubator-pagespeed-ngx/psol/include/url -o objs/autotest objs/autotest.cc -ljemalloc ./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a -lstdc++ -lrt -pthread -lm -luuid
----------

There are some posts tell me need to install libuuid-devel, but my server tells me it is installed. I do not why, can someone help me? thanks!

CHN-STUDENT commented 3 years ago

also i download psol 1.14.36.1 from https://dist.apache.org/repos/dist/release/incubator/pagespeed/1.14.36.1/x64/psol-1.14.36.1-apache-incubating-x64.tar.gz , unzip to incubator-pagespeed-ngx folder.

Lofesa commented 3 years ago

Hi

build_from_source=false checking for psol ... not found

You tell to the compiler to use a prebuild psol library, but the file is not here or not in the rigth place. The rigth place is /incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a as far as I can read in your logs.

CHN-STUDENT commented 3 years ago

@Lofesa hi, i also try put psol in /incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a or ./incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a, it shows same error, so i do not think it is not found, may be the lib can not work on my CentOS?

Lofesa commented 3 years ago

@CHN-STUDENT No. I have the same OS and it work. The path /incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a is not and absolute path, it is relative to the folder you have decompresed the pagespeed module. You are running this:

./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1k --with-pcre=../pcre-8.44 --with-pcre-jit --with-ld-opt=-ljemalloc --add-module=./ngx_brotli --add-module=./incubator-pagespeed-ngx

--add-module=./incubator-pagespeed-ngx This tell the compiler to found this module in a folder (incubator-pagespeed-ngx) in the same directory where you are running the configure command. The incubator-pagespeed-ngx folder must be at the same level that ngx_brotli (--add-module=./ngx_brotli ) . Note that both modules have ./

/absolute-path/to-downloads/nginx-1.20.0 (you are running the configure comand here) /absolute-path/to-downloads/nginx-1.20.0/ngx_brotli (this module is found) /absolute-path/to-downloads/nginx-1.20.0/incubator-pagespeed-ngx (this not) /absolute-path/to-downloads/openssl-1.1.1k /absolute-path/to-downloads/pcre-8.44

eilandert commented 3 years ago

I read somewhere that the psol library is build with ubuntu bionic.

Bionic has gcc version 7.5.0 Your system has gcc version 4.8.5

That can explain the: /incubator-pagespeed-ngx/psol/lib/Release/linux/x64/pagespeed_automatic.a(91.google_url.o.o): In function net_instaweb::GoogleUrl::CanonicalizePath(base::BasicStringPiece<std::string>)': google_url.cc:(.text._ZN12net_instaweb9GoogleUrl16CanonicalizePathEN4base16BasicStringPieceISsEE+0x191): undefined reference tostd::__throw_out_of_range_fmt(char const*, ...)' etc

If I am right you'll need a PSOL build with gcc 4.8.5 or lower

CHN-STUDENT commented 3 years ago

@Lofesa hi, i also put pagespeed and ngx_brotli lib in same folder. image with only ngx_brotli module,it can complie,but with pagespeed, it gets wrong,

CHN-STUDENT commented 3 years ago

@eilandert you mean i need to upgrade gcc or degrade gcc? And could you tell me what system and gcc do you use?

eilandert commented 3 years ago

@CHN-STUDENT upgrade gcc if possible.

I build PSOL with ubuntu xenial (gcc 5.4.0), bionic (gcc 7.5.0) and focal (gcc 9.3.0) every month for my nginx packages. I use those compiled PSOL also for debian packages. (nginx packages for ubuntu and debian are on http://deb.paranoid.nl/pages/nginx.html, also I maintain a docker at https://hub.docker.com/r/eilandert/nginx-modsecurity3-pagespeed ). Too bad PSOL won't build with gcc 10.2.0 yet, or I could use that one in my docker.

I tried to build with ubuntu trusty (gcc 4.8.5 like yours) today but that didn't go well, the toolchain is too old.

If you can upgrade gcc to at least 5.4.0 you can use the xenial one I believe. Or just maybe use the xenial one without upgrading gcc if you feel lucky

I just uploaded them here: http://tiredofit.nl/psol-xenial.tar.gz http://tiredofit.nl/psol-bionic.tar.gz http://tiredofit.nl/psol-focal.tar.gz

eilandert commented 3 years ago

Ok I managed to build a gcc 4.8.5-psol with trusty, had to update binutils. It gave one error but to my surprise it managed to compile.

Untested: http://tiredofit.nl/psol-trusty.tar.gz

CHN-STUDENT commented 3 years ago

@eilandert thank you! i upgraded my centos gcc to 7.3 and it can build normolly.

yum -y install centos-release-scl
yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
scl enable devtoolset-7 bash
gcc -v 

image image