* [ptxdist] Possible bug while compiling the kernel sourced via lndir://
@ 2026-11-20 7:33 Rug Ros
2026-11-20 7:48 ` Michael Olbrich
2026-11-20 8:22 ` Alexander Dahl via ptxdist
0 siblings, 2 replies; 4+ messages in thread
From: Rug Ros @ 2026-11-20 7:33 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]
Hello,
n order to make some changes to a device driver, I sourced the kernel via
an lndir:// URL. The kernel compilation itself succeeds, but the
kernel.compile stage subsequently fails with the following error:
make: Leaving directory '/home/ruggero/phytec/i.MX6Linux/i.MX6Linux.newKernel/platform-phyFLEX-i.MX6/build-target/linux-6.12.96'
sed: can't read /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/build-target/linux-6.12.96/compile_commands.json:
No such file or directory
make: ***[/home/ruggero/phytec/i.MX6Linux/i.MX6Linux/rules/kernel.make:276:
/home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/state/kernel.compile]
Error 2
I traced the issue to ptxd_make_world_compile_commands_filter() in
ptxd_make_world_compile_commands.sh:
In this function the file compile_commands.json is modified using sed, and
the source is handled properly (variable ${src_cmds}).
If sed succeeds, ptxd_make_world_compile_commands_cleanup() is called.
However, ptxd_make_world_compile_commands_cleanup() runs sed on
"${pkg_dir}/compile_commands.json". While that path is valid for regular
builds, it points to the wrong location when using an lndir:// URL.
As a workaround, I passed the resolved path as a parameter to
ptxd_make_world_compile_commands_cleanup() and updated its second call
site in ptxd_make_world_compile.sh accordingly.
I have attached a patch with my changes for reference.
Best regards
Ruggero
[-- Attachment #2: compile-kernel-lndir.patch --]
[-- Type: text/x-patch, Size: 1715 bytes --]
diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh
--- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-06-27 13:07:38.000000000 +0000
+++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-11-19 15:37:54.949219877 +0000
@@ -164,7 +164,7 @@
print "\n]"
}'
} > "${pkg_dir}/compile_commands.json" &&
- ptxd_make_world_compile_commands_cleanup
+ ptxd_make_world_compile_commands_cleanup "${pkg_dir}/compile_commands.json"
fi
}
export -f ptxd_make_world_compile_finish
diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh
--- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-06-27 13:07:38.000000000 +0000
+++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-11-19 15:38:31.841776180 +0000
@@ -12,7 +12,7 @@
ptxd_make_world_compile_commands_cleanup() {
sed -i \
-e 's/ *-fno-diagnostics-show-caret//g' \
- "${pkg_dir}/compile_commands.json"
+ "${1}"
}
export -f ptxd_make_world_compile_commands_cleanup
@@ -44,7 +44,7 @@
-e "s#\(\"command\": \" *[^ ]*\(gcc\|clang\) \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cflags} #" \
-e "s#\(\"command\": \" *[^ ]*++ \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cxxflags} #" \
"${src_cmds}" > "${dst_cmds}" &&
- ptxd_make_world_compile_commands_cleanup
+ ptxd_make_world_compile_commands_cleanup "${src_cmds}"
}
export -f ptxd_make_world_compile_commands_filter
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [ptxdist] Possible bug while compiling the kernel sourced via lndir:// 2026-11-20 7:33 [ptxdist] Possible bug while compiling the kernel sourced via lndir:// Rug Ros @ 2026-11-20 7:48 ` Michael Olbrich 2026-11-20 8:59 ` Rug Ros 2026-11-20 8:22 ` Alexander Dahl via ptxdist 1 sibling, 1 reply; 4+ messages in thread From: Michael Olbrich @ 2026-11-20 7:48 UTC (permalink / raw) To: Rug Ros; +Cc: ptxdist Hi, On Fri, Nov 20, 2026 at 08:33:07AM +0100, Rug Ros wrote: > n order to make some changes to a device driver, I sourced the kernel via > an lndir:// URL. Why would you need lndir:// for the kernel? The kernel is built out-off-tree and should not touch the source tree at all, except to write the compile_commands.json... > The kernel compilation itself succeeds, but the > kernel.compile stage subsequently fails with the following error: > > make: Leaving directory '/home/ruggero/phytec/i.MX6Linux/i.MX6Linux.newKernel/platform-phyFLEX-i.MX6/build-target/linux-6.12.96' > sed: can't read /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/build-target/linux-6.12.96/compile_commands.json: > No such file or directory > make: ***[/home/ruggero/phytec/i.MX6Linux/i.MX6Linux/rules/kernel.make:276: > /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/state/kernel.compile] > Error 2 > > > I traced the issue to ptxd_make_world_compile_commands_filter() in > ptxd_make_world_compile_commands.sh: > > In this function the file compile_commands.json is modified using sed, and > the source is handled properly (variable ${src_cmds}). > > If sed succeeds, ptxd_make_world_compile_commands_cleanup() is called. > > However, ptxd_make_world_compile_commands_cleanup() runs sed on > "${pkg_dir}/compile_commands.json". While that path is valid for regular > builds, it points to the wrong location when using an lndir:// URL. > > As a workaround, I passed the resolved path as a parameter to > ptxd_make_world_compile_commands_cleanup() and updated its second call > site in ptxd_make_world_compile.sh accordingly. > > I have attached a patch with my changes for reference. ... but the change below is correct anyways. Can you send a proper patch[1] please? Regards, Michael > diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > --- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-06-27 13:07:38.000000000 +0000 > +++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-11-19 15:37:54.949219877 +0000 > @@ -164,7 +164,7 @@ > print "\n]" > }' > } > "${pkg_dir}/compile_commands.json" && > - ptxd_make_world_compile_commands_cleanup > + ptxd_make_world_compile_commands_cleanup "${pkg_dir}/compile_commands.json" > fi > } > export -f ptxd_make_world_compile_finish > diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > --- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-06-27 13:07:38.000000000 +0000 > +++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-11-19 15:38:31.841776180 +0000 > @@ -12,7 +12,7 @@ > ptxd_make_world_compile_commands_cleanup() { > sed -i \ > -e 's/ *-fno-diagnostics-show-caret//g' \ > - "${pkg_dir}/compile_commands.json" > + "${1}" > } > export -f ptxd_make_world_compile_commands_cleanup > > @@ -44,7 +44,7 @@ > -e "s#\(\"command\": \" *[^ ]*\(gcc\|clang\) \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cflags} #" \ > -e "s#\(\"command\": \" *[^ ]*++ \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cxxflags} #" \ > "${src_cmds}" > "${dst_cmds}" && > - ptxd_make_world_compile_commands_cleanup > + ptxd_make_world_compile_commands_cleanup "${src_cmds}" > } > export -f ptxd_make_world_compile_commands_filter > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ptxdist] Possible bug while compiling the kernel sourced via lndir:// 2026-11-20 7:48 ` Michael Olbrich @ 2026-11-20 8:59 ` Rug Ros 0 siblings, 0 replies; 4+ messages in thread From: Rug Ros @ 2026-11-20 8:59 UTC (permalink / raw) To: Michael Olbrich; +Cc: Alexander Dahl, ptxdist [-- Attachment #1: Type: text/plain, Size: 4360 bytes --] On Fri, 20 Nov 2026 08:48:45 +0100 Michael Olbrich <m.olbrich@pengutronix.de> wrote: Hi Michael, I hope the attached file is the right format. By the way I corrected an error on my previous version: the cleanup() function must work on ${dst_cmds}, and not on src. To Alexander: I'm lazy, so I copied what I already had from a different package. The lndir:// URL makes a link to all the files in the local source, without have to worry that a clean wipe off all the changes. Good to know there is the alternative you mentioned, probably with less overhead. Best regards, Rugggero > Hi, > > On Fri, Nov 20, 2026 at 08:33:07AM +0100, Rug Ros wrote: > > n order to make some changes to a device driver, I sourced the kernel > > via an lndir:// URL. > > Why would you need lndir:// for the kernel? The kernel is built > out-off-tree and should not touch the source tree at all, except to write > the compile_commands.json... > > > The kernel compilation itself succeeds, but the > > kernel.compile stage subsequently fails with the following error: > > > > make: Leaving directory > > '/home/ruggero/phytec/i.MX6Linux/i.MX6Linux.newKernel/platform-phyFLEX-i.MX6/build-target/linux-6.12.96' > > sed: can't read > > /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/build-target/linux-6.12.96/compile_commands.json: > > No such file or directory make: > > ***[/home/ruggero/phytec/i.MX6Linux/i.MX6Linux/rules/kernel.make:276: > > /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/state/kernel.compile] > > Error 2 > > > > > > I traced the issue to ptxd_make_world_compile_commands_filter() in > > ptxd_make_world_compile_commands.sh: > > > > In this function the file compile_commands.json is modified using sed, > > and the source is handled properly (variable ${src_cmds}). > > > > If sed succeeds, ptxd_make_world_compile_commands_cleanup() is called. > > > > However, ptxd_make_world_compile_commands_cleanup() runs sed on > > "${pkg_dir}/compile_commands.json". While that path is valid for > > regular builds, it points to the wrong location when using an lndir:// > > URL. > > > > As a workaround, I passed the resolved path as a parameter to > > ptxd_make_world_compile_commands_cleanup() and updated its second call > > site in ptxd_make_world_compile.sh accordingly. > > > > I have attached a patch with my changes for reference. > > ... but the change below is correct anyways. Can you send a proper > patch[1] please? > > Regards, > Michael > > > diff -Naur > > /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > > /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > > --- > > /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > > 2026-06-27 13:07:38.000000000 +0000 +++ > > /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > > 2026-11-19 15:37:54.949219877 +0000 @@ -164,7 +164,7 @@ print "\n]" }' > > } > "${pkg_dir}/compile_commands.json" && > > - ptxd_make_world_compile_commands_cleanup > > + ptxd_make_world_compile_commands_cleanup > > "${pkg_dir}/compile_commands.json" fi > > } > > export -f ptxd_make_world_compile_finish > > diff -Naur > > /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > > /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > > --- > > /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > > 2026-06-27 13:07:38.000000000 +0000 +++ > > /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > > 2026-11-19 15:38:31.841776180 +0000 @@ -12,7 +12,7 @@ > > ptxd_make_world_compile_commands_cleanup() { sed -i \ -e 's/ > > *-fno-diagnostics-show-caret//g' \ > > - "${pkg_dir}/compile_commands.json" > > + "${1}" > > } > > export -f ptxd_make_world_compile_commands_cleanup > > > > @@ -44,7 +44,7 @@ > > -e "s#\(\"command\": \" *[^ ]*\(gcc\|clang\) \)#\1 > > ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cflags} #" \ -e "s#\(\"command\": \" > > *[^ ]*++ \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cxxflags} #" \ > > "${src_cmds}" > "${dst_cmds}" && > > - ptxd_make_world_compile_commands_cleanup > > + ptxd_make_world_compile_commands_cleanup "${src_cmds}" > > } > > export -f ptxd_make_world_compile_commands_filter > > > > [-- Attachment #2: 0001-ptxd_make_world_compile_commands-pass-compile_comman.patch --] [-- Type: text/x-patch, Size: 2151 bytes --] >From 643641cd4e93295a4518b474d16dc9331becdf09 Mon Sep 17 00:00:00 2001 From: ruggero <rug2ros@gmail.com> Date: Fri, 20 Nov 2026 09:37:15 +0100 Subject: [PATCH] ptxd_make_world_compile_commands: pass compile_commands.json path to cleanup When building kernel sourced via lndir://, compile_commands.json is not located directly inside ${pkg_dir}. Pass the resolved file path explicitly to ptxd_make_world_compile_commands_cleanup() instead of hardcoding "${pkg_dir}/compile_commands.json". Signed-off-by: ruggero <rug2ros@gmail.com> --- scripts/lib/ptxd_make_world_compile.sh | 2 +- scripts/lib/ptxd_make_world_compile_commands.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/lib/ptxd_make_world_compile.sh b/scripts/lib/ptxd_make_world_compile.sh index 739e4fb45..033c24ca8 100644 --- a/scripts/lib/ptxd_make_world_compile.sh +++ b/scripts/lib/ptxd_make_world_compile.sh @@ -164,7 +164,7 @@ ptxd_make_world_compile_finish() { print "\n]" }' } > "${pkg_dir}/compile_commands.json" && - ptxd_make_world_compile_commands_cleanup + ptxd_make_world_compile_commands_cleanup "${pkg_dir}/compile_commands.json" fi } export -f ptxd_make_world_compile_finish diff --git a/scripts/lib/ptxd_make_world_compile_commands.sh b/scripts/lib/ptxd_make_world_compile_commands.sh index df6baf535..b0522d52b 100644 --- a/scripts/lib/ptxd_make_world_compile_commands.sh +++ b/scripts/lib/ptxd_make_world_compile_commands.sh @@ -12,7 +12,7 @@ ptxd_make_world_compile_commands_cleanup() { sed -i \ -e 's/ *-fno-diagnostics-show-caret//g' \ - "${pkg_dir}/compile_commands.json" + "${1}" } export -f ptxd_make_world_compile_commands_cleanup @@ -44,7 +44,7 @@ ptxd_make_world_compile_commands_filter() { -e "s#\(\"command\": \" *[^ ]*\(gcc\|clang\) \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cflags} #" \ -e "s#\(\"command\": \" *[^ ]*++ \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cxxflags} #" \ "${src_cmds}" > "${dst_cmds}" && - ptxd_make_world_compile_commands_cleanup + ptxd_make_world_compile_commands_cleanup "${dst_cmds}" } export -f ptxd_make_world_compile_commands_filter -- 2.43.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [ptxdist] Possible bug while compiling the kernel sourced via lndir:// 2026-11-20 7:33 [ptxdist] Possible bug while compiling the kernel sourced via lndir:// Rug Ros 2026-11-20 7:48 ` Michael Olbrich @ 2026-11-20 8:22 ` Alexander Dahl via ptxdist 1 sibling, 0 replies; 4+ messages in thread From: Alexander Dahl via ptxdist @ 2026-11-20 8:22 UTC (permalink / raw) To: Rug Ros; +Cc: Alexander Dahl, ptxdist Hello, Am Fri, Nov 20, 2026 at 08:33:07AM +0100 schrieb Rug Ros: > Hello, > > n order to make some changes to a device driver, I sourced the kernel via > an lndir:// URL. The kernel compilation itself succeeds, but the > kernel.compile stage subsequently fails with the following error: When developing in out-of-tree projects I usually do it with `ptxdist local-src` and for the kernel this would be for example: ptxdist clean kernel ptxdist local-src kernel ~/src/linux/vanilla ptxdist oldconfig kernel Works fine for me with kernel and other packages. This command is documented only briefly with `ptxdist help` and somewhat more extensive in section "6.1 Using an Externel Kernel Source Tree" in documentation [1]. Not sure, but I guess you tried something else? Greets Alex [1] https://ptxdist.org/doc/daily_work_section.html#using-an-external-kernel-source-tree > > make: Leaving directory '/home/ruggero/phytec/i.MX6Linux/i.MX6Linux.newKernel/platform-phyFLEX-i.MX6/build-target/linux-6.12.96' > sed: can't read /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/build-target/linux-6.12.96/compile_commands.json: > No such file or directory > make: ***[/home/ruggero/phytec/i.MX6Linux/i.MX6Linux/rules/kernel.make:276: > /home/ruggero/phytec/i.MX6Linux/i.MX6Linux/platform-phyFLEX-i.MX6/state/kernel.compile] > Error 2 > > > I traced the issue to ptxd_make_world_compile_commands_filter() in > ptxd_make_world_compile_commands.sh: > > In this function the file compile_commands.json is modified using sed, and > the source is handled properly (variable ${src_cmds}). > > If sed succeeds, ptxd_make_world_compile_commands_cleanup() is called. > > However, ptxd_make_world_compile_commands_cleanup() runs sed on > "${pkg_dir}/compile_commands.json". While that path is valid for regular > builds, it points to the wrong location when using an lndir:// URL. > > As a workaround, I passed the resolved path as a parameter to > ptxd_make_world_compile_commands_cleanup() and updated its second call > site in ptxd_make_world_compile.sh accordingly. > > I have attached a patch with my changes for reference. > > Best regards > > Ruggero > diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh > --- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-06-27 13:07:38.000000000 +0000 > +++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile.sh 2026-11-19 15:37:54.949219877 +0000 > @@ -164,7 +164,7 @@ > print "\n]" > }' > } > "${pkg_dir}/compile_commands.json" && > - ptxd_make_world_compile_commands_cleanup > + ptxd_make_world_compile_commands_cleanup "${pkg_dir}/compile_commands.json" > fi > } > export -f ptxd_make_world_compile_finish > diff -Naur /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh > --- /mnt/tmp/usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-06-27 13:07:38.000000000 +0000 > +++ /usr/local/lib/ptxdist-2026.07.0/scripts/lib/ptxd_make_world_compile_commands.sh 2026-11-19 15:38:31.841776180 +0000 > @@ -12,7 +12,7 @@ > ptxd_make_world_compile_commands_cleanup() { > sed -i \ > -e 's/ *-fno-diagnostics-show-caret//g' \ > - "${pkg_dir}/compile_commands.json" > + "${1}" > } > export -f ptxd_make_world_compile_commands_cleanup > > @@ -44,7 +44,7 @@ > -e "s#\(\"command\": \" *[^ ]*\(gcc\|clang\) \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cflags} #" \ > -e "s#\(\"command\": \" *[^ ]*++ \)#\1 ${PTXDIST_CROSS_CPPFLAGS} ${pkg_cxxflags} #" \ > "${src_cmds}" > "${dst_cmds}" && > - ptxd_make_world_compile_commands_cleanup > + ptxd_make_world_compile_commands_cleanup "${src_cmds}" > } > export -f ptxd_make_world_compile_commands_filter > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-20 8:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-20 7:33 [ptxdist] Possible bug while compiling the kernel sourced via lndir:// Rug Ros 2026-11-20 7:48 ` Michael Olbrich 2026-11-20 8:59 ` Rug Ros 2026-11-20 8:22 ` Alexander Dahl via ptxdist
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox