public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* Changes to kbuild in 6.x causing cpp build issues.
@ 2024-01-30  6:32 David F.
  2024-01-30  8:36 ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: David F. @ 2024-01-30  6:32 UTC (permalink / raw)
  To: Linux Kbuild mailing list

Hello,

resending this because it doesn't show that it made it to the archives.

I've been building an out-of-tree linux kernel module that has a .cpp
module (plus a library that is built) for well over a decade using the
basic method outlined at https://github.com/veltzer/kcpp.   There was
a patch needed (provided here) in the 5.x version to be able to link
to the .a file generated.  That patch I've been able to modify as
slight changes occured, but now in 6.6.14 things have changed a lot,
I'm not sure if I'll need something like it to get to the final link
but I don't think I'm at that point yet.

My main issue now is this:

LD [M]  /media/sf_SRC_DRIVE/mymodule/l
inux/driver/6.6.14-686-mine/mymodule.o
  ld -m elf_i386 -z noexecstack   -r -o
/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o
@/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.mod
# cmd_modules_order
/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
  {   echo /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o;
:; } > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
sh ./scripts/modules-check.sh
/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
make -f ./scripts/Makefile.modpost
# MODPOST /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
   scripts/mod/modpost -M -m       -o
/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
-T /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
-i Module.symvers -e
/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/.mymodulelindrivercpp.o.cmd:
No such file or directory

It has never built a *.o.cmd file for the .cpp module and still
doesn't, but the new system is looking for it.    Could someone
familiar with kbuild tell me what I can patch / do to allow the system
to complete the build like it used to?

Thank You.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Changes to kbuild in 6.x causing cpp build issues.
  2024-01-30  6:32 Changes to kbuild in 6.x causing cpp build issues David F.
@ 2024-01-30  8:36 ` Masahiro Yamada
  2024-01-31  6:42   ` David F.
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2024-01-30  8:36 UTC (permalink / raw)
  To: David F.; +Cc: Linux Kbuild mailing list

On Tue, Jan 30, 2024 at 3:32 PM David F. <df7729@gmail.com> wrote:
>
> Hello,
>
> resending this because it doesn't show that it made it to the archives.
>
> I've been building an out-of-tree linux kernel module that has a .cpp
> module (plus a library that is built) for well over a decade using the
> basic method outlined at https://github.com/veltzer/kcpp.   There was
> a patch needed (provided here) in the 5.x version to be able to link
> to the .a file generated.  That patch I've been able to modify as
> slight changes occured, but now in 6.6.14 things have changed a lot,
> I'm not sure if I'll need something like it to get to the final link
> but I don't think I'm at that point yet.
>
> My main issue now is this:
>
> LD [M]  /media/sf_SRC_DRIVE/mymodule/l
> inux/driver/6.6.14-686-mine/mymodule.o
>   ld -m elf_i386 -z noexecstack   -r -o
> /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o
> @/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.mod
> # cmd_modules_order
> /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
>   {   echo /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o;
> :; } > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> sh ./scripts/modules-check.sh
> /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> make -f ./scripts/Makefile.modpost
> # MODPOST /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
>    scripts/mod/modpost -M -m       -o
> /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
> -T /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> -i Module.symvers -e
> /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/.mymodulelindrivercpp.o.cmd:
> No such file or directory
>
> It has never built a *.o.cmd file for the .cpp module and still
> doesn't, but the new system is looking for it.    Could someone
> familiar with kbuild tell me what I can patch / do to allow the system
> to complete the build like it used to?
>
> Thank You.
>


Presumably, the relevant commit is
f292d875d0dc700b3af0bef04c5abc1dc7b3b62c


modpost requires .*.cmd files, when CONFIG_MODVERSIONS=y.


This project does not produce .*.cmd file
when building *.o from *.cc

https://github.com/veltzer/kcpp/blob/177ea052f3c52c9f85bb091235061a0e620f51bd/Makefile#L68




