sergev / LiteBSD

Variant of 4.4BSD Unix for microcontrollers
Other
308 stars 36 forks source link

Error compiling kernel ""minor" "major" #71

Open CatspersCoffee opened 5 years ago

CatspersCoffee commented 5 years ago

Hi all, trying to compile the kernel and getting error:

:~/LiteBSD$ bmake kernel
bmake -Csys/compile all
bmake -C../../usr.sbin/config
byacc -d config.y
byacc: w - the symbol SIGNAL is undefined
byacc: 12 reduce/reduce conflicts.
mv y.tab.c config.c
gcc  -Werror -c config.c
config.y: In function ‘checksystemspec’:
config.y:1003:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
   if (minor(dev) & 07) {
             ^~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                             
config.y:1006:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
     (minor(dev) & 07) + 'a' - 1);
             ^~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                    
config.y:1010:13: error: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>. [-Werror]
      makedev(major(dev), (minor(dev) &~ 07) | ('b' - 'a' + 1));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                      
config.y:1010:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
config.y:1010:13: error: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>. [-Werror]
      makedev(major(dev), (minor(dev) &~ 07) | ('b' - 'a' + 1));
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                      
config.y: In function ‘alreadychecked’:
config.y:1121:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
   if (samedev(*p, dev))
             ^~~~~~~~~~~                                                                                                                                                                                                                                                                                                                              
config.y:1121:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
config.y: In function ‘yyparse’:
config.y:353:13: error: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>. [-Werror]
   = { $$ = makedev($2, $4); }
             ^~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                        
cc1: all warnings being treated as errors
*** Error code 1

Stop.
bmake[2]: stopped in /home/xx/LiteBSD/usr.sbin/config
*** Error code 1

Stop.
bmake[1]: stopped in /home/xx/LiteBSD/sys/compile
*** Error code 1

Stop.
bmake: stopped in /home/xx/LiteBSD
ibara commented 5 years ago

Removing the -Werror flags from share/mk-pic32/local.prog.mk and share/mk-pic32/sys.mk should fix your problem.

CatspersCoffee commented 5 years ago

adding

include <sys/sysmacros.h>

to files: usr.sbin/config/mkswapconf.c and usr.sbin/config/config.c

works

ibara commented 5 years ago

Your solution is less than desirable since that's a Linux-specific solution. If the glibc people are going to make an ABI change, then the proper solution is to detect broken glibc versions and work around them, not force everyone to inherit broken glibc problems.

CatspersCoffee commented 5 years ago

Thanks @ibara , implemented your solution removing -Werror flags. compiles fine. thankyou

my original solution was not meant to be long term or merged into the project. It was only to get it compiled for me at the time. Im using gcc version 7.4.0, just for your information - if you want to implement a solution to use the -Werror flags and check compiler version.

thanks for the quick reply! :-)

CatspersCoffee commented 5 years ago

Also get a few error when building file system:

:~/LiteBSD$ bmake fs
make -C`dirname contrib/ufstool/ufstool`
make[1]: Entering directory '/home/xx/LiteBSD/contrib/ufstool'
cc -O1 -g -Wall -Werror   -c -o block.o block.c
cc -O1 -g -Wall -Werror   -c -o cgroup.o cgroup.c
cc -O1 -g -Wall -Werror   -c -o disk.o disk.c
cc -O1 -g -Wall -Werror   -c -o inode.o inode.c
cc -O1 -g -Wall -Werror   -c -o sblock.o sblock.c
cc -O1 -g -Wall -Werror   -c -o bitmap.o bitmap.c
cc -O1 -g -Wall -Werror   -c -o mkfs.o mkfs.c
cc -O1 -g -Wall -Werror   -c -o check.o check.c
cc -O1 -g -Wall -Werror   -c -o check_suj.o check_suj.c
ar cr libufs.a block.o cgroup.o disk.o inode.o sblock.o bitmap.o mkfs.o check.o check_suj.o
cc -O1 -g -Wall -Werror   -c -o ufstool.o ufstool.c
cc -O1 -g -Wall -Werror   -c -o manifest.o manifest.c
cc -O1 -g -Wall -Werror `pkg-config --cflags fuse` -c -o mount.o mount.c
/bin/sh: 1: pkg-config: not found
In file included from /usr/include/fuse/fuse.h:26:0,
                 from /usr/include/fuse.h:9,
                 from mount.c:32:
/usr/include/fuse/fuse_common.h:33:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
 #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
  ^~~~~
mount.c: In function ‘make_rdev’:
mount.c:56:13: error: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>. [-Werror]
     return makedev (raw >> 8, raw & 0xff);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                               
mount.c: In function ‘op_mknod’:
mount.c:552:13: error: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>. [-Werror]
         inode.daddr[0] = major(dev) << 8 | minor(dev);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                   
mount.c:552:13: error: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>. [-Werror]
cc1: all warnings being treated as errors
Makefile:28: recipe for target 'mount.o' failed
make[1]: *** [mount.o] Error 1
make[1]: Leaving directory '/home/xx/LiteBSD/contrib/ufstool'
*** Error code 2
CatspersCoffee commented 5 years ago

modified the line: CFLAGS = -O1 -g -Wall -D_FILE_OFFSET_BITS=64

in file LiteBSD/contrib/ufstool/Makefile and installed package "pkg-config"

just wondering if these changes should be made to the build files, or would you like to make more significant changes to keep using -Werror flag ? @ibara

ibara commented 5 years ago

It's disappointing to see glibc changes breaking the build. I'm not a Linux user myself (I use OpenBSD) so I'll have to think about what a good solution is going forward. It would be nice to keep the -Werror flags. Adding a note about needing pkg-config installed is certainly easy. I'll come up with something soon.

calmsacibis995 commented 1 year ago

I have already created a pull request (#75) to fix this issue.