On Sat, 2024-12-28 at 15:23 -0300, Leonardo Brás wrote:
> On Sat, 2024-12-28 at 16:12 +0900, Akira Yokosawa wrote:
> > From: Leonardo Bras <[email protected]>
> > 
> > liburcu 0.15.0 deprecated urcu-signal as a library.
> > This causes build errors in gitlab-CI [1]:
> > 
> >     /usr/sbin/ld: cannot find -lurcu-signal: No such file or directory
> >     collect2: error: ld returned 1 exit status
> > 
> > Work around them by adding command lines w/o "-lurcu-signal" as
> > fallbacks in relevant Makefile recipes.
> > 
> > Link: https://gitlab.com/linux-kernel/perfbook/-/jobs/8732944799 [1]
> > Signed-off-by: Leonardo Bras <[email protected]>
> > Co-developed-by: Akira Yokosawa <[email protected]>
> > [akiyks: rewrite changelog, restore compatibility with liburcu <0.15.0]
> > Signed-off-by: Akira Yokosawa <[email protected]>
> > ---
> > Hi,
> > 
> > Admittedly, this is one of the least elegant workaround for ArchLinux
> > and soon-to-be upgraded other rolling distros, but still looks straight
> > forward to me.
> > 
> > Can you live with this?
> > 
> > This is tested against Ubuntu 20.04 LTS (liburcu 0.11.1),
> > Ubuntu 24.04 LTS (liburcu 0.14.0), Fedora 41 (liburcu 0.14.1),
> > and ArchLinux (liburcu 0.15.0).
> > 
> >         Thanks, Akira
> > --
> >  CodeSamples/datastruct/Issaquah/Makefile  |  6 +++--
> >  CodeSamples/datastruct/existence/Makefile | 30 +++++++++++++++--------
> >  CodeSamples/datastruct/hash/Makefile      |  9 ++++---
> >  CodeSamples/datastruct/skiplist/Makefile  |  6 +++--
> >  CodeSamples/defer/Makefile                |  9 ++++---
> >  5 files changed, 40 insertions(+), 20 deletions(-)
> > 
> > diff --git a/CodeSamples/datastruct/Issaquah/Makefile 
> > b/CodeSamples/datastruct/Issaquah/Makefile
> > index c3b724d7..75fd840b 100644
> > --- a/CodeSamples/datastruct/Issaquah/Makefile
> > +++ b/CodeSamples/datastruct/Issaquah/Makefile
> > @@ -45,10 +45,12 @@ GCC_ARGS += -fcommon
> >  #   Verify by using the nm command and searching output for malloc.
> >  
> >  existence_test: existence.c existence_test.c
> > -   cc $(GCC_ARGS) -o existence_test existence.c existence_test.c -lpthread 
> > -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o existence_test existence.c existence_test.c -lpthread 
> > -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o existence_test existence.c existence_test.c -lpthread 
> > -lurcu
> >  
> >  treetorture: tree.c existence.c spinlockmult.c $(LIB)/random.c ../../api.h 
> > treetorture.h treetorturetrace.h $(LIB)/random.h existence.h tree.h
> > -   cc $(GCC_ARGS) -o treetorture tree.c existence.c spinlockmult.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o treetorture tree.c existence.c spinlockmult.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o treetorture tree.c existence.c spinlockmult.c 
> > $(LIB)/random.c -lpthread -lurcu
> >  
> >  clean:
> >     rm -f $(PROGS)
> > diff --git a/CodeSamples/datastruct/existence/Makefile 
> > b/CodeSamples/datastruct/existence/Makefile
> > index 19891c0f..568e7c2d 100644
> > --- a/CodeSamples/datastruct/existence/Makefile
> > +++ b/CodeSamples/datastruct/existence/Makefile
> > @@ -44,39 +44,49 @@ all: $(PROGS)
> >  #  So it is quite a bit easier to just use the default locations.  ;-)
> >  
> >  existence_test: existence.h existence_test.c procon.h
> > -   cc $(GCC_ARGS) -o existence_test existence_test.c -lpthread -lurcu 
> > -lurcu-signal
> > +   cc $(GCC_ARGS) -o existence_test existence_test.c -lpthread -lurcu 
> > -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o existence_test existence_test.c -lpthread -lurcu
> >  
> >  existence_3hash_test: existence.h hash_exists.h keyvalue.h 
> > existence_3hash_test.c procon.h
> > -   cc $(GCC_ARGS) -o existence_3hash_test existence_3hash_test.c -lpthread 
> > -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o existence_3hash_test existence_3hash_test.c -lpthread 
> > -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o existence_3hash_test existence_3hash_test.c -lpthread 
> > -lurcu
> >  
> >  existence_3hash_uperf: existence.h hash_exists.h keyvalue.h 
> > existence_3hash_uperf.c procon.h
> >     # cc -O0 -Wall -ggdb -fno-inline -o existence_3hash_uperf 
> > existence_3hash_uperf.c -ltcmalloc -lpthread -lurcu -lurcu-signal
> > -   cc $(GCC_ARGS) -o existence_3hash_uperf existence_3hash_uperf.c 
> > -ltcmalloc -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o existence_3hash_uperf existence_3hash_uperf.c 
> > -ltcmalloc -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o existence_3hash_uperf existence_3hash_uperf.c 
> > -ltcmalloc -lpthread -lurcu
> >  
> >  existence_3skiplist_test: existence.h skiplist_exists.h keyvalue.h 
> > existence_3skiplist_test.c procon.h
> > -   cc -g -O0 -o existence_3skiplist_test existence_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc -g -O0 -o existence_3skiplist_test existence_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc -g -O0 -o existence_3skiplist_test existence_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu
> >     # cc $(GCC_ARGS) -o existence_3skiplist_test existence_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> >  
> >  existence_3skiplist_uperf: existence.h hash_exists.h keyvalue.h 
> > existence_3skiplist_uperf.c procon.h
> >     # cc -O0 -Wall -ggdb -fno-inline -o existence_3skiplist_uperf 
> > existence_3skiplist_uperf.c -ltcmalloc $(LIB)/random.c -lpthread -lurcu 
> > -lurcu-signal
> > -   cc $(GCC_ARGS) -o existence_3skiplist_uperf existence_3skiplist_uperf.c 
> > -ltcmalloc $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o existence_3skiplist_uperf existence_3skiplist_uperf.c 
> > -ltcmalloc $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o existence_3skiplist_uperf existence_3skiplist_uperf.c 
> > -ltcmalloc $(LIB)/random.c -lpthread -lurcu
> >  
> >  kaleidoscope_test: kaleidoscope.h kaleidoscope_test.c procon.h
> > -   cc $(GCC_ARGS) -o kaleidoscope_test kaleidoscope_test.c -lpthread 
> > -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o kaleidoscope_test kaleidoscope_test.c -lpthread 
> > -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o kaleidoscope_test kaleidoscope_test.c -lpthread -lurcu
> >  
> >  kaleidoscope_3hash_test: kaleidoscope.h hash_exists.h keyvalue.h 
> > kaleidoscope_3hash_test.c procon.h
> > -   cc $(GCC_ARGS) -o kaleidoscope_3hash_test kaleidoscope_3hash_test.c 
> > -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o kaleidoscope_3hash_test kaleidoscope_3hash_test.c 
> > -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o kaleidoscope_3hash_test kaleidoscope_3hash_test.c 
> > -lpthread -lurcu
> >  
> >  kaleidoscope_3skiplist_test: kaleidoscope.h skiplist_exists.h keyvalue.h 
> > kaleidoscope_3skiplist_test.c procon.h
> > -   cc -g -O0 -o kaleidoscope_3skiplist_test kaleidoscope_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc -g -O0 -o kaleidoscope_3skiplist_test kaleidoscope_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc -g -O0 -o kaleidoscope_3skiplist_test kaleidoscope_3skiplist_test.c 
> > $(LIB)/random.c -lpthread -lurcu
> >     # cc $(GCC_ARGS) -o kaleidoscope_3skiplist_test 
> > kaleidoscope_3skiplist_test.c $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> >  
> >  kaleidoscope_skiphash_test: kaleidoscope.h skiplist_exists.h keyvalue.h 
> > kaleidoscope_skiphash_test.c procon.h
> > -   cc -g -O0 -o kaleidoscope_skiphash_test kaleidoscope_skiphash_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc -g -O0 -o kaleidoscope_skiphash_test kaleidoscope_skiphash_test.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc -g -O0 -o kaleidoscope_skiphash_test kaleidoscope_skiphash_test.c 
> > $(LIB)/random.c -lpthread -lurcu
> >     # cc $(GCC_ARGS) -o kaleidoscope_skiphash_test 
> > kaleidoscope_skiphash_test.c $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> >  
> >  procon_test: procon.h procon_test.c
> > -   cc -O0 -g -o procon_test procon_test.c -lpthread -lurcu -lurcu-signal
> > +   cc -O0 -g -o procon_test procon_test.c -lpthread -lurcu -lurcu-signal 
> > || \
> > +   cc -O0 -g -o procon_test procon_test.c -lpthread -lurcu
> >     # cc $(GCC_ARGS) -o procon_test procon_test.c -lpthread -lurcu 
> > -lurcu-signal
> >  
> >  clean:
> > diff --git a/CodeSamples/datastruct/hash/Makefile 
> > b/CodeSamples/datastruct/hash/Makefile
> > index a56255a2..a558dfee 100644
> > --- a/CodeSamples/datastruct/hash/Makefile
> > +++ b/CodeSamples/datastruct/hash/Makefile
> > @@ -44,7 +44,8 @@ hash_bkt_qsbr: hash_bkt_rcu.c ../../api.h hashtorture.h
> >     cc $(GCC_ARGS) -DTEST_HASH -DPERFBOOK_RCU_QSBR -o hash_bkt_qsbr 
> > hash_bkt_rcu.c $(LIB)/random.c -lpthread -lurcu -lurcu-qsbr
> >  
> >  hash_bkt_rcu: hash_bkt_rcu.c ../../api.h hashtorture.h
> > -   cc $(GCC_ARGS) -DTEST_HASH -o hash_bkt_rcu hash_bkt_rcu.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_bkt_rcu hash_bkt_rcu.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_bkt_rcu hash_bkt_rcu.c 
> > $(LIB)/random.c -lpthread -lurcu
> >  
> >  hash_bkt_hazptr: hash_bkt_hazptr.c ../../defer/hazptr.c 
> > ../../defer/hazptr.h ../../api.h hashtorture.h
> >     cc $(GCC_ARGS) -DTEST_HASH -o hash_bkt_hazptr hash_bkt_hazptr.c 
> > ../../defer/hazptr.c $(LIB)/random.c -lpthread
> > @@ -53,10 +54,12 @@ hash_global: hash_global.c ../../api.h hashtorture.h
> >     cc $(GCC_ARGS) -DTEST_HASH -o hash_global hash_global.c $(LIB)/random.c 
> > -lpthread
> >  
> >  hash_resize: hash_resize.c ../../api.h hashtorture.h
> > -   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize hash_resize.c $(LIB)/random.c 
> > -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize hash_resize.c $(LIB)/random.c 
> > -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize hash_resize.c $(LIB)/random.c 
> > -lpthread -lurcu
> >  
> >  hash_resize_s: hash_resize_s.c ../../api.h hashtorture.h
> > -   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize_s hash_resize_s.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize_s hash_resize_s.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -DTEST_HASH -o hash_resize_s hash_resize_s.c 
> > $(LIB)/random.c -lpthread -lurcu
> >  
> >  hash_unsync: hash_unsync.c ../../api.h hashtorture.h
> >     cc $(GCC_ARGS) -DTEST_HASH -o hash_unsync hash_unsync.c $(LIB)/random.c 
> > -lpthread
> > diff --git a/CodeSamples/datastruct/skiplist/Makefile 
> > b/CodeSamples/datastruct/skiplist/Makefile
> > index 3a555691..8cf9d47a 100644
> > --- a/CodeSamples/datastruct/skiplist/Makefile
> > +++ b/CodeSamples/datastruct/skiplist/Makefile
> > @@ -33,10 +33,12 @@ endif
> >  include $(top)/recipes.mk
> >  
> >  skiplist: skiplist.c ../../api.h skiplisttorture.h skiplist.h
> > -   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist skiplist.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist skiplist.c 
> > $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist skiplist.c 
> > $(LIB)/random.c -lpthread -lurcu
> >  
> >  skiplist_glock: skiplist_glock.c ../../api.h skiplisttorture.h skiplist.h
> > -   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist_glock 
> > skiplist_glock.c $(LIB)/random.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist_glock 
> > skiplist_glock.c $(LIB)/random.c -lpthread -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -DTEST_SKIPLIST -I $(LIB) -g -o skiplist_glock 
> > skiplist_glock.c $(LIB)/random.c -lpthread -lurcu
> >  
> >  clean:
> >     rm -f $(PROGS)
> > diff --git a/CodeSamples/defer/Makefile b/CodeSamples/defer/Makefile
> > index 3cf3e5a5..b4af17db 100644
> > --- a/CodeSamples/defer/Makefile
> > +++ b/CodeSamples/defer/Makefile
> > @@ -80,7 +80,8 @@ hazptr: hazptr.c hazptr.h ../api.h hazptrtorture.h
> >     cc $(GCC_ARGS) -o hazptr -DTEST hazptr.c -lpthread
> >  
> >  ptxroute: ptxroute.c ../api.h
> > -   cc $(GCC_ARGS) -o ptxroute ptxroute.c -lpthread -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o ptxroute ptxroute.c -lpthread -lurcu -lurcu-signal || 
> > \
> > +   cc $(GCC_ARGS) -o ptxroute ptxroute.c -lpthread -lurcu
> >  
> >  rcu: rcu.c rcu.h ../api.h rcutorture.h
> >     cc $(GCC_ARGS) -o rcu -DTEST rcu.c -lpthread
> > @@ -131,7 +132,8 @@ route_hazptr: route_hazptr.c hazptr.c hazptr.h ../api.h 
> > ../lib/random.h ../lib/r
> >     cc $(GCC_ARGS) -o route_hazptr route_hazptr.c hazptr.c ../lib/random.c 
> > -lpthread
> >  
> >  route_rcu: route_rcu.c ../api.h ../lib/random.h ../lib/random.c 
> > routetorture.h
> > -   cc $(GCC_ARGS) -o route_rcu route_rcu.c ../lib/random.c -lpthread  
> > -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -o route_rcu route_rcu.c ../lib/random.c -lpthread  
> > -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -o route_rcu route_rcu.c ../lib/random.c -lpthread  
> > -lurcu
> >  
> >  route_rcu_qsbr: route_rcu.c ../api.h ../lib/random.h ../lib/random.c 
> > routetorture.h
> >     cc $(GCC_ARGS) -o route_rcu_qsbr -DDO_QSBR route_rcu.c ../lib/random.c 
> > -lpthread  -lurcu-qsbr
> > @@ -149,7 +151,8 @@ seqlocktorture: seqlocktorture.c seqlock.h ../api.h
> >     cc $(GCC_ARGS) -o seqlocktorture seqlocktorture.c -lpthread
> >  
> >  singleton: singleton.c ../api.h ../lib/random.h ../lib/random.c
> > -   cc $(GCC_ARGS) -Wall -g -o singleton singleton.c ../lib/random.c 
> > -lpthread  -lurcu -lurcu-signal
> > +   cc $(GCC_ARGS) -Wall -g -o singleton singleton.c ../lib/random.c 
> > -lpthread  -lurcu -lurcu-signal || \
> > +   cc $(GCC_ARGS) -Wall -g -o singleton singleton.c ../lib/random.c 
> > -lpthread  -lurcu
> >  
> >  clean:
> >     rm -f $(PROGS)
> > 
> > base-commit: 4c0afec5a7081227adc768fb8d3fb35aa1981d55
> 
> Hi Akira,
> 
> That's a creative way of dealing with this issue, but if we want to add that
> complexity, I would rather use $(pkg-config --libs liburcu). 
> 
> Wouldn't this fix the issue as well?
> 
> Thanks!

Also, according to Paul's comment on v2 patch it shouldn't be needed:

> > On the other hand, sys_membarrier() was introduced in 2015 (5b25b13ab08f6),
> > and no supported kernel (>v4.2) should still miss this syscall. Is it worth
> > the added complexity? Is so, let's do it.

> If the -lurcu-signal is left off for old versions of the userspace RCU
> library, doesn't it simply fall back to using explicit memory barriers?
> Or am I yet again misremembering?

>                                       Thanx, Paul

Isn't the above correct?

Thanks!
Leo


Reply via email to