Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #61368 > unrolled thread

dkms: Build with an alternative like compiler rather than gcc

Started bySedat Dilek <sedat.dilek@gmail.com>
First post2018-07-09 16:10 +0200
Last post2018-07-09 17:10 +0200
Articles 7 — 3 participants

Back to article view | Back to linux.debian.kernel


Contents

  dkms: Build with an alternative like compiler rather than gcc Sedat Dilek <sedat.dilek@gmail.com> - 2018-07-09 16:10 +0200
    Re: dkms: Build with an alternative like compiler rather than gcc Petter Reinholdtsen <pere@hungry.com> - 2018-07-09 16:40 +0200
      Re: dkms: Build with an alternative like compiler rather than gcc Sedat Dilek <sedat.dilek@gmail.com> - 2018-07-09 17:00 +0200
      Re: dkms: Build with an alternative like compiler rather than gcc Sedat Dilek <sedat.dilek@gmail.com> - 2018-07-09 17:00 +0200
        RE: dkms: Build with an alternative like compiler rather than gcc <Mario.Limonciello@dell.com> - 2018-07-09 17:10 +0200
          Re: dkms: Build with an alternative like compiler rather than gcc Sedat Dilek <sedat.dilek@gmail.com> - 2018-07-09 17:10 +0200
      RE: dkms: Build with an alternative like compiler rather than gcc <Mario.Limonciello@dell.com> - 2018-07-09 17:10 +0200

#61368 — dkms: Build with an alternative like compiler rather than gcc

FromSedat Dilek <sedat.dilek@gmail.com>
Date2018-07-09 16:10 +0200
Subjectdkms: Build with an alternative like compiler rather than gcc
Message-ID<w9F1w-2WQ-7@gated-at.bofh.it>
Hi,

I am experimenting with clang to compile an upstream Linux kernel
v4.14.y (here: y=54).
For this I use bindeb-pkg make-target from Linus upstream.

After installing the generated linux-headers and linux-image amd64
packages, the dkms kernel-modules were built with gcc-7 which defaults
to gcc.
As a result acpi-call and virtualbox dkms modules do not load (see [1]).

As a workaround I have symlinked my mycompiler wrapper-script to /usr/bin/gcc.
That works.

What is the recommended way to do this correctly?
Is there an CC option for dkms.conf?
Use the update-alternatives system for configuring/installing clang as
an cc-alternative?

Thanks.

Regards,
- Sedat -

[1] https://lkml.org/lkml/2018/6/1/724
[2] https://stackoverflow.com/questions/7832892/how-to-change-the-default-gcc-compiler-in-ubuntu

P.S.: Some instructions and informations which might be helpful

root@iniza# LANG=C update-alternatives --display cc
cc - auto mode
  link best version is /usr/bin/gcc
  link currently points to /usr/bin/gcc
  link cc is /usr/bin/cc
/usr/bin/gcc - priority 20

root# dpkg --purge tp-smapi-dkms <--- XXX: Does not work with Lenovo
ThinkPad T470

root# dkms status -k 4.14.54-1-iniza-llvmlinux
acpi-call, 1.1.0, 4.14.54-1-iniza-llvmlinux, x86_64: installed
virtualbox, 5.2.10, 4.14.54-1-iniza-llvmlinux, x86_64: installed

root# dkms remove acpi-call -v 1.1.0 -k 4.14.54-1-iniza-llvmlinux
root# dkms remove virtualbox -v 5.2.10 -k 4.14.54-1-iniza-llvmlinux

root# cat /usr/bin/mycompiler
#!/bin/bash

ccache clang-7 "$@"

root# cd /usr/bin ; ln -sf mycompiler gcc <--- XXX: Workaround

root# LANG=C dkms install acpi-call -v 1.1.0 -k 4.14.54-1-iniza-llvmlinux
root# LANG=C dkms install virtualbox -v 5.2.10 -k 4.14.54-1-iniza-llvmlinux

root# cd /usr/bin ; ln -sf gcc-7 gcc <--- XXX: System default

[toc] | [next] | [standalone]


#61369

FromPetter Reinholdtsen <pere@hungry.com>
Date2018-07-09 16:40 +0200
Message-ID<w9Fux-36y-7@gated-at.bofh.it>
In reply to#61368
[Sedat Dilek]
> As a workaround I have symlinked my mycompiler wrapper-script to
> /usr/bin/gcc.  That works.
>
> What is the recommended way to do this correctly?

Perhaps you should use dpkg-divert to ensure your replaced gcc is not
lost in a future package upgrade?

The DKMS team in Debian need active members.  I'm not one of them. :(

-- 
Happy hacking
Petter Reinholdtsen

