Hello Amin,

Would you consider merging this directly into opendht?

Cheers,

--
Alexandre Viau
alexan...@alexandreviau.net

On Mon, 28 Dec 2020 at 11:45, Aurelien Jarno <aure...@debian.org> wrote:
>
> Source: opendht
> Version: 2.1.9.5-1
> Severity: normal
> Tags: ftbfs patch upstream
> User: debian-ri...@lists.debian.org
> Usertags: riscv64
>
> Hi,
>
> opendht fails to build on riscv64 with the following failure:
> | /usr/bin/c++ -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. 
> -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
> -D_FORTIFY_SOURCE=2 -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor 
> -pedantic-errors -fvisibility=hidden -DMSGPACK_DISABLE_LEGACY_NIL 
> -DMSGPACK_DISABLE_LEGACY_CONVERT -Wl,-z,relro -Wl,-z,now -rdynamic 
> CMakeFiles/durl.dir/durl.cpp.o -o durl  -lreadline -lncurses ../libopendht.a 
> -largon2 -lrt -ldl -lpthread -lgnutls -lnettle -ljsoncpp -Wl,-Bstatic -lfmt 
> -Wl,-Bdynamic -lhttp_parser -lssl -lcrypto -ldl -lpthread -lgnutls -lnettle 
> -ljsoncpp -Wl,-Bstatic -lfmt -Wl,-Bdynamic -lhttp_parser -lssl -lcrypto
> | /usr/bin/ld: ../libopendht.a(http.cpp.o): in function `.L0 ':
> | /usr/include/asio/detail/completion_handler.hpp:72: undefined reference to 
> `__atomic_exchange_1'
> | /usr/bin/ld: ../libopendht.a(network_utils.cpp.o): in function 
> `dht::net::UdpSocket::stop()':
> | ./obj-riscv64-linux-gnu/./src/network_utils.cpp:350: undefined reference to 
> `__atomic_exchange_1'
> | /usr/bin/ld: ../libopendht.a(dht_proxy_client.cpp.o): in function 
> `__gnu_cxx::__exchange_and_add_single(int*, int)':
> | /usr/include/c++/10/ext/atomicity.h:69: undefined reference to 
> `__atomic_exchange_1'
> | collect2: error: ld returned 1 exit status
>
> The full build log is available there:
> https://buildd.debian.org/status/fetch.php?pkg=opendht&arch=riscv64&ver=2.1.9.5-1&stamp=1607520181&raw=0
>
> The problem is that the linking is not done correctly, it uses -lpthread
> meaning linking with the pthread library, instead of -pthread which
> means enable thread support, and which brings libatomic.so on riscv64.
> This can be fixed by using the THREADS_PREFER_PTHREAD_FLAG option, which
> is "highly recommended" according to the documentation, but
> unfortunately not the default.
>
> This is what the attached patch does, could you please include it in the
> next upload?
>
> Thanks,
> Aurelien

Reply via email to