Source:
kcovVersion: 38+dfsg-1
Severity: important
Tags: FTBFS, patch
Dear kcov Maintainer,
The kcov compile failed on riscv64 caused by "Unsupported architecture", the crucial buildd log below:
```
/<<PKGBUILDDIR>>/src/solib-parser/lib.c:99:3: error: #error Unsupported architecture
99 | # error Unsupported architecture
| ^~~~~
/<<PKGBUILDDIR>>/src/solib-parser/lib.c:101:4: error: expected string literal before ‘)’ token
101 | );
| ^
make[3]: *** [src/CMakeFiles/kcov_sowrapper.dir/build.make:79: src/CMakeFiles/kcov_sowrapper.dir/solib-parser/lib.c.o] Error 1
make[3]: Leaving directory '/<<PKGBUILDDIR>>/obj-riscv64-linux-gnu'
make[2]: *** [CMakeFiles/Makefile2:235: src/CMakeFiles/kcov_sowrapper.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 9%] Built target bash_execve_redirector
[ 10%] Building CXX object src/CMakeFiles/kcov-system-daemon.dir/dummy-solib-handler.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -o CMakeFiles/kcov-system-daemon.dir/dummy-solib-handler.cc.o -c /<<PKGBUILDDIR>>/src/dummy-solib-handler.cc
[ 12%] Building CXX object src/CMakeFiles/kcov-system-daemon.dir/engine-factory.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -o CMakeFiles/kcov-system-daemon.dir/engine-factory.cc.o -c /<<PKGBUILDDIR>>/src/engine-factory.cc
[ 13%] Building CXX object src/CMakeFiles/kcov_system_lib.dir/utils.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -Dkcov_system_lib_EXPORTS -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -fPIC -o CMakeFiles/kcov_system_lib.dir/utils.cc.o -c /<<PKGBUILDDIR>>/src/utils.cc
[ 14%] Building CXX object src/CMakeFiles/kcov-system-daemon.dir/engines/system-mode-file-format.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -o CMakeFiles/kcov-system-daemon.dir/engines/system-mode-file-format.cc.o -c /<<PKGBUILDDIR>>/src/engines/system-mode-file-format.cc
[ 16%] Building CXX object src/CMakeFiles/kcov_system_lib.dir/system-mode/registration.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -Dkcov_system_lib_EXPORTS -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -fPIC -o CMakeFiles/kcov_system_lib.dir/system-mode/registration.cc.o -c /<<PKGBUILDDIR>>/src/system-mode/registration.cc
[ 17%] Building CXX object src/CMakeFiles/kcov-system-daemon.dir/engines/ptrace.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -o CMakeFiles/kcov-system-daemon.dir/engines/ptrace.cc.o -c /<<PKGBUILDDIR>>/src/engines/ptrace.cc
[ 18%] Building CXX object src/CMakeFiles/kcov-system-daemon.dir/engines/ptrace_linux.cc.o
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/c++ -DPACKAGE -DPACKAGE_VERSION -I/<<PKGBUILDDIR>>/src/include -I/<<PKGBUILDDIR>>/src/../external/lldb/include -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -std=c++0x -g -Wall -D_GLIBCXX_USE_NANOSLEEP -DKCOV_LIBRARY_PREFIX=/tmp -DKCOV_HAS_LIBBFD=0 -o CMakeFiles/kcov-system-daemon.dir/engines/ptrace_linux.cc.o -c /<<PKGBUILDDIR>>/src/engines/ptrace_linux.cc
/<<PKGBUILDDIR>>/src/engines/ptrace.cc:53:3: error: #error Unsupported architecture
53 | # error Unsupported architecture
| ^~~~~
/<<PKGBUILDDIR>>/src/engines/ptrace_linux.cc:46:3: error: #error Unsupported architecture
46 | # error Unsupported architecture
| ^~~~~
/<<PKGBUILDDIR>>/src/engines/ptrace_linux.cc:65:3: error: #error Unsupported architecture
65 | # error Unsupported architecture
| ^~~~~
make[3]: *** [src/CMakeFiles/kcov-system-daemon.dir/build.make:135: src/CMakeFiles/kcov-system-daemon.dir/engines/ptrace_linux.cc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [src/CMakeFiles/kcov-system-daemon.dir/build.make:122: src/CMakeFiles/kcov-system-daemon.dir/engines/ptrace.cc.o] Error 1
```
The full buildd log is here:
My solution to this issue:
Add a patch(my patch is in the attachment) to add basic support for arch riscv and loong.By the way,I have included the correct header file <cstdint> in the relevant files.Details can be found in the attachment.
I have tested this patch in local, it work effectively, Please let me know wheather this patch can be accepted.
Gui-Yue
Best Regards