File: Link-libatomic-against-wsclean-lib-on-riscv64-and-fix-FTB.patch

package info (click to toggle)
wsclean 3.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,296 kB
  • sloc: cpp: 129,246; python: 22,066; sh: 360; ansic: 230; makefile: 185
file content (47 lines) | stat: -rw-r--r-- 1,938 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Eric Long <i@hack3r.moe>
Date: Fri, 26 Aug 2022 13:11:39 +0800
Subject: Link libatomic against wsclean-lib on riscv64 and fix FTBFS

Dear maintainer,

wsclean failed to build on riscv64:

```
[100%] Built target wsclean-shared
/usr/bin/ld: libwsclean.a(msgridderbase.cpp.o): in function `MSGridderBase::getAvailableMemory(double, double)':
./obj-riscv64-linux-gnu/./gridding/msgridderbase.cpp:300: undefined reference to `__atomic_exchange_1'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/wsclean.dir/build.make:154: wsclean] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:286: CMakeFiles/wsclean.dir/all] Error 2
make[2]: Leaving directory '/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu'
make[1]: *** [Makefile:139: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu'
dh_auto_build: error: cd obj-riscv64-linux-gnu && make -j4 "INSTALL=install --strip-program=true" VERBOSE=1 returned exit code 2
make: *** [debian/rules:10: binary-arch] Error 25
dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
```

Attached is a patch that links libatomic on riscv64 and fixes FTBFS, tested on
my QEMU riscv64 machine. Please let me know if I missed something.

Cheers,
Eric
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6830fc2..1de7f9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,6 +433,9 @@ list(PREPEND EXTERNAL_LIBRARIES ${RADLER_LIB})
 
 add_library(wsclean-lib STATIC)
 target_link_libraries(wsclean-lib PRIVATE ${EXTERNAL_LIBRARIES} wsclean-object)
+if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "riscv64")
+    target_link_libraries(wsclean-lib PRIVATE -latomic)
+endif()
 set_target_properties(wsclean-lib PROPERTIES OUTPUT_NAME wsclean)
 set_target_properties(wsclean-lib PROPERTIES SOVERSION ${WSCLEAN_VERSION_SO})