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

Fix building with clang and lld #294

Merged
merged 5 commits into from
Jan 25, 2023
Merged

Conversation

hadogenes
Copy link

when building zfs dkms module it fails because KERNEL_CC and KERNEL_LD wasn't set correctly

Jacek Szafarkiewicz added 3 commits January 22, 2023 21:45
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
@xuzhen
Copy link
Collaborator

xuzhen commented Jan 24, 2023

I can confirm that exporting correct KERNEL_CC and KERNEL_LD resolves the compilation failure of zfs-dkms.
But after applying your patches, there is still a problem that will cause the compilation to fail.

The line cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' "${kernel_config}"), introduced by 1303d13, is not a reliable way to set CC and KERNEL_CC for clang.
In Ubuntu, clang's version text is Ubuntu clang version x.y.z. That line will give cc=Ubuntu.

We may need to test CONFIG_CC_IS_CLANG and get clang version from CONFIG_CLANG_VERSION.

@xuzhen
Copy link
Collaborator

xuzhen commented Jan 24, 2023

And please change the two variables cc and ld into local variables.

Jacek Szafarkiewicz added 2 commits January 24, 2023 10:15
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
Signed-off-by: Jacek Szafarkiewicz <szafar@linux.pl>
@hadogenes
Copy link
Author

@xuzhen corrected

@xuzhen xuzhen merged commit df5894f into dell:master Jan 25, 2023
@hadogenes hadogenes deleted the build_clang_and_lld branch February 23, 2023 10:33
@evelikov
Copy link
Collaborator

@hadogenes can we interest you in adding zfs into our testing matrix? @xuzhen is doing some amazing work fixing all the CC/LD detection and it would be great if we don't break zfs-dkms.

@hadogenes hadogenes restored the build_clang_and_lld branch March 12, 2023 12:50
@hadogenes hadogenes deleted the build_clang_and_lld branch March 12, 2023 12:50
@hadogenes
Copy link
Author

It would be great idea, but I don't know how to get kernel compiled with clang.
Maybe ArchLinux and AUR, but it would take a lot of time to compile kernel and than dkms CI.

@evelikov
Copy link
Collaborator

evelikov commented Mar 14, 2023

@hadogenes you can use the CI from this MR as reference:

  • tiny/clang kernel build/install
  • install the new dkms
    ^^ from the MR, trim down to clang/llvm 14 only, don't bother with the sign stuff
  • get the zfs code - git clone/curl/wget tarballs?
  • dkms add/build/install
  • dkms status + some sanity checks as you see fit

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.

3 participants