Skip to content

Conversation

@trofi
Copy link

@trofi trofi commented Feb 8, 2024

Two simple changes for gcc-13 compatibility:

Add missing headers reported by gcc-13
controller.c: fix adapter_detect() prototype consistency

trofi added 2 commits February 8, 2024 08:23
Without the change the build fails against `gcc-13` as:

    gimx.c:587:3: error: incompatible implicit declaration
        of built-in function 'free' [-Werror=builtin-declaration-mismatch]
      587 |   free(gimx_params.homedir);
          |   ^~~~
WIthout the change the build of `gcc-13` fails as:

    controller.c:922:15: error: conflicting types for 'adapter_detect'
      due to enum/integer mismatch; have 'e_gimx_status()' [-Werror=enum-int-mismatch]
      922 | e_gimx_status adapter_detect()
          |               ^~~~~~~~~~~~~~
@FaridLaib
Copy link

@trofi Hey man, are you able to compile on Win? the Inno is not creating the setup for me

make[2]: Entering directory '/d/GIMX test/GIMX-build/windows/GIMX/shared/gimxcontroller'
cc -fPIC -Iinclude -Wall -Wextra -Werror -O3 -D__USE_MINGW_ANSI_STDIO=0 -I../ -DGLOG_NAME=gimxcontroller -c -o src/controller.o src/controller.c
src/controller.c: In function 'controller_get_axis_index':
src/controller.c:361:10: error: the comparison will always evaluate as 'true' for the address of 'name' will never be NULL [-Werror=address]
361 | if(controllers[C_TYPE_SIXAXIS]->axes[i].name)
| ^~~~~~~~~~~
In file included from src/controller.c:6:
src/../include/controller.h:46:14: note: 'name' declared here
46 | const char name[AXIS_NAME_MAX_SIZE];
| ^~~~
cc1.exe: all warnings being treated as errors
make[2]: *** [: src/controller.o] Error 1
make[2]: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX/shared/gimxcontroller'
make[1]: *** [Makefile:35: build-gimxcontroller] Error 2
make[1]: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX/shared'
make: *** [Makefile:15: build-shared] Error 2
make: Leaving directory '/d/GIMX test/GIMX-build/windows/GIMX'

@trofi
Copy link
Author

trofi commented Apr 25, 2024

I did not try windows but on linux we have to workaround a similar error.

It is caused by use of blanket -Werror in Makedefs files in a few places. Try removing the -Werror from there.

In nixpkgs we pass extra compiler flags to workaround it as: -Wno-error=address -Wno-error=deprecated-declarations -Wno-error=use-after-free

@FaridLaib
Copy link

Any chance you can send me the updated one? I want to compile the win version. Linux worked just fine.
It's been 5 days straight and I'm unable to compile it in Windows (tried adding missing headers, removing -Werror- and much more, but I keep digging a hole.

Eclipes IDE
Mingw64 and GCC 13.xx
Downloaded all the missing libraries (SDL, CURL and others).

Any guidance really would be appreciated.

@FaridLaib
Copy link

@trofi I also have countless missing headers. I added them to the Path, and got a lot of them resolved. Did you had to point to the include folders and such?

Thanks

@trofi
Copy link
Author

trofi commented Apr 25, 2024

No, this PR (and disabled warnings) is all I needed to get it to build.

@crowbarmaster
Copy link

To build on windows, I followed the build guide to a tee, and removed all -Werror flags. After that, it built just fine. using GCC 12 here. I have not used the code modifications listed here, either. After the build, some might have issues with Inno. You will have to fix the build script to target Inno 6 as Inno 5 is retired and hard-coded into the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants