[Debian-med-packaging] Bug#1030614: librandom123: enable riscv64 build in source code

Eric Long i at hack3r.moe
Sun Feb 5 16:59:35 GMT 2023


Source: librandom123
Version: 1.14.0+dfsg-3
Severity: important
Tags: ftbfs patch
Justification: fails to build from source
User: debian-riscv at lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: i at hack3r.moe, debian-riscv at lists.debian.org

Dear maintainers,

librandom123 does not enable riscv64 build by default, which caused FTBFS on
packages like neuron:

```
[ 44%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.cpp.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/nrniv && /usr/bin/c++ -DHAVE_CONFIG_H -DMPICH_SKIP_MPICXX=1 -DMPI_NO_CPPBIND=1 -DOMPI_SKIP_MPICXX=1 -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/<<PKGBUILDDIR>>/src/ivoc -I/<<PKGBUILDDIR>>/src/nrncvode -I/<<PKGBUILDDIR>>/src/nrniv -I/<<PKGBUILDDIR>>/src/nrnoc -I/<<PKGBUILDDIR>>/src/oc -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/nrncvode -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/nrnoc -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/nrnpython -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/oc -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/parallel -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/sundials -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/sundials/shared -I/<<PKGBUILDDIR>>/external/Random123/include -I/<<PKGBUILDDIR>>/src -I/<<PKGBUILDDIR>>/src/gnu -I/<<PKGBUILDDIR>>/src/mesch -I/<<PKGBUILDDIR>>/src/nrnmpi -I/<<PKGBUILDDIR>>/src/nrnpython -I/<<PKGBUILDDIR>>/src/parallel -I/<<PKGBUILDDIR>>/src/scopmath -I/<<PKGBUILDDIR>>/src/sparse -I/<<PKGBUILDDIR>>/src/sparse13 -I/<<PKGBUILDDIR>>/src/sundials -I/<<PKGBUILDDIR>>/src/sundials/cvodes -I/<<PKGBUILDDIR>>/src/sundials/ida -I/<<PKGBUILDDIR>>/src/sundials/shared -I/usr/include/python3.11 -I/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src/nrniv/oc_generated -I/usr/lib/riscv64-linux-gnu/openmpi/include -I/usr/lib/riscv64-linux-gnu/openmpi/include/openmpi -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -O2 -Wno-write-strings -fPIC -std=c++11 -MD -MT src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.cpp.o -MF CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.cpp.o.d -o CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.cpp.o -c /<<PKGBUILDDIR>>/src/oc/nrnran123.cpp
In file included from /usr/include/Random123/features/compilerfeatures.h:218,
                 from /usr/include/Random123/philox.h:37,
                 from /<<PKGBUILDDIR>>/src/oc/nrnran123.cpp:7:
/usr/include/Random123/features/gccfeatures.h:38:4: error: #error "This code has only been tested on x86, powerpc and a few arm platforms."
   38 | #  error "This code has only been tested on x86, powerpc and a few arm platforms."
      |    ^~~~~
/usr/include/Random123/features/gccfeatures.h:39:10: fatal error: including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task: No such file or directory
   39 | #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
```

Full buildd log of neuron: https://buildd.debian.org/status/fetch.php?pkg=neuron&arch=riscv64&ver=8.2.2-2&stamp=1675434052&raw=0

I've successfully built neuron on riscv64 by adding macro condition to bypass
manual compilation error, as shown in the attached patch. If more help is
needed, please let me know.

Cheers,
Eric
-------------- next part --------------
--- a/include/Random123/features/gccfeatures.h
+++ b/include/Random123/features/gccfeatures.h
@@ -34,7 +34,7 @@
 
 #define R123_GNUC_VERSION (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
 
-#if !defined(__x86_64__) && !defined(__i386__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__aarch64__) && !defined(__s390x__)
+#if !defined(__x86_64__) && !defined(__i386__) && !defined(__powerpc__) && !defined(__arm__) && !defined(__aarch64__) && !defined(__s390x__) && !defined(__riscv)
 #  error "This code has only been tested on x86, powerpc and a few arm platforms."
 #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task>
 { /* maybe an unbalanced brace will terminate the compilation */


More information about the Debian-med-packaging mailing list