Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MinGW] Do not deploy files to /usr/cmake #7759

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

StephenCWills
Copy link
Member

This PR introduces a command into the MinGW setup script that comments two lines in the SDL2 Makefile, preventing the script from creating the /usr/cmake directory and deploying files to it.

Normally, the script deploys these two files:

  • /usr/cmake/sdl2-config.cmake
  • /usr/cmake/sdl2-config-version.cmake

These files appear to be unnecessary for compiling using MinGW compilers, but their presence does cause problems when attempting to build using native gcc compilers.


I encountered several warnings during CMake configuration when these files were present. This happens during first time configuration after having run the Packaging/windows/mingw-prep64.sh script, so you may not encounter this error if you have files already in your build folder or if you haven't tried building using MinGW compilers. The warnings all look very similar to the following.

CMake Warning at CMakeLists.txt:345 (add_executable):
  Cannot generate a safe linker search path for target devilutionx because
  files in some directories may conflict with libraries in implicit
  directories:

    link library [libm.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/x86_64-w64-mingw32/lib

  Some of these libraries may not be found correctly.

After seeing this warning, I encountered an error when attempting to build.

c++: error: unrecognized command-line option ‘-mwindows’

Anyone who has encountered these warnings/errors after having compiled this project using MinGW compilers should check their /usr/cmake directory. Likely, you can just delete the whole thing since SDL2 seems to be the only library that uses it. Here is a safe way to handle it.

sudo rm /usr/cmake/sdl2-*
sudo rmdir /usr/cmake

@AJenbo AJenbo enabled auto-merge (rebase) February 17, 2025 05:45
@AJenbo AJenbo merged commit a2365c7 into diasurgical:master Feb 17, 2025
23 checks passed
@StephenCWills StephenCWills deleted the mingw-no-usr-cmake branch February 17, 2025 06:00
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.

2 participants