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 CC detection #334

Merged
merged 6 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- {name: "centos", tag: "7"}
- {name: "almalinux", tag: "9"}
- {name: "almalinux", tag: "8"}
- {name: "debian", tag: "12"}
- {name: "debian", tag: "11"}
- {name: "debian", tag: "10"}
- {name: "ubuntu", tag: "22.04"}
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
if: matrix.distro.name == 'debian'
run: |
apt-get update -q
apt-get install -qy gcc make linux-headers-amd64 linux-image-amd64 openssl
apt-get install -qy make linux-headers-amd64 linux-image-amd64 openssl
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting - Arch and Fedora (IIRC) don't pull the compiler stack, when the headers are installed.

Should we do the same change in the Ubuntu case below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already tried, the gcc dependency is required at least for older Ubuntu releases.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack, please mention that in the commit message. For non Debian/Ubuntu experts such variations are non-obvious. Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

jfyi @xnox is the above variation, something Ubuntu team is willing to address? I don't have a strong opinion, just making sure devs in both distros are aware.

Copy link
Contributor

Choose a reason for hiding this comment

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

even i don't know or understand if and when and why we have compiler depedency. i think in ubuntu we add "Package: dkms Depends: gcc" because we don't have dependency from headers to the compiler either (similarish to fedora). But we also have different compilers used for different kernels, thus maybe our headers should pull in correct compiler in.....


- name: Install Ubuntu dependencies
if: matrix.distro.name == 'ubuntu'
Expand Down
21 changes: 15 additions & 6 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ setup_kernels_arches()
fi
fi
fi
if [[ ! $arch ]]; then
die 12 $"Could not determine architecture."
fi
fi
anbe42 marked this conversation as resolved.
Show resolved Hide resolved

# If only one arch is specified, make it so for all the kernels
Expand Down Expand Up @@ -1061,7 +1064,19 @@ prepare_build()
$"Check $build_dir for more information."
done

if [ -f "$kernel_source_dir/.kernelvariables" ]; then
export CC=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $kernel_source_dir/.kernelvariables" | make -f - show-CC)
else
unset CC
fi

if [[ -e "${kernel_config}" ]]; then
anbe42 marked this conversation as resolved.
Show resolved Hide resolved
local cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' "${kernel_config}")
if command -v "$cc" >/dev/null; then
export CC="$cc"
export KERNEL_CC="$cc"
fi

if grep -q 'CONFIG_CC_IS_CLANG=y' "${kernel_config}"; then
Copy link
Collaborator

@evelikov evelikov Jun 12, 2023

Choose a reason for hiding this comment

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

The hunk was removed by @hadogenes with 4729aef. *Reintroducing it seems correct at a glance.

@hadogenes can you confirm this doesn't regress on your end? Which Suse variant/version are you using - SLES, Leap, Tumbleweed? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clang detection is probably wrong if versioned clang-xx is to be used, but as long as we don't have a clang compiled kernel in Debian, I'm not going to investigate

local cc=clang
if command -v "$cc" >/dev/null; then
Expand Down Expand Up @@ -1094,12 +1109,6 @@ actual_build()
echo $""
echo $"Building module:"

if [ -f "$kernel_source_dir/.kernelvariables" ]; then
export CC=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $kernel_source_dir/.kernelvariables" | make -f - show-CC)
else
unset CC
fi

invoke_command "$clean" "Cleaning build area" background
echo $"DKMS make.log for $module-$module_version for kernel $kernelver ($arch)" >> "$build_log"
date >> "$build_log"
Expand Down