Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

error expected identifier before numeric constant when compiling using MSYS2 MINGW64 on windows 11 pro #89

Open
dinornul opened this issue Jan 11, 2023 · 7 comments

Comments

@dinornul
Copy link

hello,
error when compiling using MSYS2 MINGW64 on windows 11 pro
--package installed--
pacman -S base-devel mingw-w64-x86_64-toolchain git mingw-w64-x86_64-ninja
pacman -S mingw-w64-x86_64-glib2 mingw-w64-x86_64-pixman
pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-SDL2 mingw-w64-x86_64-libslirp
pacman -S mingw-w64-x86_64-python3
pacman -S mingw-w64-x86_64-meson

--step to reproduct--
cd ../workingdir/qemu-t8030/build/
../configure --target-list=aarch64-softmmu,x86_64-softmmu --disable-capstone --enable-lzfse --disable-werror --disable-stack-protector
make -j$(nproc)

[471/1659] Compiling C object libcommon.fa.p/hw_dma_apple_sio.c.obj
FAILED: libcommon.fa.p/hw_dma_apple_sio.c.obj
"cc" "-m64" "-mcx16" "-Ilibcommon.fa.p" "-I../dtc/libfdt" "-IC:/msys64/mingw64/include/pixman-1" "-IC:/msys64/mingw64/include/libpng16" "-IC:/msys64/mingw64/include/SDL2" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-IC:/msys64/mingw64/include/slirp" "-IC:/msys64/mingw64/include/ncursesw" "-IC:/msys64/mingw64/include/gtk-3.0" "-IC:/msys64/mingw64/include/pango-1.0" "-IC:/msys64/mingw64/include/harfbuzz" "-IC:/msys64/mingw64/include/freetype2" "-IC:/msys64/mingw64/include/fribidi" "-IC:/msys64/mingw64/include/cairo" "-IC:/msys64/mingw64/include/lzo" "-IC:/msys64/mingw64/include/gdk-pixbuf-2.0" "-IC:/msys64/mingw64/include/atk-1.0" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-std=gnu11" "-O2" "-g" "-iquote" "." "-iquote" "C:/msys64/home/workingdir/qemu-t8030" "-iquote" "C:/msys64/home/workingdir/qemu-t8030/include" "-iquote" "C:/msys64/home/workingdir/qemu-t8030/tcg/i386" "-U_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=2" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-Wstrict-prototypes" "-Wredundant-decls" "-Wundef" "-Wwrite-strings" "-Wmissing-prototypes" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wold-style-declaration" "-Wold-style-definition" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wnested-externs" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-DLIBDEFLATE_DLL" "-D_XOPEN_SOURCE=600" "-D_POSIX_C_SOURCE=199506L" "-DNCURSES_WIDECHAR=1" "-Dmain=SDL_main" "-Wno-undef" -MD -MQ libcommon.fa.p/hw_dma_apple_sio.c.obj -MF "libcommon.fa.p/hw_dma_apple_sio.c.obj.d" -o libcommon.fa.p/hw_dma_apple_sio.c.obj "-c" ../hw/dma/apple_sio.c
In file included from C:/msys64/mingw64/include/windows.h:71,
from C:/msys64/mingw64/include/winsock2.h:23,
from C:/msys64/home/workingdir/qemu-t8030/include/sysemu/os-win32.h:29,
from C:/msys64/home/workingdir/qemu-t8030/include/qemu/osdep.h:147,
from ../hw/dma/apple_sio.c:1:
../hw/dma/apple_sio.c:33:5: error: expected identifier before numeric constant
33 | ERROR = 2,
| ^~~~~
../hw/dma/apple_sio.c: In function 'apple_sio_dma_writeback':
../hw/dma/apple_sio.c:147:12: error: 'DMA_COMPLETE' undeclared (first use in this function); did you mean 'CPS_COMPLETE'?
147 | m.op = DMA_COMPLETE;
| ^~~~~~~~~~~~
| CPS_COMPLETE
../hw/dma/apple_sio.c:147:12: note: each undeclared identifier is reported only once for each function it appears in
../hw/dma/apple_sio.c: In function 'apple_sio_control':
../hw/dma/apple_sio.c:205:20: error: 'ACK' undeclared (first use in this function); did you mean 'ACL'?
205 | reply.op = ACK;
| ^~~
| ACL
../hw/dma/apple_sio.c: In function 'apple_sio_dma':
../hw/dma/apple_sio.c:227:20: error: 'ACK' undeclared (first use in this function); did you mean 'ACL'?
227 | reply.op = ACK;
| ^~~
| ACL
../hw/dma/apple_sio.c:230:10: error: 'START_DMA' undeclared (first use in this function); did you mean 'STARTDOC'?
230 | case START_DMA: {
| ^~~~~~~~~
| STARTDOC
../hw/dma/apple_sio.c:259:10: error: 'QUERY_DMA' undeclared (first use in this function)
259 | case QUERY_DMA:
| ^~~~~~~~~
../hw/dma/apple_sio.c:264:20: error: 'QUERY_DMA_OK' undeclared (first use in this function)
264 | reply.op = QUERY_DMA_OK;
| ^~~~~~~~~~~~
../hw/dma/apple_sio.c:267:10: error: 'STOP_DMA' undeclared (first use in this function)
267 | case STOP_DMA:
| ^~~~~~~~
[472/1659] Compiling C object libcommon.fa.p/hw_gpio_gpio_key.c.obj
[473/1659] Compiling C object libcommon.fa.p/hw_gpio_max7310.c.obj
[474/1659] Compiling C object libcommon.fa.p/hw_gpio_pl061.c.obj
[475/1659] Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj
[476/1659] Compiling C object libcommon.fa.p/hw_gpio_imx_gpio.c.obj
[477/1659] Compiling C object libcommon.fa.p/hw_gpio_npcm7xx_gpio.c.obj
[478/1659] Compiling C object libcommon.fa.p/hw_gpio_nrf51_gpio.c.obj
[479/1659] Compiling C object libcommon.fa.p/hw_gpio_bcm2835_gpio.c.obj
[480/1659] Compiling C object libcommon.fa.p/hw_gpio_omap_gpio.c.obj
[481/1659] Compiling C object libcommon.fa.p/hw_gpio_aspeed_gpio.c.obj
[482/1659] Compiling C object libcommon.fa.p/hw_display_cirrus_vga.c.obj
ninja: build stopped: subcommand failed.
make: *** [Makefile:162: run-ninja] Error 1`

@TrungNguyen1909
Copy link
Owner

I think that file of your repo (hw/dma/apple_sio.c) is corrupted. Try cloning again.

@dinornul
Copy link
Author

tried re-cloning the repo, but seems to have same error on it but on different run sequent
[1069/2282] Compiling C object libcommon.fa.p/hw_dma_apple_sio.c.obj
my ninja version is

ninja --version
1.11.1

please tell me if i missing some dependencies?
attached full log
full log.txt

@dinornul
Copy link
Author

dinornul commented Jan 18, 2023

@TrungNguyen1909
i am tracing the problem, its lead to, that this file apple_sio.c need to be compiled on extra param -E on gcc

"cc" "-m64" "-mcx16" "-Ilibcommon.fa.p" "-I../dtc/libfdt" "-IC:/msys64/mingw64/include/pixman-1" "-IC:/msys64/mingw64/include/libpng16" "-IC:/msys64/mingw64/include/SDL2" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-IC:/msys64/mingw64/include/slirp" "-IC:/msys64/mingw64/include/ncursesw" "-IC:/msys64/mingw64/include/gtk-3.0" "-IC:/msys64/mingw64/include/pango-1.0" "-IC:/msys64/mingw64/include/harfbuzz" "-IC:/msys64/mingw64/include/freetype2" "-IC:/msys64/mingw64/include/fribidi" "-IC:/msys64/mingw64/include/cairo" "-IC:/msys64/mingw64/include/lzo" "-IC:/msys64/mingw64/include/gdk-pixbuf-2.0" "-IC:/msys64/mingw64/include/atk-1.0" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-std=gnu11" "-O2" "-g" "-iquote" "." "-iquote" "C:/msys64/home/workingdir/qemu-t8030" "-iquote" "C:/msys64/home/workingdir/qemu-t8030/include" "-iquote" "C:/msys64/home/workingdir/qemu-t8030/tcg/i386" "-U_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=2" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-Wstrict-prototypes" "-Wredundant-decls" "-Wundef" "-Wwrite-strings" "-Wmissing-prototypes" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wold-style-declaration" "-Wold-style-definition" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wnested-externs" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-DLIBDEFLATE_DLL" "-D_XOPEN_SOURCE=600" "-D_POSIX_C_SOURCE=199506L" "-DNCURSES_WIDECHAR=1" "-Dmain=SDL_main" "-Wno-undef" -MD -MQ libcommon.fa.p/hw_dma_apple_sio.c.obj -MF "libcommon.fa.p/hw_dma_apple_sio.c.obj.d" -o libcommon.fa.p/hw_dma_apple_sio.c.obj -E "-c" ../hw/dma/apple_sio.c

@TrungNguyen1909
Copy link
Owner

ehh, can you replace all occurrences of ERROR in that file with sthg like SIO_ERROR? I felt like ERROR is defined somewhere already in mingw64 headers...

@Biswa96
Copy link

Biswa96 commented Jan 21, 2023

There are many things need to be ported to Windows platform. For example, some APIs like stat, unlink does not work with Windows implementation of the unix sockets. Also another compiler error

qemu-t8030/hw/arm/t8030-config.c.inc:269:9: error: conflicting types for 'clock_freq'; have 'uint8_t[]' {aka 'unsigned char[]'}
  269 | uint8_t clock_freq[] = {
      |         ^~~~~~~~~~
qemu-t8030/include/qemu/timer.h:819:16: note: previous declaration of 'clock_freq' with type 'int64_t' {aka 'long long int'}
  819 | extern int64_t clock_freq;
      |                ^~~~~~~~~~

@TrungNguyen1909
Copy link
Owner

I dont have any Windows machine for development... As such, Windows is not supported.

Feel free to submit patches for Windows support!

@y2k04
Copy link

y2k04 commented Mar 9, 2023

I got further with compiling, but it did not like to compile hw_dma_apple_sio.c.o

[839/5810] Compiling C object libcommon.fa.p/hw_dma_apple_sio.c.o
FAILED: libcommon.fa.p/hw_dma_apple_sio.c.o
cc -m64 -mcx16 -Ilibcommon.fa.p -I../dtc/libfdt -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/SDL2 -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include/slirp -IC:/msys64/mingw64/include/libusb-1.0 -IC:/msys64/mingw64/include/ncursesw -IC:/msys64/mingw64/include/gtk-3.0 -IC:/msys64/mingw64/include/pango-1.0 -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include/fribidi -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/include/webp -IC:/msys64/mingw64/include/atk-1.0 -fdiagnostics-color=auto -Wall -Winvalid-pch -Werror -std=gnu11 -O2 -g -iquote . -iquote /c/SPB_Data/qemu-t8030 -iquote /c/SPB_Data/qemu-t8030/include -iquote /c/SPB_Data/qemu-t8030/tcg/i386 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-declaration -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wimplicit-fallthrough=2 -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-psabi -fstack-protector-strong -Wno-error -DLIBDEFLATE_DLL -D_POSIX_C_SOURCE=199506L -DNCURSES_WIDECHAR -DNCURSES_WIDECHAR=1 -Dmain=SDL_main -Wno-undef -MD -MQ libcommon.fa.p/hw_dma_apple_sio.c.o -MF libcommon.fa.p/hw_dma_apple_sio.c.o.d -o libcommon.fa.p/hw_dma_apple_sio.c.o -c ../hw/dma/apple_sio.c
In file included from C:/msys64/mingw64/include/windows.h:71,
                 from C:/msys64/mingw64/include/winsock2.h:23,
                 from C:/SPB_Data/qemu-t8030/include/sysemu/os-win32.h:29,
                 from C:/SPB_Data/qemu-t8030/include/qemu/osdep.h:147,
                 from ../hw/dma/apple_sio.c:1:
../hw/dma/apple_sio.c:33:5: error: expected identifier before numeric constant
   33 |     ERROR = 2,
      |     ^~~~~
../hw/dma/apple_sio.c: In function 'apple_sio_dma_writeback':
../hw/dma/apple_sio.c:147:12: error: 'DMA_COMPLETE' undeclared (first use in this function); did you mean 'CPS_COMPLETE'?
  147 |     m.op = DMA_COMPLETE;
      |            ^~~~~~~~~~~~
      |            CPS_COMPLETE
../hw/dma/apple_sio.c:147:12: note: each undeclared identifier is reported only once for each function it appears in
../hw/dma/apple_sio.c: In function 'apple_sio_control':
../hw/dma/apple_sio.c:205:20: error: 'ACK' undeclared (first use in this function); did you mean 'ACL'?
  205 |         reply.op = ACK;
      |                    ^~~
      |                    ACL
../hw/dma/apple_sio.c: In function 'apple_sio_dma':
../hw/dma/apple_sio.c:227:20: error: 'ACK' undeclared (first use in this function); did you mean 'ACL'?
  227 |         reply.op = ACK;
      |                    ^~~
      |                    ACL
../hw/dma/apple_sio.c:230:10: error: 'START_DMA' undeclared (first use in this function); did you mean 'STARTDOC'?
  230 |     case START_DMA: {
      |          ^~~~~~~~~
      |          STARTDOC
../hw/dma/apple_sio.c:259:10: error: 'QUERY_DMA' undeclared (first use in this function)
  259 |     case QUERY_DMA:
      |          ^~~~~~~~~
../hw/dma/apple_sio.c:264:20: error: 'QUERY_DMA_OK' undeclared (first use in this function)
  264 |         reply.op = QUERY_DMA_OK;
      |                    ^~~~~~~~~~~~
../hw/dma/apple_sio.c:267:10: error: 'STOP_DMA' undeclared (first use in this function)
  267 |     case STOP_DMA:
      |          ^~~~~~~~
ninja: build stopped: subcommand failed.
make: *** [Makefile:162: run-ninja] Error 1

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

No branches or pull requests

4 participants