[toc] | [prev] | [next] | [standalone]


#61370

FromSedat Dilek <sedat.dilek@gmail.com>
Date2018-07-09 17:00 +0200
Message-ID<w9FNU-3cX-13@gated-at.bofh.it>
In reply to#61369
On Mon, Jul 9, 2018 at 4:31 PM, Petter Reinholdtsen <pere@hungry.com> wrote:
>
> [Sedat Dilek]
>> As a workaround I have symlinked my mycompiler wrapper-script to
>> /usr/bin/gcc.  That works.
>>
>> What is the recommended way to do this correctly?
>
> Perhaps you should use dpkg-divert to ensure your replaced gcc is not
> lost in a future package upgrade?
>
> The DKMS team in Debian need active members.  I'm not one of them. :(
>

I am thinking of using mycompiler as an cc alternative, the same with
c++ and cpp.
The wrapper-script(s) let me pass compiler-options, too.
So this is very flexible.

Active members... the alioth email-adress in the dsc-file seems no longer valid.

Thanks for the response.

- sed@ -

[toc] | [prev] | [next] | [standalone]


#61371

FromSedat Dilek <sedat.dilek@gmail.com>
Date2018-07-09 17:00 +0200
Message-ID<w9FNV-3cX-37@gated-at.bofh.it>
In reply to#61369
On Mon, Jul 9, 2018 at 4:37 PM,  <Mario.Limonciello@dell.com> wrote:
>> -----Original Message-----
>> From: Petter Reinholdtsen [mailto:pere@hungry.com]
>> Sent: Monday, July 9, 2018 9:32 AM
>> To: sedat.dilek@gmail.com; David Paleino; Aron Xu; Limonciello, Mario; Giuseppe
>> Iuculano
>> Cc: Dynamic Kernel Modules Support Team; debian-kernel@lists.debian.org
>> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
>>
>>
>> [Sedat Dilek]
>> > As a workaround I have symlinked my mycompiler wrapper-script to
>> > /usr/bin/gcc.  That works.
>> >
>> > What is the recommended way to do this correctly?
>>
>> Perhaps you should use dpkg-divert to ensure your replaced gcc is not
>> lost in a future package upgrade?
>>
>> The DKMS team in Debian need active members.  I'm not one of them. :(
>>
>> --
>
> I think this is an upstream problem not at all specific to Debian's implementation.
> I would recommend to bring this discussion upstream to get it fixed there.
>
> I believe DKMS unsets CC before starting build, but maybe that's wrong to do
> in this instance.
>

Personally, I do not think it is an upstream problem.
Unsetting CC before DKMS starts the build would explain the behaviour/handling.

- sed@ -

[toc] | [prev] | [next] | [standalone]


#61373

From<Mario.Limonciello@dell.com>
Date2018-07-09 17:10 +0200
Message-ID<w9FXz-3vq-3@gated-at.bofh.it>
In reply to#61371
> -----Original Message-----
> From: Sedat Dilek [mailto:sedat.dilek@gmail.com]
> Sent: Monday, July 9, 2018 9:41 AM
> To: Limonciello, Mario
> Cc: pere@hungry.com; dapal@debian.org; aron@debian.org;
> iuculano@debian.org; pkg-dkms-maint@lists.alioth.debian.org; debian-
> kernel@lists.debian.org
> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
> 
> On Mon, Jul 9, 2018 at 4:37 PM,  <Mario.Limonciello@dell.com> wrote:
> >> -----Original Message-----
> >> From: Petter Reinholdtsen [mailto:pere@hungry.com]
> >> Sent: Monday, July 9, 2018 9:32 AM
> >> To: sedat.dilek@gmail.com; David Paleino; Aron Xu; Limonciello, Mario;
> Giuseppe
> >> Iuculano
> >> Cc: Dynamic Kernel Modules Support Team; debian-kernel@lists.debian.org
> >> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
> >>
> >>
> >> [Sedat Dilek]
> >> > As a workaround I have symlinked my mycompiler wrapper-script to
> >> > /usr/bin/gcc.  That works.
> >> >
> >> > What is the recommended way to do this correctly?
> >>
> >> Perhaps you should use dpkg-divert to ensure your replaced gcc is not
> >> lost in a future package upgrade?
> >>
> >> The DKMS team in Debian need active members.  I'm not one of them. :(
> >>
> >> --
> >
> > I think this is an upstream problem not at all specific to Debian's implementation.
> > I would recommend to bring this discussion upstream to get it fixed there.
> >
> > I believe DKMS unsets CC before starting build, but maybe that's wrong to do
> > in this instance.
> >
> 
> Personally, I do not think it is an upstream problem.
> Unsetting CC before DKMS starts the build would explain the behaviour/handling.
> 

