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

chore(pkg/driverbuiler): avoid overriding CC at build time. #322

Closed
wants to merge 1 commit into from

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Mar 7, 2024

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area pkg

What this PR does / why we need it:

Instead, set CMAKE_C_COMPILER variable at cmake configure step.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Instead, set CMAKE_C_COMPILER variable at cmake configure step.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@poiana
Copy link

poiana commented Mar 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -76,7 +77,6 @@ type commonTemplateData struct {
ModuleFullPath string
BuildModule bool
BuildProbe bool
GCCVersion string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need the templated GCCVersion anymore since we already pass a correctly formatted cmake command to builders.

c.DriverVersion),
},
UseDKMS: l.UseDKMS,
DownloadSrc: len(l.SrcDir) == 0, // if no srcdir is provided, download src!
DriverVersion: c.DriverVersion,
KernelRelease: c.KernelRelease,
GCCPath: l.GccPath,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When building through dkms, cmake is not involved, therefore for local script, it must still be passed somehow.

@FedeDP
Copy link
Contributor Author

FedeDP commented Mar 7, 2024

Uh it seems like debian for example (but possible other builders) overriddes CC in the kernel sources makefiles, using the gcc it was built with; in Debian, we set CMAKE_C_COMPILER to /usr/bin/gcc-11.0.0 but then it tries to build it using gcc-10:

level=DEBUG msg="+ cmake -Wno-dev -DUSE_BUNDLED_DEPS=On -DCREATE_TEST_TARGETS=Off -DBUILD_LIBSCAP_GVISOR=Off -DBUILD_LIBSCAP_MODERN_BPF=Off -DENABLE_DRIVERS_TESTS=Off -DDRIVER_NAME=falco -DPROBE_NAME=falco -DBUILD_BPF=On -DDRIVER_VERSION=17f5df52a7d9ed6bb12d3b1768460def8439936d -DPROBE_VERSION=17f5df52a7d9ed6bb12d3b1768460def8439936d -DGIT_COMMIT=17f5df52a7d9ed6bb12d3b1768460def8439936d -DDRIVER_DEVICE_NAME=falco -DPROBE_DEVICE_NAME=falco -DCMAKE_C_COMPILER=/usr/bin/gcc-11.0.0 .."

...

level=DEBUG msg="make[6]: gcc-10: No such file or directory"

and indeed:

level=DEBUG msg="+ grep -R CC_VERSION /usr/src/linux-headers-5.10.0-10-amd64"
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/scripts/Kbuild.include:cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))"
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/.config:CONFIG_CC_VERSION_TEXT="gcc-10 (Debian 10.2.1-6) 10.2.1 20210110""
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/.config:CONFIG_GCC_VERSION=100201"
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/include/generated/autoconf.h:#define CONFIG_CC_VERSION_TEXT "gcc-10 (Debian 10.2.1-6) 10.2.1 20210110""
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/include/generated/autoconf.h:#define CONFIG_GCC_VERSION 100201"
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/include/config/auto.conf:CONFIG_CC_VERSION_TEXT="gcc-10 (Debian 10.2.1-6) 10.2.1 20210110""
level=DEBUG msg="/usr/src/linux-headers-5.10.0-10-amd64/include/config/auto.conf:CONFIG_GCC_VERSION=100201"

@FedeDP
Copy link
Contributor Author

FedeDP commented Mar 7, 2024

/close

@poiana poiana closed this Mar 7, 2024
@poiana
Copy link

poiana commented Mar 7, 2024

@FedeDP: Closed this PR.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants