Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Error linking: In peer_lists.h: "multiple definition of peers'" and "multiple definition of blacklists'". #119

Description

@dreirund

There are errors while linking, initially reported in the Arch Linux AUR package page:

[...]
[100%] Linking C executable meshd-nl80211
cd /tmp/authsae-git/src/authsae/linux && /usr/bin/cmake -E cmake_link_script CMakeFiles/meshd-nl80211.dir/link.txt --verbose=1
/usr/bin/cc -g0 -march=x86-64 -mtune=native -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fomit-frame-pointer -fPIC -Wall  -O3 -DNDEBUG -Wl,-O1,--sort-common,--as-needed,-z,relro,--hash-style=gnu -rdynamic CMakeFiles/meshd-nl80211.dir/meshd-nl80211.c.o CMakeFiles/meshd-nl80211.dir/nl.c.o CMakeFiles/meshd-nl80211.dir/watch_ips.c.o CMakeFiles/meshd-nl80211.dir/service.c.o -o meshd-nl80211   -L/tmp/authsae-git/src/authsae  -Wl,-rpath,/tmp/authsae-git/src/authsae: -lconfig -lcrypto -lnl-3 -lnl-genl-3 -lnl-3 -lpthread ../libsae.a -lrt -lnl-genl-3 -lpthread -lrt -lconfig -lcrypto 
/usr/bin/ld: ../libsae.a(sae.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:9: multiple definition of `peers'; ../libsae.a(ampe.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:9: first defined here
/usr/bin/ld: ../libsae.a(sae.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:8: multiple definition of `blacklist'; ../libsae.a(ampe.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:8: first defined here
/usr/bin/ld: ../libsae.a(peers.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:9: multiple definition of `peers'; ../libsae.a(ampe.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:9: first defined here
/usr/bin/ld: ../libsae.a(peers.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:8: multiple definition of `blacklist'; ../libsae.a(ampe.c.o):/tmp/authsae-git/src/authsae/peer_lists.h:8: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [linux/CMakeFiles/meshd-nl80211.dir/build.make:151: linux/meshd-nl80211] Error 1
make[2]: Leaving directory '/tmp/authsae-git/src/authsae'
make[1]: *** [CMakeFiles/Makefile2:131: linux/CMakeFiles/meshd-nl80211.dir/all] Error 2
make[1]: Leaving directory '/tmp/authsae-git/src/authsae'
make: *** [Makefile:139: all] Error 2

Build is carried out with

sed -e 's|\-Werror||' -i CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_LINUX_TARGETS=ON .
sed -i 's|/usr/etc/|/etc|' cmake_install.cmake
make

The removal of -Werror is needed, otherwise it would already bail out earlier with

[...]
[ 27%] Building C object linux/CMakeFiles/mon.dir/__/common.c.o
cd /tmp/authsae-git/src/authsae/linux && /usr/bin/cc  -I/tmp/authsae-git/src/authsae -I/usr/include/libnl3 -g0 -march=x86-64 -mtune=native -O3 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fomit-frame-pointer -fPIC -Wall -Werror -O3 -DNDEBUG   -g -MD -MT linux/CMakeFiles/mon.dir/__/common.c.o -MF CMakeFiles/mon.dir/__/common.c.o.d -o CMakeFiles/mon.dir/__/common.c.o -c /tmp/authsae-git/src/authsae/common.c
In file included from /usr/include/string.h:519,
                 from /tmp/authsae-git/src/authsae/linux/mon.c:45:
In function ‘strncpy’,
    inlined from ‘add_interface’ at /tmp/authsae-git/src/authsae/linux/mon.c:172:3,
    inlined from ‘add_interface’ at /tmp/authsae-git/src/authsae/linux/mon.c:157:13:
/usr/include/bits/string_fortified.h:95:10: error: ‘__builtin___strncpy_chk’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/authsae-git/src/authsae/linux/mon.c: In function ‘add_interface’:
/tmp/authsae-git/src/authsae/linux/mon.c:172:3: note: length computed here
  172 |   strncpy(inf->ifname, ptr, strlen(ptr));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [linux/CMakeFiles/mon.dir/build.make:79: linux/CMakeFiles/mon.dir/mon.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[...]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions