PerditionC / fdkernel

FreeDOS kernel - implements the core MS-DOS/PC-DOS (R) compatible operating system. It is derived from Pat Villani's DOS-C kernel and released under the GPL v2. Please see http://www.freedos.org/ for more details about the FreeDOS (TM) Project. !!! This fork is no longer the primary fork -- Please post PRs and issues to https://github.com/FDOS/kernel !!!
http://dosc.fdos.org/
105 stars 0 forks source link

Build problem with ia16-elf-gcc #37

Closed andrewbird closed 4 years ago

andrewbird commented 4 years ago

So I'm thinking about if fdkernel can be built automatically using travis-ci. I tried to build it locally first using a Xenial machine with ia16-elf-gcc from @tkchia's PPA but I get this result.

ajb@xenial:/common/src2/fdkernel$ make clean all COMPILER=gcc
cd utils && make clean
make[1]: Entering directory '/common/src2/fdkernel/utils'
rm -f *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me
rm -f exeflat.exe patchobj.com
make[1]: Leaving directory '/common/src2/fdkernel/utils'
cd lib && make clean
make[1]: Entering directory '/common/src2/fdkernel/lib'
rm -f *.obj *.bak libm.lib
make[1]: Leaving directory '/common/src2/fdkernel/lib'
cd drivers && make clean
make[1]: Entering directory '/common/src2/fdkernel/drivers'
rm -f *.obj *.bak *.crf *.xrf *.map *.lst *.cod *.err
make[1]: Leaving directory '/common/src2/fdkernel/drivers'
cd boot && make clean
make[1]: Entering directory '/common/src2/fdkernel/boot'
rm -f *.lst *.map *.bak *.obj
make[1]: Leaving directory '/common/src2/fdkernel/boot'
cd sys && make clean
make[1]: Entering directory '/common/src2/fdkernel/sys'
rm -f *.obj *.bak *.crf *.xrf *.map *.lst *.las *.cod *.err status.me
make[1]: Leaving directory '/common/src2/fdkernel/sys'
cd kernel && make clean
make[1]: Entering directory '/common/src2/fdkernel/kernel'
rm -f *.obj *.bak *.crf *.xrf *.map *.lst *.cod *.err *.lnk
make[1]: Leaving directory '/common/src2/fdkernel/kernel'
for i in utils lib drivers boot sys kernel; do sed 's@!include "\(.*\)"@include ../mkfiles/gcc.mak@' < $i/makefile > $i/GNUmakefile; done
cd utils && make production
make[1]: Entering directory '/common/src2/fdkernel/utils'
gcc -DDOSC_TIME_H -I../hdr -o patchobj.com -I../hdr patchobj.c
gcc -DDOSC_TIME_H -I../hdr -o exeflat.exe -I../hdr exeflat.c
make[1]: Leaving directory '/common/src2/fdkernel/utils'
cd lib && ( test -f libm.lib || touch libm.lib )
cd drivers && make production
make[1]: Entering directory '/common/src2/fdkernel/drivers'
nasm -Dgcc -DWITHFAT32 -i../hdr/ -DXCPU=86 -felf -o floppy.obj floppy.asm
nasm -Dgcc -DWITHFAT32 -i../hdr/ -DXCPU=86 -felf -o rdpcclk.obj rdpcclk.asm
nasm -Dgcc -DWITHFAT32 -i../hdr/ -DXCPU=86 -felf -o wrpcclk.obj wrpcclk.asm
nasm -Dgcc -DWITHFAT32 -i../hdr/ -DXCPU=86 -felf -o wratclk.obj wratclk.asm
rm -f device.lib
ar crs  device.lib floppy.obj rdpcclk.obj wrpcclk.obj wratclk.obj 
cp device.lib ../lib
make[1]: Leaving directory '/common/src2/fdkernel/drivers'
cd boot && make production
make[1]: Entering directory '/common/src2/fdkernel/boot'
make[1]: Nothing to be done for 'production'.
make[1]: Leaving directory '/common/src2/fdkernel/boot'
cd sys && make production
make[1]: Entering directory '/common/src2/fdkernel/sys'
ia16-elf-gcc -c -I. -I../hdr -DFORSYS -DWITHFAT32 -Os -fno-strict-aliasing -fpack-struct -fcall-used-es -Wno-pointer-to-int-cast -Wno-pragmas -Wno-array-bounds -Werror -o sys.obj sys.c
ia16-elf-gcc -c -I. -I../hdr -DFORSYS -DWITHFAT32 -Os -fno-strict-aliasing -fpack-struct -fcall-used-es -Wno-pointer-to-int-cast -Wno-pragmas -Wno-array-bounds -Werror -o fdkrncfg.obj fdkrncfg.c
ia16-elf-gcc -c -I. -I../hdr -DFORSYS -DWITHFAT32 -Os -fno-strict-aliasing -fpack-struct -fcall-used-es -Wno-pointer-to-int-cast -Wno-pragmas -Wno-array-bounds -Werror -o prf.obj ../kernel/prf.c
../kernel/prf.c:161:13: error: conflicting types for built-in function ‘vprintf’ [-Werror]
 STATIC void vprintf(CONST char *, REG va_list);
             ^~~~~~~
In file included from ../kernel/prf.c:29:0:
../kernel/prf.c: In function ‘ltob’:
../hdr/portab.h:157:13: error: expected identifier or ‘(’ before ‘__far’
 #define far __far
             ^
../hdr/portab.h:222:24: note: in expansion of macro ‘far’
 #define FAR            far      /* segment architecture */
                        ^~~
../kernel/prf.c:146:15: note: in expansion of macro ‘FAR’
 #define SSFAR FAR  /* **** */
               ^~~
../kernel/prf.c:176:18: note: in expansion of macro ‘SSFAR’
   BYTE SSFAR *p, SSFAR *q;
                  ^~~~~
../kernel/prf.c:199:8: error: ‘q’ undeclared (first use in this function)
   for (q = s; q < --p; q++)
        ^
../kernel/prf.c:199:8: note: each undeclared identifier is reported only once for each function it appears in
cc1: all warnings being treated as errors
GNUmakefile:48: recipe for target 'prf.obj' failed
make[1]: *** [prf.obj] Error 1
make[1]: Leaving directory '/common/src2/fdkernel/sys'
makefile:111: recipe for target 'all' failed
make: *** [all] Error 2
ajb@xenial:/common/src2/fdkernel$ 
binutils-ia16-elf (2.32.0-20190928.13-ppa190929070~xenial
libnewlib-ia16-elf (2.4.0-20191005-stage1gcc6.3.0-20191001.14-binutils2.32.0-20190928.13-ppa191005173~xenial
gcc-ia16-elf (6.3.0-20191001.14-ppa191018170~xenial

I'm sure I did this in the past, but never on this machine. Have I missed a step?

tkchia commented 4 years ago

Hello @andrewbird ,

The "primary" repository at https://github.com/FDOS/kernel builds properly under ia16-elf-gcc --- I have tested it --- and is probably more stable. So perhaps you can try building from that repository instead?

(Incidentally, the cause of the second error message is that ia16-elf-gcc does not accept the syntax

BYTE __far *p, __far *q;

since it parses the __far keyword in a different way. See https://github.com/tkchia/gcc-ia16/issues/11.)

Thank you!

andrewbird commented 4 years ago

I've switched now to https://github.com/FDOS/kernel as my upstream and build is working fine. I think I'll still raise issues here if I need to as it seems more active though.

Thanks, Andrew