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

Libsc failes to compile with CMake on MinGW #206

Closed
jmark opened this issue Oct 31, 2024 · 4 comments
Closed

Libsc failes to compile with CMake on MinGW #206

jmark opened this issue Oct 31, 2024 · 4 comments

Comments

@jmark
Copy link

jmark commented Oct 31, 2024

Description

Compilation failes with CMake on MinGW platform. This problem is associated with creating
a t8code JLL package. See this pull request: JuliaPackaging/Yggdrasil#9718

The error output comes at llinking libsc with:
cannot find $<1:wsock32 and cannot find -lIphlpapi.
Especially, the first error output suggest that the generator expression is somehow wrong.

The used CMake version is v3.21.

The following patch solved the issue:
T/t8code/bundled/patches/libsc.patch

But it is not clear to me if this is a proper solution.

To Reproduce

For reproduction, I suggest to try to create a t8code JLL package via Yggdrasil without the application of the patches.

cd T/t8code/
julia build_tarballs.jl --debug=error --verbose x86_64-w64-mingw32-mpi+microsoftmpi

Additional information

I used Julia 1.11. But this shouldn't have any effect.

@cburstedde
Copy link
Owner

Thanks. I wouldn't mind adding a SC_WIN32 variable (with the prefix). @scivision: would that conflict with our windows builds that you usually execute?

@lukasdreyer
Copy link
Contributor

I think I stumbled about a similar problem last week.

The $<1:wsock32 variables that were not found above, come from these lines in CMakeLists.txt:

target_link_libraries(sc PUBLIC
$<$<BOOL:${SC_ENABLE_MPI}>:MPI::MPI_C>
$<$<BOOL:${SC_HAVE_ZLIB}>:ZLIB::ZLIB>
$<$<BOOL:${SC_HAVE_JSON}>:jansson::jansson>
$<$<BOOL:${SC_NEED_M}>:m>
$<$<BOOL:${WIN32}>:${WINSOCK_LIBRARIES}>
)

I got a similar warning when trying to include the sc library in a cmake build, but with one of the other variables. When i replaced the <$<0 by nothing and the <$<1 by the needed variable name in the SC-targets.cmake, everything built fine.

I am not sure why the generator expression does not work here, but would replacing it by seperate target_link_libraries calls wrapped in corresponding if clauses be an option?

@scivision
Copy link
Contributor

scivision commented Jan 2, 2025

I believe this was fixed by #212
The root cause may have been missing quotes "" enclosing the generator expression when a list variable is invoked. The #212 solution of using plain if(WIN32) is clearer, equivalent, and less typo-prone.

@jmark
Copy link
Author

jmark commented Jan 6, 2025

Thank you all for your input! I consider this issue resolved.

@jmark jmark closed this as completed Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants