route_hazard no longer builds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Trying to build route_hazard on Ubuntu 22.04, GCC 11.3:

cc -g -O3 -Wall -o route_hazptr route_hazptr.c hazptr.c
../lib/random.c -lpthread
/usr/bin/ld: /tmp/ccK5WldD.o:/home/elahav/src/other/perfbook/CodeSamples/defer/hazptr.h:55:
multiple definition of `HP';
/tmp/ccWgXBZR.o:/home/elahav/src/other/perfbook/CodeSamples/defer/hazptr.h:55:
first defined here
/usr/bin/ld: /tmp/ccK5WldD.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:294:
multiple definition of `thread_id_key';
/tmp/ccWgXBZR.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:294:
first defined here
/usr/bin/ld: /tmp/ccK5WldD.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:278:
multiple definition of `__thread_id_map';
/tmp/ccWgXBZR.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:278:
first defined here
/usr/bin/ld: /tmp/ccK5WldD.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:279:
multiple definition of `__thread_id_map_mutex';
/tmp/ccWgXBZR.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:279:
first defined here
/usr/bin/ld: /tmp/ccK5WldD.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:485:
multiple definition of `__per_thread_smp_processor_id';
/tmp/ccWgXBZR.o:/home/elahav/src/other/perfbook/CodeSamples/defer/../api.h:485:
first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:129: route_hazptr] Error 1

Both route_hazptr.c and hazptr.c include api.h, which defines (not
just declares) a few global variables. I'm a bit surprised this worked
in the past. Perhaps there should be an api static library against
which all examples build?

Also, when trying to fix this I noticed that
DECLARE_PER_THREAD/DEFINE_PER_THREAD cannot work in conjunction, as
GCC seems to treat the following as unrelated:

extern struct { int a; } foo;
struct { int a; } foo;

$ gcc -Wall -c test.c
test.c:2:19: error: conflicting types for ‘foo’; have ‘struct <anonymous>’
    2 | struct { int a; } foo;
      |                   ^~~
test.c:1:26: note: previous declaration of ‘foo’ with type ‘struct <anonymous>’
    1 | extern struct { int a; } foo;
      |




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux