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

Remove indirection from ocloc_lib and ocloc names #456

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zboszor
Copy link

@zboszor zboszor commented Sep 18, 2021

This allows CMAKE to wrap the executable with
-DCMAKE_CROSSCOMPILING_EMULATOR=...

Signed-off-by: Zoltán Böszörményi <[email protected]>

@@ -6,18 +6,6 @@

function(level_zero_gen_kernels target platform_name suffix options)

if(NOT DEFINED cloc_cmd_prefix)
Copy link
Contributor

Choose a reason for hiding this comment

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

could you pass -Dcloc_cmd_prefix=ocloc to cmake command in your environment instead of removing this code?

Copy link
Author

Choose a reason for hiding this comment

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

The problem is that with two or more levels of variable indirection, cmake doesn't apply the CMAKE_CROSSCOMPILING_EMULATOR wrapper command and this is the case with cloc_cmd_prefix.

Copy link
Contributor

@JablonskiMateusz JablonskiMateusz Oct 5, 2021

Choose a reason for hiding this comment

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

For these add_custom_command there is only one level of indirection - usage of ${cloc_cmd_prefix}. The problem I see with using CMAKE_CROSSCOMPILING_EMULATOR is that cmake adds CMAKE_CROSSCOMPILING_EMULATOR before command and in our default scenario there will be something like ${CMAKE_CROSSCOMPILING_EMULATOR} LD_LIBRARY_PATH=... ocloc ... which will cause issue as environment variable cannot be defined in the middle of cmdline. Therefore I hope that if you define cloc_cmd_prefix as ocloc then you will get ${CMAKE_CROSSCOMPILING_EMULATOR} ocloc ... which looks like a valid cmdline. Please double check that.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zboszor have you checked if -Dcloc_cmd_prefix=ocloc helps for the issue?

Copy link
Author

@zboszor zboszor Oct 26, 2021

Choose a reason for hiding this comment

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

Yes, I checked. It is this way in meta-intel and it's good if ocloc is built for running on the crosscompiling host.
But it is broken if coupled with -DCMAKE_CROSSCOMPILING_EMULATOR=...

Copy link
Contributor

Choose a reason for hiding this comment

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

could you share build logs? what exactly is broken?

Copy link
Author

Choose a reason for hiding this comment

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

could you share build logs? what exactly is broken?

I don't have the build logs.
The issue is that the ocloc command is not prefixed with the crosscompiling wrapper.
If ocloc is cross-built for the target, it can't run properly using the host libraries.
E.g. the Yocto cross-build is not multilib but the host is, the runtime linker path is not good to run the binary without the wrapper that executes the binary in qemu, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

@zboszor could you verify if it is still needed? cross-build with qemu works fine for us

@@ -4,9 +4,8 @@
# SPDX-License-Identifier: MIT
#

project(${OCLOC_NAME}_lib)
project(ocloc_lib)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this change needed? I see what can be incorrect with our current implementation - project is defined before OCLOC_NAME is defined which evaluates to project(_lib) . Simply moving set(OCLOC_NAME "ocloc") to a line before project(${OCLOC_NAME}_lib) should fix this issue

Copy link
Author

Choose a reason for hiding this comment

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

It's not really needed. It just looked more consistent with the rest of this patch.

@zboszor zboszor force-pushed the master branch 3 times, most recently from fa0fce1 to 7232ef5 Compare October 31, 2021 08:30
This allows CMAKE to wrap the executable with
-DCMAKE_CROSSCOMPILING_EMULATOR=...

Signed-off-by: Zoltán Böszörményi <[email protected]>
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