How exactly does clang get used by kernel build?  It's by setting CC variable right?
You can try to remove this line to see if it fixes the problem (it should).
https://github.com/dell/dkms/blob/master/dkms#L3515

The question would be where that variable should be ignored and where it shouldn't.
Which I believe is an upstream discussion not a Debian discussion.

[toc] | [prev] | [next] | [standalone]


#61374

FromSedat Dilek <sedat.dilek@gmail.com>
Date2018-07-09 17:10 +0200
Message-ID<w9FXz-3vq-5@gated-at.bofh.it>
In reply to#61373
On Mon, Jul 9, 2018 at 4:43 PM,  <Mario.Limonciello@dell.com> wrote:
>> -----Original Message-----
>> From: Sedat Dilek [mailto:sedat.dilek@gmail.com]
>> Sent: Monday, July 9, 2018 9:41 AM
>> To: Limonciello, Mario
>> Cc: pere@hungry.com; dapal@debian.org; aron@debian.org;
>> iuculano@debian.org; pkg-dkms-maint@lists.alioth.debian.org; debian-
>> kernel@lists.debian.org
>> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
>>
>> On Mon, Jul 9, 2018 at 4:37 PM,  <Mario.Limonciello@dell.com> wrote:
>> >> -----Original Message-----
>> >> From: Petter Reinholdtsen [mailto:pere@hungry.com]
>> >> Sent: Monday, July 9, 2018 9:32 AM
>> >> To: sedat.dilek@gmail.com; David Paleino; Aron Xu; Limonciello, Mario;
>> Giuseppe
>> >> Iuculano
>> >> Cc: Dynamic Kernel Modules Support Team; debian-kernel@lists.debian.org
>> >> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
>> >>
>> >>
>> >> [Sedat Dilek]
>> >> > As a workaround I have symlinked my mycompiler wrapper-script to
>> >> > /usr/bin/gcc.  That works.
>> >> >
>> >> > What is the recommended way to do this correctly?
>> >>
>> >> Perhaps you should use dpkg-divert to ensure your replaced gcc is not
>> >> lost in a future package upgrade?
>> >>
>> >> The DKMS team in Debian need active members.  I'm not one of them. :(
>> >>
>> >> --
>> >
>> > I think this is an upstream problem not at all specific to Debian's implementation.
>> > I would recommend to bring this discussion upstream to get it fixed there.
>> >
>> > I believe DKMS unsets CC before starting build, but maybe that's wrong to do
>> > in this instance.
>> >
>>
>> Personally, I do not think it is an upstream problem.
>> Unsetting CC before DKMS starts the build would explain the behaviour/handling.
>>
>

[ Removing wrong debian's dkms maintainer list ]

> How exactly does clang get used by kernel build?  It's by setting CC variable right?
> You can try to remove this line to see if it fixes the problem (it should).
> https://github.com/dell/dkms/blob/master/dkms#L3515
>

I have an own script which uses bindeb-pkg make-target from Linus tree.

OK, that line looks like the culprit.

Anyway, I need a flexible handling when using different compilers - for me.

> The question would be where that variable should be ignored and where it shouldn't.
> Which I believe is an upstream discussion not a Debian discussion.

I agree.

- sed@ -

[toc] | [prev] | [next] | [standalone]


#61372

From<Mario.Limonciello@dell.com>
Date2018-07-09 17:10 +0200
Message-ID<w9FNV-3cX-39@gated-at.bofh.it>
In reply to#61369
> -----Original Message-----
> From: Petter Reinholdtsen [mailto:pere@hungry.com]
> Sent: Monday, July 9, 2018 9:32 AM
> To: sedat.dilek@gmail.com; David Paleino; Aron Xu; Limonciello, Mario; Giuseppe
> Iuculano
> Cc: Dynamic Kernel Modules Support Team; debian-kernel@lists.debian.org
> Subject: Re: dkms: Build with an alternative like compiler rather than gcc
> 
> 
> [Sedat Dilek]
> > As a workaround I have symlinked my mycompiler wrapper-script to
> > /usr/bin/gcc.  That works.
> >
> > What is the recommended way to do this correctly?
> 
> Perhaps you should use dpkg-divert to ensure your replaced gcc is not
> lost in a future package upgrade?
> 
> The DKMS team in Debian need active members.  I'm not one of them. :(
> 
> --

I think this is an upstream problem not at all specific to Debian's implementation.
I would recommend to bring this discussion upstream to get it fixed there.

I believe DKMS unsets CC before starting build, but maybe that's wrong to do
in this instance.

Thanks,

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web