Skip to content

Wrap linker flags on Windows for IntelLLVM #772

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

Merged

Conversation

Maetveis
Copy link
Contributor

@Maetveis Maetveis commented Oct 2, 2024

The Intel C++ compiler requires linker flags to be wrapped, because CMake passes them through the compiler driver.
Prefix Linker options with LINKER:.
CMake will transform it to the appropriate flag for the compiler driver: (Nothing for MSVC, clang-cl and /Qoption,link for ICX), so this will work for the other compilers too, and for earlier versions of CMake.

Fixes: #757

Checklist

  • Code compiles without errors locally
  • All tests pass locally -- (Only verified building)
  • CI workflows execute properly

The Intel C++ compiler requires linker flags to be wrapped, because
CMake passes them through the compiler driver.
Prefix Linker options with `LINKER:`.
CMake will transform it to the appropriate flag for the compiler driver:
(Nothing for MSVC, clang-cl and /Qoption,link for ICX), so this will
work for the other compilers too, and for earlier versions of CMake.

Fixes: oneapi-src#757
Signed-off-by: Gergely Meszaros <[email protected]>
@bratpiorka bratpiorka requested a review from PatKamin October 3, 2024 07:59
Copy link
Contributor

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@lplewa
Copy link
Contributor

lplewa commented Oct 3, 2024

I think we need reproduce this issue on CI - without it, we will break it again, as no one will remember that we have to do this workaround.

Do we have build with icx on Windows in our CI? I see only a linux one. @lukaszstolarczuk can you check this?

@lukaszstolarczuk
Copy link
Contributor

I think we need reproduce this issue on CI - without it, we will break it again, as no one will remember that we have to do this workaround.

Do we have build with icx on Windows in our CI? I see only a linux one. @lukaszstolarczuk can you check this?

Yeah, of course we don't have such job. I tried to add it, but failed with the task 😞
@Maetveis, could you take a look if I'm missing something...? CMake seems to be unable to compile a simple program with icx in my workflow...

Workflow: lukaszstolarczuk@e3dd2fe

Example CI run: https://github.com/lukaszstolarczuk/unified-memory-framework/actions/runs/11181888055/job/31086892308#step:9:37

@Maetveis
Copy link
Contributor Author

Maetveis commented Oct 7, 2024

Yeah, of course we don't have such job. I tried to add it, but failed with the task 😞 @Maetveis, could you take a look if I'm missing something...? CMake seems to be unable to compile a simple program with icx in my workflow...

I don't see anything obviously wrong. I couldn't reproduce the error locally either, it probably has something to do with what's installed in github's windows image. I wonder what version of cmake is on the path by default for example. https://github.com/mxschmitt/action-tmate might come handy for debugging, though I never used it myself.

@ldorau
Copy link
Contributor

ldorau commented Oct 7, 2024

I think we need reproduce this issue on CI - without it, we will break it again, as no one will remember that we have to do this workaround.
Do we have build with icx on Windows in our CI? I see only a linux one. @lukaszstolarczuk can you check this?

Yeah, of course we don't have such job. I tried to add it, but failed with the task 😞 @Maetveis, could you take a look if I'm missing something...? CMake seems to be unable to compile a simple program with icx in my workflow...

Workflow: lukaszstolarczuk@e3dd2fe

Example CI run: https://github.com/lukaszstolarczuk/unified-memory-framework/actions/runs/11181888055/job/31086892308#step:9:37

@lukaszstolarczuk I suppose that the environment variables should be set (the .\setvars-vcvarsall.bat and .\setvars.bat scripts should be called) at the beginning of each of the following steps: Configure build, Build UMF and Run tests - like we do on Linux:
https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L153
https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L173
https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L179

because the environment variables set in one step are NOT passed to the next step.

@lukaszstolarczuk
Copy link
Contributor

I think we need reproduce this issue on CI - without it, we will break it again, as no one will remember that we have to do this workaround.
Do we have build with icx on Windows in our CI? I see only a linux one. @lukaszstolarczuk can you check this?

Yeah, of course we don't have such job. I tried to add it, but failed with the task 😞 @Maetveis, could you take a look if I'm missing something...? CMake seems to be unable to compile a simple program with icx in my workflow...
Workflow: lukaszstolarczuk@e3dd2fe
Example CI run: https://github.com/lukaszstolarczuk/unified-memory-framework/actions/runs/11181888055/job/31086892308#step:9:37

@lukaszstolarczuk I suppose that the environment variables should be set (the .\setvars-vcvarsall.bat and .\setvars.bat scripts should be called) at the beginning of each of the following steps: Configure build, Build UMF and Run tests - like we do on Linux: https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L153 https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L173 https://github.com/oneapi-src/unified-memory-framework/blob/main/.github/workflows/basic.yml#L179

because the environment variables set in one step are NOT passed to the next step.

haha, of course, thanks, I'll check it!

@lukaszstolarczuk
Copy link
Contributor

@ldorau, thanks, that was the issue, now the workflow is working properly!

@Maetveis, thanks for the patch. I verified it with my workflow and it fixes the issue!
// workflow will be delivered in a sep. PR.

@lukaszstolarczuk lukaszstolarczuk merged commit e6ff45e into oneapi-src:main Oct 7, 2024
72 checks passed
lukaszstolarczuk added a commit to lukaszstolarczuk/unified-memory-framework that referenced this pull request Oct 8, 2024
lukaszstolarczuk added a commit to lukaszstolarczuk/unified-memory-framework that referenced this pull request Oct 8, 2024
bratpiorka pushed a commit to bratpiorka/unified-memory-framework that referenced this pull request Oct 10, 2024
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.

Unescaped linker flags when building with the Intel C++ Compiler on Windows and CMake > 3.25
5 participants