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

SDL2 threading config in ./cmake/sdlchecks.cmake not correct for non-GNU compiler (e.g. SunPro cc) #10096

Open
joncox123 opened this issue Jun 23, 2024 · 2 comments
Assignees
Milestone

Comments

@joncox123
Copy link

Within the cmake config script, ./cmake/sdlchecks.cmake, there is a check that decides how to enable pthread support for different platforms. If this check detects a platform of either "Solaris" or "SunOS", it issues set(PTHREAD_LDFLAGS "-pthread -lposix4"). However this is only correct for the GNU toolchain, such as gcc. As a result, configure and CMake will fail trying to find threading support on Solaris 10 1/13 (SPARC), and the build will fail, if it is being compiled with Sun's Solaris Studio 12.4 compilers, for example.

According to the Oracle documentation, the correct way to enabled pthread support is to use -mt -lpthread. Therefore, I suggest that a check be made more sophisticated, such that if GNU is not being used, the command is instead set(PTHREAD_LDFLAGS "-mt -lpthread"). I think there are other places in the CMake scripts that do check for GNU, so this should be trivial to add.

I don't think we should be assuming use of the GNU toolchain because they continue to introduce incompatible, breaking features and flags. FSF is great, but they have become so successful they are almost like Microsoft was in the 90s in that regard.

@slouken slouken added this to the 3.2.0 milestone Jun 23, 2024
@madebr
Copy link
Contributor

madebr commented Jun 23, 2024

What is the output of the following, when pasted at the bottom of SDL's cmake script?

message("CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")

@icculus
Copy link
Collaborator

icculus commented Jun 28, 2024

I managed to get CMake 3.14 to work.

CMAKE_C_COMPILER_ID: SunPro

Also, if(SOLARIS) works, too.

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

No branches or pull requests

4 participants