Source: hardinfo
Version: 2.2.1-1
Severity: normal
Tags: ftbfs patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Hi maintainers,

Compiling the hardinfo failed for loong64 in the Debian Package Auto-Building environment.
The build error log is as follows,
```
first error......
/<<PKGBUILDDIR>>/modules/devices/loongarch64/processor.c:56:44: error: ‘q’ undeclared (first use in this function)
   56 |     return g_slist_append(NULL, processor);q
      |                                            ^
/<<PKGBUILDDIR>>/modules/devices/loongarch64/processor.c:56:44: note: each undeclared identifier is reported only once for each function it appears in /<<PKGBUILDDIR>>/modules/devices/loongarch64/processor.c:56:45: error: expected ‘;’ before ‘}’ token
   56 |     return g_slist_append(NULL, processor);q
      |                                             ^
      |                                             ;
   57 | }

second error......
/usr/include/glib-2.0/glib/gstrfuncs.h:324:9: note: macro "g_strdup" defined here
  324 | #define g_strdup(x) g_strdup_inline (x)
      |         ^~~~~~~~
/<<PKGBUILDDIR>>/modules/devices/loongarch64/processor.c:71:17: error: assignment to ‘gchar *’ {aka ‘char *’} from incompatible pointer type ‘gchar * (*)(const gchar *)’ {aka ‘char * (*)(const char *)’} [-Wincompatible-pointer-types]    71 |     if(!ret) ret=g_strdup("Loongarch64 Processor (%s/NoDT)",processor_name_default_(processors));
      |                 ^
......
```
The full log can be found at https://buildd.debian.org/status/fetch.php?pkg=hardinfo&arch=loong64&ver=2.2.1-1&stamp=1730360209&raw=0.

After investigation, I found that there were coding errors in the upstream since release-2.1.16pre version.
Please check https://github.com/hardinfo2/hardinfo2/blob/release-2.1.16pre.

I have fixed above 2 code writing errors on loong64.
Please consider the patch attached.
I have built hardinfo 2.2.1-1 successfully in my local ENV and all test cases passed.
```
   dh_builddeb -O--buildsystem=cmake
dpkg-deb: building package 'hardinfo' in '../hardinfo_2.2.1-1+loong64_all.deb'. dpkg-deb: building package 'hardinfo2' in '../hardinfo2_2.2.1-1+loong64_loong64.deb'. dpkg-deb: building package 'hardinfo2-dbgsym' in '../hardinfo2-dbgsym_2.2.1-1+loong64_loong64.deb'.
 dpkg-genbuildinfo -O../hardinfo_2.2.1-1+loong64_loong64.buildinfo
 dpkg-genchanges -O../hardinfo_2.2.1-1+loong64_loong64.changes
```

Best regards,
Dandan Zhang

diff -Nru hardinfo-2.2.1/debian/changelog hardinfo-2.2.1/debian/changelog
--- hardinfo-2.2.1/debian/changelog     2024-10-30 20:20:26.000000000 +0000
+++ hardinfo-2.2.1/debian/changelog     2024-11-02 03:49:01.000000000 +0000
@@ -1,3 +1,11 @@
+hardinfo (2.2.1-1+loong64) unreleased; urgency=medium
+
+  * Fix 2 build errors on loong64 (FTBFS)
+    - error: expected ';' before '}' token
+    - error: macro "g_strdup" passed 2 arguments, but takes just 1 
+
+ -- Dandan Zhang <zhangdan...@loongson.cn>  Sat, 02 Nov 2024 11:49:01 +0800
+
 hardinfo (2.2.1-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru hardinfo-2.2.1/debian/patches/Fix-FTBFS-on-loong64.patch 
hardinfo-2.2.1/debian/patches/Fix-FTBFS-on-loong64.patch
--- hardinfo-2.2.1/debian/patches/Fix-FTBFS-on-loong64.patch    1970-01-01 
00:00:00.000000000 +0000
+++ hardinfo-2.2.1/debian/patches/Fix-FTBFS-on-loong64.patch    2024-11-02 
03:49:01.000000000 +0000
@@ -0,0 +1,48 @@
+Description: Fixed FTBFS on loong64 
+ .
+ hardinfo (2.2.1-1+loong64) unreleased; urgency=medium
+ .
+   * Fix 2 build errors on loong64 (FTBFS)
+     - error: expected ';' before '}' token
+     - error: macro "g_strdup" passed 2 arguments, but takes just 1
+Author: Dandan Zhang <zhangdan...@loongson.cn>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
+Bug: <upstream-bugtracker-url>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: (no|not-needed|<patch-forwarded-url>)
+Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
+Reviewed-By: <name and email of someone who approved/reviewed the patch>
+Last-Update: 2024-11-02
+
+--- hardinfo-2.2.1.orig/modules/devices/loongarch64/processor.c
++++ hardinfo-2.2.1/modules/devices/loongarch64/processor.c
+@@ -53,7 +53,7 @@ processor_scan(void)
+ 
+     fclose(cpuinfo);
+ 
+-    return g_slist_append(NULL, processor);q
++    return g_slist_append(NULL, processor);
+ }
+ 
+ gchar *processor_name(GSList * processors) {
+@@ -64,11 +64,11 @@ gchar *processor_name(GSList * processor
+ 
+     if (compat != NULL) {
+         //FIXME - Add table for incoming compatible DT info
+-        ret= g_strdup_printf("Loongarch64 Processor 
(%s/%s)",processor_name_default(processors), compat);
++        ret = g_strdup_printf("Loongarch64 Processor 
(%s/%s)",processor_name_default(processors), compat);
+         g_free(compat);
+     }
+ 
+-    if(!ret) ret=g_strdup("Loongarch64 Processor 
(%s/NoDT)",processor_name_default_(processors));
++    if(!ret) ret = g_strdup("Loongarch64 Processor (%s/NoDT)");
+     return ret;
+ }
+ 
diff -Nru hardinfo-2.2.1/debian/patches/series 
hardinfo-2.2.1/debian/patches/series
--- hardinfo-2.2.1/debian/patches/series        1970-01-01 00:00:00.000000000 
+0000
+++ hardinfo-2.2.1/debian/patches/series        2024-11-02 03:49:01.000000000 
+0000
@@ -0,0 +1 @@
+Fix-FTBFS-on-loong64.patch

Reply via email to