--
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Changes to kbuild in 6.x causing cpp build issues.
  2024-01-30  8:36 ` Masahiro Yamada
@ 2024-01-31  6:42   ` David F.
  2024-02-02  5:51     ` David F.
  0 siblings, 1 reply; 6+ messages in thread
From: David F. @ 2024-01-31  6:42 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kbuild mailing list

Thank you, I use .cpp rather than .cc, would I be better off using
.cc?     Or, how do I create the .cmd file when building the .o file?

On Tue, Jan 30, 2024 at 12:37 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Tue, Jan 30, 2024 at 3:32 PM David F. <df7729@gmail.com> wrote:
> >
> > Hello,
> >
> > resending this because it doesn't show that it made it to the archives.
> >
> > I've been building an out-of-tree linux kernel module that has a .cpp
> > module (plus a library that is built) for well over a decade using the
> > basic method outlined at https://github.com/veltzer/kcpp.   There was
> > a patch needed (provided here) in the 5.x version to be able to link
> > to the .a file generated.  That patch I've been able to modify as
> > slight changes occured, but now in 6.6.14 things have changed a lot,
> > I'm not sure if I'll need something like it to get to the final link
> > but I don't think I'm at that point yet.
> >
> > My main issue now is this:
> >
> > LD [M]  /media/sf_SRC_DRIVE/mymodule/l
> > inux/driver/6.6.14-686-mine/mymodule.o
> >   ld -m elf_i386 -z noexecstack   -r -o
> > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o
> > @/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.mod
> > # cmd_modules_order
> > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> >   {   echo /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o;
> > :; } > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > sh ./scripts/modules-check.sh
> > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > make -f ./scripts/Makefile.modpost
> > # MODPOST /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
> >    scripts/mod/modpost -M -m       -o
> > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
> > -T /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > -i Module.symvers -e
> > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/.mymodulelindrivercpp.o.cmd:
> > No such file or directory
> >
> > It has never built a *.o.cmd file for the .cpp module and still
> > doesn't, but the new system is looking for it.    Could someone
> > familiar with kbuild tell me what I can patch / do to allow the system
> > to complete the build like it used to?
> >
> > Thank You.
> >
>
>
> Presumably, the relevant commit is
> f292d875d0dc700b3af0bef04c5abc1dc7b3b62c
>
>
> modpost requires .*.cmd files, when CONFIG_MODVERSIONS=y.
>
>
> This project does not produce .*.cmd file
> when building *.o from *.cc
>
> https://github.com/veltzer/kcpp/blob/177ea052f3c52c9f85bb091235061a0e620f51bd/Makefile#L68
>
>
>
>
> --
> Best Regards
> Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Changes to kbuild in 6.x causing cpp build issues.
  2024-01-31  6:42   ` David F.
@ 2024-02-02  5:51     ` David F.
  2024-02-02  9:04       ` Nicolas Schier
  0 siblings, 1 reply; 6+ messages in thread
From: David F. @ 2024-02-02  5:51 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kbuild mailing list

Any help would be appreciated on how to create the *.o.cmd file for .cpp files?

On Tue, Jan 30, 2024 at 10:42 PM David F. <df7729@gmail.com> wrote:
>
> Thank you, I use .cpp rather than .cc, would I be better off using
> .cc?     Or, how do I create the .cmd file when building the .o file?
>
> On Tue, Jan 30, 2024 at 12:37 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Tue, Jan 30, 2024 at 3:32 PM David F. <df7729@gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > resending this because it doesn't show that it made it to the archives.
> > >
> > > I've been building an out-of-tree linux kernel module that has a .cpp
> > > module (plus a library that is built) for well over a decade using the
> > > basic method outlined at https://github.com/veltzer/kcpp.   There was
> > > a patch needed (provided here) in the 5.x version to be able to link
> > > to the .a file generated.  That patch I've been able to modify as
> > > slight changes occured, but now in 6.6.14 things have changed a lot,
> > > I'm not sure if I'll need something like it to get to the final link
> > > but I don't think I'm at that point yet.
> > >
> > > My main issue now is this:
> > >
> > > LD [M]  /media/sf_SRC_DRIVE/mymodule/l
> > > inux/driver/6.6.14-686-mine/mymodule.o
> > >   ld -m elf_i386 -z noexecstack   -r -o
> > > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o
> > > @/media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.mod
> > > # cmd_modules_order
> > > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > >   {   echo /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/mymodule.o;
> > > :; } > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > > sh ./scripts/modules-check.sh
> > > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > > make -f ./scripts/Makefile.modpost
> > > # MODPOST /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
> > >    scripts/mod/modpost -M -m       -o
> > > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/Module.symvers
> > > -T /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/modules.order
> > > -i Module.symvers -e
> > > /media/sf_SRC_DRIVE/mymodule/linux/driver/6.6.14-686-mine/.mymodulelindrivercpp.o.cmd:
> > > No such file or directory
> > >
> > > It has never built a *.o.cmd file for the .cpp module and still
> > > doesn't, but the new system is looking for it.    Could someone
> > > familiar with kbuild tell me what I can patch / do to allow the system
> > > to complete the build like it used to?
> > >
> > > Thank You.
> > >
> >
> >
> > Presumably, the relevant commit is
> > f292d875d0dc700b3af0bef04c5abc1dc7b3b62c
> >
> >
> > modpost requires .*.cmd files, when CONFIG_MODVERSIONS=y.
> >
> >
> > This project does not produce .*.cmd file
> > when building *.o from *.cc
> >
> > https://github.com/veltzer/kcpp/blob/177ea052f3c52c9f85bb091235061a0e620f51bd/Makefile#L68
> >
> >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Changes to kbuild in 6.x causing cpp build issues.
  2024-02-02  5:51     ` David F.
@ 2024-02-02  9:04       ` Nicolas Schier
  2024-02-07  6:27         ` David F.
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Schier @ 2024-02-02  9:04 UTC (permalink / raw)
  To: David F.; +Cc: Masahiro Yamada, Linux Kbuild mailing list

On Thu, Feb 01, 2024 at 09:51:34PM -0800, David F. wrote:
> Any help would be appreciated on how to create the *.o.cmd file for .cpp files?

Neither tested nor evaluated in-depth:
You might want to have a look at scripts/Makefile.build and
scripts/Kbuild.include.  If you are able to include the relevant kbuild
parts in your Makefile, you could try to supply a cmd_cc_o_cc definition
and use it with if_changed macro.

Kind regards,
Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Changes to kbuild in 6.x causing cpp build issues.
  2024-02-02  9:04       ` Nicolas Schier
@ 2024-02-07  6:27         ` David F.
  0 siblings, 0 replies; 6+ messages in thread
From: David F. @ 2024-02-07  6:27 UTC (permalink / raw)
  To: David F., Masahiro Yamada, Linux Kbuild mailing list

Thanks, here's what I came up with in case someone is searching some day:

#------------ new section for kbuild .cmd requirement -------------

cpp_build_opts=`cat $(FLAGS)`

# called by existing Makedisk.build gen_symversions
cmd_gensymtypes_cc = $(CPP) -D__GENKSYMS__ $(cpp_build_opts)
$(CC_FLAGS) $< | $(genksyms)

# command to build using g++_
quiet_cmd_cc_o_cc = g++ $(quiet_modtag)  $@
      cmd_cc_o_cc = g++ $(cpp_build_opts) $(CC_FLAGS) -fno-builtin
-nostdlib -std=c++0x -fno-exceptions -fno-rtti -Wall -c -o $@ $<

ifdef CONFIG_MODVERSIONS
# setup call for build rules
cmd_gen_symversions_cc = $(call gen_symversions,cc)
endif

# multiple items to do on build of .cc file
define rule_cc_o_cc
$(call cmd_and_fixdep,cc_o_cc)
$(call cmd,gen_symversions_cc)
endef

# pattern for compiling the c++ parts (required for cpp file building)
%.o: %.cc $(FLAGS) FORCE
$(info doing [$@])
$(call if_changed_rule,cc_o_cc)

#---------------  end kbuild .cmd requirement build ---------------

On Fri, Feb 2, 2024 at 1:04 AM Nicolas Schier <n.schier@avm.de> wrote:
>
> On Thu, Feb 01, 2024 at 09:51:34PM -0800, David F. wrote:
> > Any help would be appreciated on how to create the *.o.cmd file for .cpp files?
>
> Neither tested nor evaluated in-depth:
> You might want to have a look at scripts/Makefile.build and
> scripts/Kbuild.include.  If you are able to include the relevant kbuild
> parts in your Makefile, you could try to supply a cmd_cc_o_cc definition
> and use it with if_changed macro.
>
> Kind regards,
> Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-07  6:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30  6:32 Changes to kbuild in 6.x causing cpp build issues David F.
2024-01-30  8:36 ` Masahiro Yamada
2024-01-31  6:42   ` David F.
2024-02-02  5:51     ` David F.
2024-02-02  9:04       ` Nicolas Schier
2024-02-07  6:27         ` David F.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox