Fuzix-Compiler-Kit icon indicating copy to clipboard operation
Fuzix-Compiler-Kit copied to clipboard

Support for MSYS2

Open tmssngr opened this issue 1 year ago • 1 comments

Please support building with MSYS2. Currently, I'm getting

$ make
cc -Wall -pedantic -g3 -DLIBPATH="\"/opt/fcc//lib\"" -DBINPATH="\"/opt/fcc//bin\""   -c -o cc.o cc.c
gcc -g3 cc.c -o cc
cc -Wall -pedantic -g3 -DLIBPATH="\"/opt/fcc//lib\"" -DBINPATH="\"/opt/fcc//bin\""   -c -o frontend.o frontend.c
frontend.c: In function ‘report’:
frontend.c:102:16: warning: implicit declaration of function ‘_itoa’; did you mean ‘_dtoa_r’? [-Wimplicit-function-declaration]
  102 |         writes(_itoa(line));
      |                ^~~~~
      |                _dtoa_r
frontend.c:102:16: warning: passing argument 1 of ‘writes’ makes pointer from integer without a cast [-Wint-conversion]
  102 |         writes(_itoa(line));
      |                ^~~~~~~~~~~
      |                |
      |                int
frontend.c:92:32: note: expected ‘const char *’ but argument is of type ‘int’
   92 | static void writes(const char *p)
      |                    ~~~~~~~~~~~~^
gcc -g3 frontend.o -o cc0
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: frontend.o: in function `report':
/d/src/Fuzix-Compiler-Kit/frontend.c:102:(.text+0x137): undefined reference to `_itoa'
collect2: error: ld returned 1 exit status
make: *** [Makefile:76: cc0] Error 1

tmssngr avatar May 20 '24 12:05 tmssngr

I will take a look at this at the weekend. Probably the easiest thing is to just import a copy of _itoa into the code proper. Fixing the ifdefs around the hack implementation in frontend.c will fix it for the moment though. It's to ensure we don't pull in the whole printf implementation when building it natively on Z80 etc

EtchedPixels avatar May 23 '24 16:05 EtchedPixels