Skip to content
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

RHEL 9 Support. #232

Closed
fossee-sysad opened this issue May 30, 2022 · 8 comments · Fixed by #243
Closed

RHEL 9 Support. #232

fossee-sysad opened this issue May 30, 2022 · 8 comments · Fixed by #243

Comments

@fossee-sysad
Copy link

Compiling on RHEL 9 gives the following error.

--------------------------------------------------------------------------------------------------------------------------------------------------
In file included from src/core/ngx_core.h:53,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
In function 'ngx_write_fd',
inlined from 'ngx_http_vhost_traffic_status_dump_node_write' at /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:118:16:
src/os/unix/ngx_files.h:147:12: error: 'write' reading 3480 bytes from a region of size 1 [-Werror=stringop-overread]
147 | return write(fd, buf, n);
| ^~~~~~~~~~~~~~~~~
In file included from src/core/ngx_core.h:49,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:13,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
src/os/unix/ngx_files.h: In function 'ngx_http_vhost_traffic_status_dump_node_write':
src/core/ngx_rbtree.h:27:28: note: source object 'color' of size 1
27 | u_char color;
| ^~~~~
In file included from src/os/unix/ngx_linux_config.h:20,
from src/core/ngx_config.h:26,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_module.h:12,
from /home/builder/nginx-module-vts/src/ngx_http_vhost_traffic_status_dump.c:7:
/usr/include/unistd.h:378:16: note: in a call to function 'write' declared with attribute 'access (read_only, 2, 3)'
378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
| ^~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1953: objs/addon/src/ngx_http_vhost_traffic_status_dump.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/builder/rpmbuild/BUILD/nginx-1.22.0'
make: *** [Makefile:10: build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.HB7OPv (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.HB7OPv (%build)****

--------------------------------------------------------------------------------------------------------------------------------------------------

Kindly check

@aminvakil
Copy link
Contributor

Have you tried removing -Werror from your compilation flags? Or if you're not sure adding -Wno-error to compilation flags and try compiling again?

@fossee-sysad
Copy link
Author

I am rebuilding the RPM from the SRPM from
http://nginx.org/packages/centos/9/x86_64/RPMS/nginx-1.22.0-1.el9.ngx.x86_64.rpm
I have now put
export CFLAGS=-Wno-error
before the rpmbuild.
I am waiting for the result as the compilation is taking longer than usual.

@aminvakil
Copy link
Contributor

Make sure rpmbuild respects the CFLAGS environment variable.

@fossee-sysad
Copy link
Author

Elapsed (wall clock) time (h:mm:ss or m:ss): 1:02:32
Successful build in one hour.

@karljohns0n
Copy link

I tried with latest version 0.2.0, still the same issue on el9:

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -DTCP_FASTOPEN=23 -Wno-deprecated-declarations  -I src/core -I src/event -I src/event/modules -I src/os/unix -I modules/openssl-3.0.5/.openssl/include -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/http/v2 -I modules/ngx_brotli-snap20220505/deps/brotli/c/include -I src/mail -I src/stream \
	-o objs/addon/src/ngx_http_vhost_traffic_status_dump.o \
	modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_dump.c
In file included from src/core/ngx_core.h:53,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_module.h:13,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_dump.c:7:
In function 'ngx_write_fd',
    inlined from 'ngx_http_vhost_traffic_status_dump_node_write' at modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_dump.c:118:16:
src/os/unix/ngx_files.h:147:12: error: 'write' reading 3480 bytes from a region of size 1 [-Werror=stringop-overread]
  147 |     return write(fd, buf, n);
      |            ^~~~~~~~~~~~~~~~~
In file included from src/core/ngx_core.h:49,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_module.h:13,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_dump.c:7:
src/os/unix/ngx_files.h: In function 'ngx_http_vhost_traffic_status_dump_node_write':
src/core/ngx_rbtree.h:27:28: note: source object 'color' of size 1
   27 |     u_char                 color;
      |                            ^~~~~
In file included from src/os/unix/ngx_linux_config.h:20,
                 from src/core/ngx_config.h:26,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_module.h:12,
                 from modules/ngx_module_vts-0.2.0/src/ngx_http_vhost_traffic_status_dump.c:7:
/usr/include/unistd.h:378:16: note: in a call to function 'write' declared with attribute 'access (read_only, 2, 3)'
  378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
      |                ^~~~~
cc1: all warnings being treated as errors
make[1]: Leaving directory '/builddir/build/BUILD/nginx-1.22.0'
make[1]: *** [objs/Makefile:2109: objs/addon/src/ngx_http_vhost_traffic_status_dump.o] Error 1
make: *** [Makefile:10: build] Error 2
RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.he20Dm (%build)

@u5surf
Copy link
Collaborator

u5surf commented Sep 7, 2022

@karljohns0n @fossee-sysad
Hi, Thanks for reporting. It seems that the same issue in #223

Can you share the SPECS/nginx.spec like this?
https://github.com/hnakamur/nginx-rpm/blob/main/SPECS/nginx.spec#L298

#223 also said that it can ignore the error with --with-cc-opt=-Wno-stringop-overread.

./configure \
...
--add-module=/some/where/nginx_module_vts
...
--with-cc-opt="%{optflags} $(pcre-config --cflags) -Wno-stringop-overread"

Please consider adding the options if you can.

@vozlt
Copy link
Owner

vozlt commented Sep 7, 2022

@fossee-sysad @karljohns0n @u5surf
I fixed where I think the problem is occurring. please check.
Commit: 6fb2eb1

FYI: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578

@karljohns0n
Copy link

Thanks @vozlt, it compiles fine now without using -Wno-stringop-overread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants