Wrong io.h

Discussion of development and patch submission.
Post Reply
darksabre76
Posts: 69
Joined: Tue 12 Sep, 2017 4:33 am
Location: Seattle, WA, USA
Contact:

Wrong io.h

Post by darksabre76 »

I'm currently trying to figure out how to "unify" the build process between Linux and Windows by making the MSYS2/MinGW steps much more akin to the Linux "configure-make-install" path. I just submitted a patch that allows MSYS2 (at least) users to get past the configure step. Now I'm stuck at make. For some reason, when I try running make in MSYS2, I get an issue with 808x.c:

Code: Select all

gcc -DPACKAGE_NAME=\"PCem\" -DPACKAGE_TARNAME=\"pcem\" -DPACKAGE_VERSION=\"v12\" -DPACKAGE_STRING=\"PCem\ v12\" -DPACKAGE_BUGREPORT=\"Sarah\ Walker\ \<pcem@pcem-emulator.co.uk\>\" -DPACKAGE_URL=\"\" -DPACKAGE=\"pcem\" -DVERSION=\"v12\" -DHAVE_LIBPTHREAD=1 -DHAVE_LIBGL=1 -DHAVE_LIBOPENAL=1 -I.    -IC:/Users/Matt/Downloads/EmuBuild/mingw32/lib/wx/include/msw-unicode-3.0 -IC:/Users/Matt/Downloads/EmuBuild/mingw32/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__ -mthreads -fpermissive -I/mingw32/include/SDL2 -Dmain=SDL_main -msse2     -O3 -MT pcem-808x.o -MD -MP -MF .deps/pcem-808x.Tpo -c -o pcem-808x.o `test -f '808x.c' || echo './'`808x.c
cc1.exe: warning: command line option '-fpermissive' is valid for C++/ObjC++ but not for C
In file included from C:/Users/Matt/Downloads/EmuBuild/mingw32/i686-w64-mingw32/include/unistd.h:10:0,
                 from 808x.c:12:
./io.h:3:20: error: unknown type name 'uint16_t'
 void io_sethandler(uint16_t base, int size,
                    ^~~~~~~~
./io.h:4:20: error: unknown type name 'uint8_t'
                    uint8_t  (*inb)(uint16_t addr, void *priv),
                    ^~~~~~~
./io.h:5:20: error: unknown type name 'uint16_t'
                    uint16_t (*inw)(uint16_t addr, void *priv),
                    ^~~~~~~~
./io.h:6:20: error: unknown type name 'uint32_t'
                    uint32_t (*inl)(uint16_t addr, void *priv),
                    ^~~~~~~~
./io.h:7:33: error: unknown type name 'uint16_t'
                    void (*outb)(uint16_t addr, uint8_t  val, void *priv),
                                 ^~~~~~~~
./io.h:7:48: error: unknown type name 'uint8_t'
                    void (*outb)(uint16_t addr, uint8_t  val, void *priv),
                                                ^~~~~~~
./io.h:8:20: error: expected ';', ',' or ')' before 'void'
                    void (*outw)(uint16_t addr, uint16_t val, void *priv),
                    ^~~~
./io.h:12:23: error: unknown type name 'uint16_t'
 void io_removehandler(uint16_t base, int size,
                       ^~~~~~~~
./io.h:13:20: error: unknown type name 'uint8_t'
                    uint8_t  (*inb)(uint16_t addr, void *priv),
                    ^~~~~~~
./io.h:14:20: error: unknown type name 'uint16_t'
                    uint16_t (*inw)(uint16_t addr, void *priv),
                    ^~~~~~~~
./io.h:15:20: error: unknown type name 'uint32_t'
                    uint32_t (*inl)(uint16_t addr, void *priv),
                    ^~~~~~~~
./io.h:16:33: error: unknown type name 'uint16_t'
                    void (*outb)(uint16_t addr, uint8_t  val, void *priv),
                                 ^~~~~~~~
./io.h:16:48: error: unknown type name 'uint8_t'
                    void (*outb)(uint16_t addr, uint8_t  val, void *priv),
                                                ^~~~~~~
./io.h:17:20: error: expected ';', ',' or ')' before 'void'
                    void (*outw)(uint16_t addr, uint16_t val, void *priv),
                    ^~~~
808x.c: In function 'dumpregs':
808x.c:511:9: warning: implicit declaration of function 'chdir' [-Wimplicit-function-declaratio ]
         chdir(logs_path);
         ^~~~~
make[1]: *** [Makefile:938: pcem-808x.o] Error 1
I followed the error and it seems like the referenced unistd.h references the system io.h... in theory. In practice, it seems to be grabbing the one from src/io.h. I'm very unfamiliar with the C/C++ build process, and my Google skills have failed me miserably. Any suggestions on how to get past this?

Note: I double checked the Linux build on an Ubuntu Mate laptop and the same compile line does not cause the same error. This seems specific to MinGW, somehow.
A. Naim
Posts: 139
Joined: Thu 09 Jul, 2015 5:06 pm

Re: Wrong io.h

Post by A. Naim »

It does seem, on first glance, that you're missing C's standard ints header file. Google says that's "<cstdint>".
darksabre76
Posts: 69
Joined: Tue 12 Sep, 2017 4:33 am
Location: Seattle, WA, USA
Contact:

Re: Wrong io.h

Post by darksabre76 »

So, yes, that does seem to be the surface issue. But the actual issue is that these calls are in "src/io.h" and not the system "includes/io.h". I had actually looked into the unknown types first, but that came to a dead-end when I realized that those line numbers in "includes/io.h" didn't actually have references to those types.
shermanp
Posts: 175
Joined: Sat 18 Feb, 2017 2:09 am

Re: Wrong io.h

Post by shermanp »

Yeah, it looks like the system 'io.h' and pcem 'io.h' are completely different headers.

My only thought is that maybe the current source directory has been added to the standard header search path, and that is being searched before the system library path?
darksabre76
Posts: 69
Joined: Tue 12 Sep, 2017 4:33 am
Location: Seattle, WA, USA
Contact:

Re: Wrong io.h

Post by darksabre76 »

Again, yes and no. On Linux, the search path is identical (given that the actual location of the libraries and headers is different, blah, blah) in that "." is the first thing in the search path. Also on Linux, this does not seem to affect how well it can find the correct io.h. This only seems to happen for the MSYS2/MinGW build. The only things that I've seen that work for people are things like using '-nostdinc' and then redefining the entire include set, or just renaming the file that's causing the conflict. I tried Option A and basically got nowhere fast. I don't want to do Option B because that will just cause unnecessary changes to the project. :|
Post Reply