How to disable GCC from treating warnings as errors
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Please i am facing problem while installing vbox vga card (vboxguest) and i got error as warning that stops make processes
What's this got to do with gcc? Far as I know, a default gcc compile will not treat warnings as errors. However if you're using a makefile, then check the CFLAGS for Werror.
Thanks a lot
1) My environment is LFS 8.3 systemd
2) GCC treated warnings as errors
3) I am trying to install Vbox guest and got error as
./include/linux/moduleparam.h:233:37: note: in definition of macro 'module_param_call'
233 | { .flags = 0, .set = _set, .get = _get }; \
| ^~~~
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:88,
from /tmp/vbox.0/VBoxGuest-linux.c:27:
./include/linux/module.h:138:7: warning: 'cleanup_module' specifies less restrictive attribute than its target 'vgdrvLinuxModExit': 'cold' [-Wmissing-attributes]
138 | void cleanup_module(void) __attribute__((alias(#exitfn)));
| ^~~~~~~~~~~~~~
/tmp/vbox.0/VBoxGuest-linux.c:1079:1: note: in expansion of macro 'module_exit'
1079 | module_exit(vgdrvLinuxModExit);
| ^~~~~~~~~~~
/tmp/vbox.0/VBoxGuest-linux.c:678:20: note: 'cleanup_module' target declared here
678 | static void __exit vgdrvLinuxModExit(void)
| ^~~~~~~~~~~~~~~~~
In file included from /tmp/vbox.0/r0drv/linux/the-linux-kernel.h:88,
from /tmp/vbox.0/VBoxGuest-linux.c:27:
./include/linux/module.h:132:6: warning: 'init_module' specifies less restrictive attribute than its target 'vgdrvLinuxModInit': 'cold' [-Wmissing-attributes]
132 | int init_module(void) __attribute__((alias(#initfn)));
| ^~~~~~~~~~~
/tmp/vbox.0/VBoxGuest-linux.c:1078:1: note: in expansion of macro 'module_init'
1078 | module_init(vgdrvLinuxModInit);
| ^~~~~~~~~~~
/tmp/vbox.0/VBoxGuest-linux.c:540:19: note: 'init_module' target declared here
540 | static int __init vgdrvLinuxModInit(void)
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:317: /tmp/vbox.0/VBoxGuest-linux.o] Error 1
make[2]: *** Waiting for unfinished jobs....
./tools/objtool/objtool check --module --retpoline "/tmp/vbox.0/VBoxGuest.o";
make[1]: *** [Makefile:1500: _module_/tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile.include.footer:85: vboxguest] Error 2
I upgraded the GCC version to 9.1 and i am still getting the same error
I am unable to edit the configure flag or custom anything in make process because vbox guest using installation scripts with compressed files and i am not able to edit them
I need to fix the GCC as i tried the same installation script on another environment (ubuntu 18) and it is working good
I did a lot of researches and all about using flag --disable-werror but as i said i am unable to reach configure file or make directlly
Thanks a lot again
Last edited by ahmed bedair; 07-21-2019 at 04:52 AM.
Only because of the Makefile you're using is requesting that, it is not the default behaviour of gcc. From the man page of gcc
Code:
-Werror
Make all warnings into errors.
-Werror=<specifier>
Make the specified warning into an error.
so - as you have been told before - by default gcc does NOT treat warnings as errors, but of course when one of these flags is given in the commandline, it will.
You disable this behaviour by removing the -Werror options from the commandline "make" is using to call gcc.
HOW, is up to you.
Sure please
1) I updated the GCC to 9.1 and i got the same error
2) I am unable to change the GCC flag at the script, I followed the script but it contains multi scripts within compressed files
3) I installed script on ubuntu 18 and I got no error
4) I searched all results on the internet and all of them say this is not a normal behavior of GCC and in case you have to sed make files but I am unable to reach them and this is Virtual box guest script so it must not contains those kind of errors
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.