autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
PATCH 1/1 autodate.sh: Add graceful fallback of commitid-only mode for shallow clone
Under shallow clone of perfbook repo, "git describe" can't work. Catch the error and use "git log" to obtain the commit id instead.
Following is the comparison of autodate.tex.
Before:
\date{February 3, 2023 \\ Tag: \texttt{} }
\newcommand{\commityear}{2023}
\newcommand{\commitid}{}
\IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}After:
\date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) }
\newcommand{\commityear}{2023}
\newcommand{\commitid}{g25bd138c30bf}
\IfQqzBg{}{\setboolean{qqzbg}{false}}
% tcolorbox version: 5.1
\tcbsetforeverylayer{autoparskip}--- utilities/autodate.sh | 54 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-)
utilities/autodate.sh +30 -24
@@ -52,27 +52,28 @@ else else modified="" fi - description="`git describe --tags HEAD`" - case "$description" in - *-g*) - release=`env printf 'Commit: \\\texttt{%s}' "$description"` - commitid="$description" - ;; - v*) - release="Release $description" - commitid=$description - qqzbg="true" - ;; - Edition*) - release="Edition" - commitid=$description - qqzbg="true" + if description="`git describe --tags HEAD 2> /dev/null`" + then case "$description" in - *P*) - release="Print $release" + *-g*) + release=`env printf 'Commit: \\\texttt{%s}' "$description"` + commitid="$description" ;; - esac - case "$description" in + v*) + release="Release $description" + commitid=$description + qqzbg="true" + ;; + Edition*) + release="Edition" + commitid=$description + qqzbg="true" + case "$description" in + *P*) + release="Print $release" + ;; + esac + case "$description" in Edition[.-][0-9]*) ednum="`echo $description | sed -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`" release=`env printf '\\Ordinalstringnum{%s} %s' $ednum "$release"`
@@ -85,11 +86,16 @@ else ;; esac ;; - *) - release=`env printf 'Tag: \\\texttt{%s}' "$description"` - commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'` - ;; - esac + *) + release=`env printf 'Tag: \\\texttt{%s}' "$description"` + commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'` + ;; + esac + else + description=`git log --max-count=1 | head -n 1 | sed -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'` + release=`env printf 'Commit: \\\texttt{%s} (shallow clone)' "$description"` + commitid="$description" + fi fi month=`date --date="$date_str" +%B` year=`date --date="$date_str" +%Y`
base-commit: 3bfa0a092334e3a82bf75217b01d500ad78b6dc5
Signature · 1 line
2.25.1
Quoted 23 lines · Akira Yokosawa
Under shallow clone of perfbook repo, "git describe" can't work. Catch the error and use "git log" to obtain the commit id instead.
Following is the comparison of autodate.tex.
Before:
\date{February 3, 2023 \\ Tag: \texttt{} } \newcommand{\commityear}{2023} \newcommand{\commitid}{} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}After:
\date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) } \newcommand{\commityear}{2023} \newcommand{\commitid}{g25bd138c30bf} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}
Quoted 2 lines
Signed-off-by Akira Yokosawa <[email protected]>Cc Leonardo Bras <[email protected]>
Thank you, Akira, and I have queued this.
Leonardo, could you please check to see whether this works for you in your particular environment? If it does, please include something like this in your reply:
Thanx, Paul
Quoted 83 lines
--- utilities/autodate.sh | 54 ++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-)utilities/autodate.sh +30
-24@@ -52,27 +52,28 @@ else else modified="" fi - description="`git describe --tags HEAD`" - case "$description" in - *-g*) - release=`env printf 'Commit: \\\texttt{%s}' "$description"` - commitid="$description" - ;; - v*) - release="Release $description" - commitid=$description - qqzbg="true" - ;; - Edition*) - release="Edition" - commitid=$description - qqzbg="true" + if description="`git describe --tags HEAD 2> /dev/null`" + then case "$description" in - *P*) - release="Print $release" + *-g*) + release=`env printf 'Commit: \\\texttt{%s}' "$description"` + commitid="$description" ;; - esac - case "$description" in + v*) + release="Release $description" + commitid=$description + qqzbg="true" + ;; + Edition*) + release="Edition" + commitid=$description + qqzbg="true" + case "$description" in + *P*) + release="Print $release" + ;; + esac + case "$description" in Edition[.-][0-9]*) ednum="`echo $description | sed -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`" release=`env printf '\\Ordinalstringnum{%s} %s' $ednum "$release"`@@ -85,11 +86,16 @@ else ;; esac ;; - *) - release=`env printf 'Tag: \\\texttt{%s}' "$description"` - commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'` - ;; - esac + *) + release=`env printf 'Tag: \\\texttt{%s}' "$description"` + commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'` + ;; + esac + else + description=`git log --max-count=1 | head -n 1 | sed -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'` + release=`env printf 'Commit: \\\texttt{%s} (shallow clone)' "$description"` + commitid="$description" + fi fi month=`date --date="$date_str" +%B` year=`date --date="$date_str" +%Y`base-commit:
3bfa0a092334e3a82bf75217b01d500ad78b6dc5Signature · 1 line
2.25.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20230203181950.GL2948950@paulmck-ThinkPad-P17-Gen-1
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20230203185539.GM2948950@paulmck-ThinkPad-P17-Gen-1
Quoted 122 lines · Paul E. McKenney
Quoted 115 lines · Leonardo Brás
Quoted 56 lines · Paul E. McKenney
Quoted 40 lines · Leonardo Brás
Quoted 24 lines · Paul E. McKenney
Quoted 23 lines · Akira Yokosawa
Under shallow clone of perfbook repo, "git describe" can't work. Catch the error and use "git log" to obtain the commit id instead.
Following is the comparison of autodate.tex.
Before:
\date{February 3, 2023 \\ Tag: \texttt{} } \newcommand{\commityear}{2023} \newcommand{\commitid}{} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}After:
\date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) } \newcommand{\commityear}{2023} \newcommand{\commitid}{g25bd138c30bf} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}Quoted 8 lines
Quoted 2 lines
Signed-off-by Akira Yokosawa <[email protected]>Cc Leonardo Bras <[email protected]>Thank you, Akira, and I have queued this.
Leonardo, could you please check to see whether this works for you in your particular environment?
Sure,
I reconfigured it as a shallow git clone, and then pushed master + this patch onleobras_ci, and it seems to have worked just fine. Please see:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3712415008/artifacts/file/perfbook.pdfQuoted 8 lines
Quoted 5 lines
If it does, please include something
like this in your reply:So, yeah:
Tested-by Leonardo Bras <[email protected]>Applied, thank you very much!
Quoted 4 lines
Paul, could you please help me test some other feature?
It would require you to push master + this patch on a test branch in your kernel.org repository.Quoted 6 lines
Quoted 2 lines
If everything works as intended, it should automatically trigger the build + testing for that branch.
One approach is to go into the CodeSamples/count directory and invoke all the programs with no arguments. If they all exit with zero status, life is good.
I think there was a misunderstanding:
I asked help for testing a Gitlab feature, which is buiding any test branches from your kernel.org repository automatically when you push to a new branch.Quoted 3 lines
Would you be interested in adding a "make check" target to the CodeSamples/count/Makefile to support this?
Sure, I could do that!
Just noticed by runningmake -C CodeSamples/it doesn't generate anything in CodeSamples/count:### None in count/ can be built on arch: 'unknown'.
I did some hacking, and then tried:
make target=x86 -C CodeSamples/And suddenly I see errors such as:
cc -g -o lockdeq -DTEST
lockdeq.c-lpthread
lockdeq.c:78:26: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘____cacheline_internodealigned_in_smp’78 | spinlock_t rlock ____cacheline_internodealigned_in_smp; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lockdeq.c: In function ‘init_pdeq’: lockdeq.c:100:12: error: ‘struct pdeq’ has no member named ‘ridx’; did you mean ‘lidx’? 100 | d->ridx = 1; | ^~~~ | lidxand warnings such as :
cc -g -Wall -o xchglockxchglock.c-lpthreadxchglock.c: In function ‘main’:
xchglock.c:87:9: warning: implicit declaration of function ‘smp_mb’; did you mean ‘cmm_mb’? [-Wimplicit-function-declaration]87 | smp_mb(); | ^~~~~~ | cmm_mb
/usr/bin/ld:/tmp/ccDvA7Yo.o: in function `main':/dev/shm/perfbook/CodeSamples/locking/xchglock.c:87: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:91: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:93: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:95: undefined reference to `smp_mb'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:21: xchglock] Error 1Quoted 1 line
Is that the correct way of calling the make on CodeSamples?
Ah, the top-level
Makefilehas some historical baggage, which is entirely my doing. Something about me not expecting this to be a publicly available project when I first set it up. ;-)
Quoted 8 lines
So I suggest something like this:
cd CodeSamples
make pthreads
cd count
makePlease let me know how this goes.
No luck:
###
[perfbook]$ cd CodeSamples/
[CodeSamples]$ make pthreads
echo "#ifndef __PERFBOOK_API_H__" > api.h
echo "#define __PERFBOOK_API_H__" >> api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h echo "" >> api.h
cat linux/common.h >> api.h
echo "" >> api.h
cat api-pthreads/api-pthreads.h | \
sed '/begin{snippet}/d' | \
sed '/end{snippet}/d' >> api.hecho "" >> api.h
cat api-pthreads/api-gcc.h >> api.h
cat api-pthreads/api-linux.h >> api.h
echo "" >> api.h
if test -f /usr/include/urcu-call-rcu.h -o \ -f /usr/local/include/urcu-call-rcu.h -o \ -f /usr/include//urcu-call-rcu.h -o \ -f /usr/include/urcu-call-rcu.h ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer.h>" >> api.h; \ elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer-static.h>" >> api.h; \ else \ echo "### Missing liburcu package!!! Install it. ###"; \ exit 1; \
fi
echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch echo "" >> Makefile.arch
[CodeSamples]$ cd count/
[count]$ make
### None in count/ can be built on arch: 'unknown'.
###
So, for some reason, it couldn't still get the architecture.
Oh, I noticed depends.mk use uname -p for getting the arch, which is non- portable:
###
uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s. [...]
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
###
I heard some distros patch this by doing uname -p the same as uname -m, which seems to have the correct output. I patched this and then now it works:
###
make
make -C .. Makefile.arch
make[1]: Entering directory '/dev/shm/perfbook/CodeSamples' make pthreads
make[2]: Entering directory '/dev/shm/perfbook/CodeSamples' echo "#ifndef __PERFBOOK_API_H__" > api.h
echo "#define __PERFBOOK_API_H__" >> api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >> api.h echo "" >> api.h
cat linux/common.h >> api.h
echo "" >> api.h
cat arch-x86/arch-x86.h >> api.h
echo "" >> api.h
cat api-pthreads/api-pthreads.h | \
sed '/begin{snippet}/d' | \
sed '/end{snippet}/d' >> api.hecho "" >> api.h
cat api-pthreads/api-gcc.h >> api.h
cat api-pthreads/api-linux.h >> api.h
echo "" >> api.h
if test -f /usr/include/urcu-call-rcu.h -o \ -f /usr/local/include/urcu-call-rcu.h -o \ -f /usr/include/x86_64-linux-gnu/urcu-call-rcu.h -o \ -f /usr/include/urcu-call-rcu.h ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer.h>" >> api.h; \ elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer-static.h>" >> api.h; \ else \ echo "### Missing liburcu package!!! Install it. ###"; \ exit 1; \
fi
echo "#endif /* #ifndef __PERFBOOK_API_H__ */" >> api.h echo "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch echo "" >> Makefile.arch
cat arch-x86/Makefile.arch >> Makefile.arch
make[2]: Leaving directory '/dev/shm/perfbook/CodeSamples' make[1]: Leaving directory '/dev/shm/perfbook/CodeSamples'
cc -g -O3 -Wall -o count_atomic count_atomic.c -lpthread cc -g -O3 -Wall -o count_end count_end.c -lpthread cc -g -O3 -Wall -o count_end_rcu count_end_rcu.c -lpthread cc -g -O3 -Wall -o count_lim count_lim.c -lpthread cc -g -O3 -Wall -o count_lim_app count_lim_app.c -lpthread cc -g -O3 -Wall -o count_lim_atomic count_lim_atomic.c -lpthread cc -g -O3 -Wall -o count_lim_sig count_lim_sig.c -lpthread cc -g -O3 -Wall -o count_limd count_limd.c -lpthread cc -g -O3 -Wall -o count_nonatomic count_nonatomic.c -lpthread cc -g -O3 -Wall -o count_stack count_stack.c -lpthread cc -g -O3 -Wall -o count_stat count_stat.c -lpthread cc -g -O3 -Wall -o count_stat_atomic count_stat_atomic.c -lpthread cc -g -O3 -Wall -o count_stat_eventual count_stat_eventual.c -lpthread cc -g -O3 -Wall -o count_tstat count_tstat.c -lpthread
###
I will send a patch fixing the uname soon :)
Quoted 5 lines
This should probably be documented somewhere, perhaps in howto/howto.tex or maybe in BUILD-FAQ.txt. Thoughts?
Thanx, Paul
Best regards,
Leo
Quoted 256 lines · Leonardo Brás
Quoted 122 lines · Paul E. McKenney
Quoted 115 lines · Leonardo Brás
Quoted 56 lines · Paul E. McKenney
Quoted 40 lines · Leonardo Brás
Quoted 24 lines · Paul E. McKenney
Quoted 23 lines · Akira Yokosawa
Under shallow clone of perfbook repo, "git describe" can't work. Catch the error and use "git log" to obtain the commit id instead.
Following is the comparison of autodate.tex.
Before:
\date{February 3, 2023 \\ Tag: \texttt{} } \newcommand{\commityear}{2023} \newcommand{\commitid}{} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}After:
\date{February 3, 2023 \\ Commit: \texttt{g25bd138c30bf} (shallow clone) } \newcommand{\commityear}{2023} \newcommand{\commitid}{g25bd138c30bf} \IfQqzBg{}{\setboolean{qqzbg}{false}} % tcolorbox version: 5.1 \tcbsetforeverylayer{autoparskip}Quoted 8 lines
Quoted 2 lines
Signed-off-by Akira Yokosawa <[email protected]>Cc Leonardo Bras <[email protected]>Thank you, Akira, and I have queued this.
Leonardo, could you please check to see whether this works for you in your particular environment?
Sure,
I reconfigured it as a shallow git clone, and then pushed master + this patch onleobras_ci, and it seems to have worked just fine. Please see:
https://gitlab.com/linux-kernel/perfbook/-/jobs/3712415008/artifacts/file/perfbook.pdfQuoted 8 lines
Quoted 5 lines
If it does, please include something
like this in your reply:So, yeah:
Tested-by Leonardo Bras <[email protected]>Applied, thank you very much!
Quoted 4 lines
Paul, could you please help me test some other feature?
It would require you to push master + this patch on a test branch in your kernel.org repository.Quoted 6 lines
Quoted 2 lines
If everything works as intended, it should automatically trigger the build + testing for that branch.
One approach is to go into the CodeSamples/count directory and invoke all the programs with no arguments. If they all exit with zero status, life is good.
I think there was a misunderstanding:
I asked help for testing a Gitlab feature, which is buiding any test branches from your kernel.org repository automatically when you push to a new branch.Quoted 3 lines
Would you be interested in adding a "make check" target to the CodeSamples/count/Makefile to support this?
Sure, I could do that!
Just noticed by runningmake -C CodeSamples/it doesn't generate anything in CodeSamples/count:### None in count/ can be built on arch: 'unknown'.
I did some hacking, and then tried:
make target=x86 -C CodeSamples/And suddenly I see errors such as:
cc -g -o lockdeq -DTEST
lockdeq.c-lpthread
lockdeq.c:78:26: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘____cacheline_internodealigned_in_smp’78 | spinlock_t rlock ____cacheline_internodealigned_in_smp; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lockdeq.c: In function ‘init_pdeq’: lockdeq.c:100:12: error: ‘struct pdeq’ has no member named ‘ridx’; did you mean ‘lidx’? 100 | d->ridx = 1; | ^~~~ | lidxand warnings such as :
cc -g -Wall -o xchglockxchglock.c-lpthreadxchglock.c: In function ‘main’:
xchglock.c:87:9: warning: implicit declaration of function ‘smp_mb’; did you mean ‘cmm_mb’? [-Wimplicit-function-declaration]87 | smp_mb(); | ^~~~~~ | cmm_mb
/usr/bin/ld:/tmp/ccDvA7Yo.o: in function `main':/dev/shm/perfbook/CodeSamples/locking/xchglock.c:87: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:91: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:93: undefined reference to `smp_mb'/usr/bin/ld:/dev/shm/perfbook/CodeSamples/locking/xchglock.c:95: undefined reference to `smp_mb'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:21: xchglock] Error 1Quoted 1 line
Is that the correct way of calling the make on CodeSamples?
Ah, the top-level
Makefilehas some historical baggage, which is entirely my doing. Something about me not expecting this to be a publicly available project when I first set it up. ;-)Quoted 8 lines
So I suggest something like this:
cd CodeSamples
make pthreads
cd count
makePlease let me know how this goes.
No luck:
###
[perfbook]$ cd CodeSamples/
[CodeSamples]$ make pthreads
echo "#ifndef__PERFBOOK_API_H__" >api.h
echo "#define__PERFBOOK_API_H__" >>api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >>api.hecho "" >>api.h
catlinux/common.h>>api.h
echo "" >>api.hcat api-pthreads/api-pthreads.h | \ sed '/begin{snippet}/d' | \ sed '/end{snippet}/d' >> api.hecho "" >>
api.h
catapi-pthreads/api-gcc.h>>api.h
catapi-pthreads/api-linux.h>>api.h
echo "" >>api.hif test -f /usr/include/urcu-call-rcu.h -o \ -f /usr/local/include/urcu-call-rcu.h -o \ -f /usr/include//urcu-call-rcu.h -o \ -f /usr/include/urcu-call-rcu.h ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer.h>" >> api.h; \ elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer-static.h>" >> api.h; \ else \ echo "### Missing liburcu package!!! Install it. ###"; \ exit 1; \fi
echo "#endif /* #ifndef__PERFBOOK_API_H__*/" >>api.hecho "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch echo "" >> Makefile.arch
[CodeSamples]$ cd count/
[count]$ make
### None in count/ can be built on arch: 'unknown'.
###So, for some reason, it couldn't still get the architecture.
Oh, I noticed depends.mk use
uname -pfor getting the arch, which is non- portable:###
uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s. [...]
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
###I heard some distros patch this by doing uname -p the same as uname -m, which seems to have the correct output. I patched this and then now it works:
###
make
make -C .. Makefile.arch
make[1]: Entering directory '/dev/shm/perfbook/CodeSamples' make pthreads
make[2]: Entering directory '/dev/shm/perfbook/CodeSamples' echo "#ifndef__PERFBOOK_API_H__" >api.h
echo "#define__PERFBOOK_API_H__" >>api.h
echo "/* MECHANICALLY GENERATED, DO NOT EDIT!!! */" >>api.hecho "" >>api.h
catlinux/common.h>>api.h
echo "" >>api.h
catarch-x86/arch-x86.h>>api.h
echo "" >>api.hcat api-pthreads/api-pthreads.h | \ sed '/begin{snippet}/d' | \ sed '/end{snippet}/d' >> api.hecho "" >>
api.h
catapi-pthreads/api-gcc.h>>api.h
catapi-pthreads/api-linux.h>>api.h
echo "" >>api.hif test -f /usr/include/urcu-call-rcu.h -o \ -f /usr/local/include/urcu-call-rcu.h -o \ -f /usr/include/x86_64-linux-gnu/urcu-call-rcu.h -o \ -f /usr/include/urcu-call-rcu.h ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer.h>" >> api.h; \ elif test -d /usr/include/urcu -o -d /usr/local/include/urcu ; \ then \ echo "#define _LGPL_SOURCE" >> api.h; \ echo "#include <urcu/rculist.h>" >> api.h; \ echo "#include <urcu/rcuhlist.h>" >> api.h; \ echo "#include <urcu-pointer-static.h>" >> api.h; \ else \ echo "### Missing liburcu package!!! Install it. ###"; \ exit 1; \fi
echo "#endif /* #ifndef__PERFBOOK_API_H__*/" >>api.hecho "# MECHANICALLY GENERATED, DO NOT EDIT!!!" > Makefile.arch echo "" >> Makefile.arch
cat arch-x86/Makefile.arch >> Makefile.arch
make[2]: Leaving directory '/dev/shm/perfbook/CodeSamples' make[1]: Leaving directory '/dev/shm/perfbook/CodeSamples'cc -g -O3 -Wall -o count_atomic count_atomic.c -lpthread cc -g -O3 -Wall -o count_end count_end.c -lpthread cc -g -O3 -Wall -o count_end_rcu count_end_rcu.c -lpthread cc -g -O3 -Wall -o count_lim count_lim.c -lpthread cc -g -O3 -Wall -o count_lim_app count_lim_app.c -lpthread cc -g -O3 -Wall -o count_lim_atomic count_lim_atomic.c -lpthread cc -g -O3 -Wall -o count_lim_sig count_lim_sig.c -lpthread cc -g -O3 -Wall -o count_limd count_limd.c -lpthread cc -g -O3 -Wall -o count_nonatomic count_nonatomic.c -lpthread cc -g -O3 -Wall -o count_stack count_stack.c -lpthread cc -g -O3 -Wall -o count_stat count_stat.c -lpthread cc -g -O3 -Wall -o count_stat_atomic count_stat_atomic.c -lpthread cc -g -O3 -Wall -o count_stat_eventual count_stat_eventual.c -lpthread cc -g -O3 -Wall -o count_tstat count_tstat.c -lpthread
Quoted 3 lines
###
I will send a patch fixing the uname soon :)
Thank you for digging into this!
And yes, portability is easier than it was 40 years ago, but still not easy. :-/
Thanx, Paul
Quoted 8 lines
Quoted 4 lines
This should probably be documented somewhere, perhaps in howto/howto.tex or maybe in BUILD-FAQ.txt. Thoughts?
Thanx, Paul
Best regards,
Leo
Quoted 1 line · Paul E. McKenney
On Fri, Feb 03, 2023 at 11:55:20PM -0300, Leonardo Brás wrote:
...
Quoted 7 lines
Quoted 2 lines
I will send a patch fixing the uname soon :)
Thank you for digging into this!
And yes, portability is easier than it was 40 years ago, but still not easy. :-/
Hi,
You might be interested in this email thread in 2012 at GNU bugreport:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13001
Looks like the behavior of "uname -p" CodeSamples had assumed is common to Ubuntu and Fedora (as well as RHEL and SUSE).
So, this issue is exposed by Leo's choice of archlinux:latest as the base image.
Leo, just out of curiosity, what made you pick Arch Linux?
Thanks, Akira
Quoted 11 lines · Akira Yokosawa
Quoted 1 line · Paul E. McKenney
On Fri, Feb 03, 2023 at 11:55:20PM -0300, Leonardo Brás wrote:
...
Quoted 7 lines
Quoted 2 lines
I will send a patch fixing the uname soon :)
Thank you for digging into this!
And yes, portability is easier than it was 40 years ago, but still not easy. :-/
Quoted 8 lines
Hi,
You might be interested in this email thread in 2012 at GNU bugreport:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13001Looks like the behavior of "uname -p" CodeSamples had assumed is common to Ubuntu and Fedora (as well as RHEL and SUSE).
Hello Akira,
Thanks for contributing this documentation!
Quoted 5 lines
So, this issue is exposed by Leo's choice of archlinux:latest as the base image.
Leo, just out of curiosity, what made you pick Arch Linux?
Arch Linux is a rolling release distro, that tries as much as possible to keep up with the upstream releases.
From previous experiences, I noticed testing your code with upstream libs and tools is better: it avoids falling into issues that have already been fixed upstream, and also help keeping up with changes and improvements in fresh releases.
Quoted 3 lines
Thanks, Akira
Best regards,
Leo