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

Bug#1011502: codeblocks: ftbfs on riscv64 arch (error: #error "Unknown CPU architecture")



Source: codeblocks
Version: 20.03-3.1
Severity: normal
Tags: ftbfs, patch
User: debian-riscv@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv@lists.debian.org

Dear Maintainer,

The codeblocks package has a ftbfs issue on riscv64 arch:

```
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/lib/riscv64-linux-gnu/wx/include/gtk3-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/include/glib-2.0 -I/usr/lib/riscv64-linux-gnu/glib-2.0/include -I../../src/include/scripting/include -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/include/scripting/bindings -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -I../../src/include/mozilla_chardet/mfbt -I../../src/include/mozilla_chardet/nsprpub/pr/include -I../../src/include/mozilla_chardet/xpcom -I../../src/include/mozilla_chardet/xpcom/base -I../../src/include/mozilla_chardet/xpcom/glue -DCB_AUTOCONF -Wdate-time -D_FORTIFY_SOURCE=2 -DNDEBUG -DBUILD_DATE=\"2021-11-08\" -DBUILD_TIME=\"13:51:13\" -DCB_PRECOMP -DPIC -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -std=gnu++14 -Winvalid-pch -fPIC -fexceptions -c mozilla_chardet/src/nsCharSetProber.cpp  -fPIC -DPIC -o mozilla_chardet/src/.libs/nsCharSetProber.o
In file included from ../../src/include/mozilla_chardet/nsprpub/pr/include/prcpucfg.h:40,
                from ../../src/include/mozilla_chardet/nsprpub/pr/include/prtypes.h:26,
                from ../../src/include/mozilla_chardet/nsprpub/pr/include/prmem.h:14,
                from mozilla_chardet/src/nsCharSetProber.cpp:7:
../../src/include/mozilla_chardet/nsprpub/pr/include/prcpucfg_linux.h:919:2: error: #error "Unknown CPU architecture"
 919 | #error "Unknown CPU architecture"
     |  ^~~~~
In file included from ../../src/include/mozilla_chardet/nsprpub/pr/include/prmem.h:14,
                from mozilla_chardet/src/nsCharSetProber.cpp:7:
../../src/include/mozilla_chardet/nsprpub/pr/include/prtypes.h:263:2: error: #error No suitable type for PRInt8/PRUint8
...
```
The full buildd log is here:
https://buildd.debian.org/status/fetch.php?pkg=codeblocks&arch=riscv64&ver=20.03-3.1&stamp=1636403405&raw=0

The patch attached is to fix the issue and it is ok to build on riscv64:

```
Build Architecture: riscv64
Build Type: binary
Build-Space: 4754304
Build-Time: 10228
Distribution: unstable
Host Architecture: riscv64
Install-Time: 198
Job: /home/vimer/05/30_codeblocks/codeblocks_20.03-3.1.dsc
Lintian: warn
Machine Architecture: riscv64
Package: codeblocks
Package-Time: 10545
Source-Version: 20.03-3.1
Space: 4754304
Status: successful
Version: 20.03-3.1
```
Please consider to apply it in next upload, thank you~

BTW, I am fail to register account for codeblacks on https://forums.codeblocks.org/index.php/board,7.0.html to forward the patch for them. Please to let them know if it is convenient for you. thanks again~

Bo

--
Best Regards,

fix ftbfs on riscv64 arch.

refer to:

https://openbsdmailbox.blogspot.com/2022/04/let-codeblocks-build-on-riscv64.html
--- a/src/include/mozilla_chardet/nsprpub/pr/include/prcpucfg_linux.h
+++ b/src/include/mozilla_chardet/nsprpub/pr/include/prcpucfg_linux.h
@@ -643,6 +643,52 @@
 #define PR_BYTES_PER_WORD_LOG2  3
 #define PR_BYTES_PER_DWORD_LOG2 3
 
+#elif defined(__riscv) && __riscv_xlen == 64
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+#define IS_64
+
+#define PR_BYTES_PER_BYTE 1
+#define PR_BYTES_PER_SHORT 2
+#define PR_BYTES_PER_INT 4
+#define PR_BYTES_PER_INT64 8
+#define PR_BYTES_PER_LONG 8
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 8
+#define PR_BYTES_PER_DWORD 8
+
+#define PR_BITS_PER_BYTE 8
+#define PR_BITS_PER_SHORT 16
+#define PR_BITS_PER_INT 32
+#define PR_BITS_PER_INT64 64
+#define PR_BITS_PER_LONG 64
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 64
+
+#define PR_BITS_PER_BYTE_LOG2 3
+#define PR_BITS_PER_SHORT_LOG2 4
+#define PR_BITS_PER_INT_LOG2 5
+#define PR_BITS_PER_INT64_LOG2 6
+#define PR_BITS_PER_LONG_LOG2 6
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 6
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 8
+#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD 8
+
+#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
 #elif defined(__hppa__)
 
 #undef  IS_LITTLE_ENDIAN

Attachment: signature.asc
Description: PGP signature


Reply to: