Build issue
Hi!
I wanted to try to build this (in the form of an rpm package).
It stops during a cmake build, right after the pcre2 target.
I think it might have to do with pybind11... I tried using the system provided pybind11, but it couldn't find that for some reason (maybe that is best as a separate issue).
Keep getting an error I can't seem to get any debug on, or get past.
Tried the latest release (4.7.1) and the latest checkout (as of 20250121).
Wondering if you have any clues.
The error follows:
[ 45%] Completed 'pcre2'
/usr/bin/cmake -E make_directory $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/CMakeFiles
/usr/bin/cmake -E touch $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/CMakeFiles/pcre2-complete
/usr/bin/cmake -E touch $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/pcre2-prefix/src/pcre2-stamp/pcre2-done
gmake[2]: Leaving directory '$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build'
[ 45%] Built target pcre2
gmake[1]: Leaving directory '$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build'
gmake: *** [Makefile:139: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.HxXc7c (%build)
($HOME is my home)
Using the following to setup cmake:
/usr/bin/cmake -S . -B redhat-linux-build -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Release -DWITH_X11_FEATURES=OFF -DWITH_DESKTOP=ON -DBUILD_TAGLIB=OFF -DBUILD_RUBBERBAND=OFF -DBUILD_PYBIND11=ON -DBUILD_XZ=ON -DBUILD_OPENBLAS=OFF -DBUILD_FMT=OFF -DBUILD_LIBARCHIVE=OFF -DWITH_PY=ON -DBUILD_QQC2_BREEZE_STYLE=ON -DBUILD_VOSK=OFF -DBUILD_CATCH2=OFF -DBUILD_WHISPERCPP_VULKAN=ON -DBUILD_FFMPEG=ON -DBUILD_BERGAMOT=OFF -DBUILD_RHVOICE=OFF -DBUILD_RHVOICE_MODULE=OFF -DDOWNLOAD_LIBSTT=OFF -DBUILD_ESPEAK_MODULE=OFF -DBUILD_WHISPERCPP_CUBLAS=OFF -DBUILD_WHISPERCPP_HIPBLAS=OFF
Nice!
The cmake command looks fine. I checked it on my system and it works. Most likely, the problem lies in a missing dependency that was not checked at the configuration stage (aka cmake stage). The root cause is printed somewhere above the lines you pasted. It is definitely not a problem with pcre2.
Can you try also with -DBUILD_QQC2_BREEZE_STYLE=OFF?
Just attempted with -DBUILD_QQC2_BREEZE_STYLE=off; same stop point and error.
You are probably right in regards to missing dependency. I've been attempting to match up requirements with the arch PKGBUILD, but probably missed something. This is a build machine, so excessive amount of dependencies and devel packages are already installed.
Also tried export VERBOSE=1 and export V=1 to see if make/gmake would pick up something.
I'm not sure which Makefile the line number is coming from (dammit, make). If it was the one at the root of build, annotated below:
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/CMakeFiles $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all # <<< failing line (139)
$(CMAKE_COMMAND) -E cmake_progress_start $HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/CMakeFiles 0
I've been attempting to match up requirements with the arch PKGBUILD, but probably missed something.
Rather, it is a problem in the cmake script. All dependencies should be verified during the "cmake" step, but not in "make", so it's a bug on my side.
Can you share entire output from cmake and make run?
Aha, yes, definitely a cmake dependency check missing.
Log attached; it's the output of rpmbuild. Any rpmbuild lines are prefixed with + . Both cmake and make are called in this log.
I honestly don't know what went wrong. This log of multi-threaded build is very difficult to read. Can you try with only one thread by adding -j1 to make step?
I suspect this may be the cause (but I am most likely wrong):
-- Found Vulkan: /lib64/libvulkan.so (found version "1.3.283") found components: glslangValidator missing components: glslc
What is the result with -DBUILD_WHISPERCPP_VULKAN=OFF?
Flag is now -DBUILD_WHISPERCPP_VULKAN=OFF; same error.
Tried installing glslc, as it was supposedly missing; same error.
-j1 caused an error:
checking whether we are cross compiling... configure: error: in `$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/external/rnnoise'
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Digging more, I flipped on -DCMAKE_BUILD_PARALLEL_LEVEL=1, also passing --parallel 1 and -j1 to cmake --build, and it slowed the build down, failing at a different [earlier] point:
[ 8%] Built target whispercppopenblas
gmake[1]: Leaving directory '$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build'
gmake: *** [Makefile:139: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.9nkLuE (%build)
Setting it to -j2 to -j5 resulted in the same error, more or less. -j6 brings us to the PCRE stop point. Tried variations of these flags (including -DCMAKE_BUILD_PARALLEL_LEVEL=2) to see if it would move different or past, to no avail.
Thanks for checking.
When using j1, build stops exactly when an error occurs. In parallel build, multiple targets are compiled at the same time, so entire build stops when all parallel tasks are finished. Therefore output log is messy.
So output of j1 tells us what went wrong. It seems that the problem is related to rnnoise. Can you check what is in the log file config.log?
See `config.log' for more details
This is the contents of rnnoise config.log:
Configured with: ../configure --enable-bootstrap --enable-host-pie --enable-host-bind-now --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.rockylinux.org/ --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --enable-initfini-array --without-isl --enable-multilib --with-linker-hash-style=gnu --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_64=x86-64-v2 --with-arch_32=x86-64 --build=x86_64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.5.0 20240719 (Red Hat 11.5.0-2) (GCC)
... rest of stderr output deleted ...
configure:2610: $? = 0
configure:2599: gcc -V >&5
gcc: error: unrecognized command-line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2610: $? = 1
configure:2599: gcc -qversion >&5
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2610: $? = 1
configure:2630: checking whether the C compiler works
configure:2652: gcc -Dpitch_downsample=rnnoise_pitch_downsample -Dpitch_search=rnnoise_pitch_search -Dremove_doubling=rnnoise_remove_doubling -D_celt_lpc=rnnoise__celt_lpc -Dcelt_iir=rnnoise_celt_iir -D_celt_autocorr=rnnoise__celt_autocorr -Dcompute_gru=rnnoise_compute_gru -Dcompute_dense=rnnoise_compute_dense -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 conftest.c >&5
configure:2656: $? = 0
configure:2704: result: yes
configure:2707: checking for C compiler default output file name
configure:2709: result: a.out
configure:2715: checking for suffix of executables
configure:2722: gcc -o conftest -Dpitch_downsample=rnnoise_pitch_downsample -Dpitch_search=rnnoise_pitch_search -Dremove_doubling=rnnoise_remove_doubling -D_celt_lpc=rnnoise__celt_lpc -Dcelt_iir=rnnoise_celt_iir -D_celt_autocorr=rnnoise__celt_autocorr -Dcompute_gru=rnnoise_compute_gru -Dcompute_dense=rnnoise_compute_dense -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 conftest.c >&5
configure:2726: $? = 0
configure:2748: result:
configure:2770: checking whether we are cross compiling
configure:2778: gcc -o conftest -Dpitch_downsample=rnnoise_pitch_downsample -Dpitch_search=rnnoise_pitch_search -Dremove_doubling=rnnoise_remove_doubling -D_celt_lpc=rnnoise__celt_lpc -Dcelt_iir=rnnoise_celt_iir -D_celt_autocorr=rnnoise__celt_autocorr -Dcompute_gru=rnnoise_compute_gru -Dcompute_dense=rnnoise_compute_dense -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 conftest.c >&5
/usr/bin/ld: /tmp/ccirbkrv.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
configure:2782: $? = 1
configure:2789: ./conftest
$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/external/rnnoise/configure: line 2791: ./conftest: No such file or directory
configure:2793: $? = 127
configure:2800: error: in `$HOME/rpmbuild/BUILD/dsnote-20250121/redhat-linux-build/external/rnnoise':
configure:2802: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Looks like it's saying to add an fPIE flag, which I may do. Currently, using mostly system provided/packager recommended default flags for compilation/etc (CC/LDFLAGS/etc).
I don't know what is wrong :/
I compared with the config.log generated on my system and there are differences in the linker flags.
your system:
configure:2778: gcc -o conftest -Dpitch_downsample=rnnoise_pitch_downsample -Dpitch_search=rnnoise_pitch_search -Dremove_doubling=rnnoise_remove_doubling -D_celt_lpc=rnnoise__celt_lpc -Dcelt_iir=rnnoise_celt_iir -D_celt_autocorr=rnnoise__celt_autocorr -Dcompute_gru=rnnoise_compute_gru -Dcompute_dense=rnnoise_compute_dense -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 conftest.c >&5
my:
configure:3220: gcc -o conftest -Dpitch_downsample=rnnoise_pitch_downsample -Dpitch_search=rnnoise_pitch_search -Dremove_doubling=rnnoise_remove_doubling -D_celt_lpc=rnnoise__celt_lpc -Dcelt_iir=rnnoise_celt_iir -D_celt_autocorr=rnnoise__celt_autocorr -Dcompute_gru=rnnoise_compute_gru -Dcompute_dense=rnnoise_compute_dense conftest.c >&5
It looks like you are adding the following additional flags: -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1. I have no idea what they are for, but perhaps these flags are causing the problem.
I believe these are default hardening for redhat distributions.
/usr/lib/rpm/redhat/redhat-hardened-ld contains:
*self_spec:
+ %{!static:%{!shared:%{!r:-pie}}}
Which I believe may be adding the -pie flag if not building a shared/static library.
/usr/lib/rpm/redhat/redhat-annobin-cc1 contains:
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}
-Wl,OPTION: Pass OPTION as an option to the linker. If OPTION contains commas, it is split into multiple options at the commas.
-z,nowmay be "BIND_NOW", resolving all symbols before execution.-z,relrois "Hardening ELF binaries using Relocation Read-Only (RELRO)" (makes the dynamic relocation offset table read-only after initial relocation) See redhat and blog--as-neededis "don't link against/with unused libraries provided"
I think rnnoise's configure is not picking up the intended flags for some reason; maybe something autotools related.
I'll see what i can do to dig out the failing conftest.c, because it's not showing me it, and I can't find it.
Also, being no fan of autotools, I would suggest integrating as much as possible with the cmake build system of this project.
For example, for rnnoise, see this CMakeLists.txt
While I can imagine it can't be done for every dependency, I can see it being reasonable for small libraries — reducing the dependency on autotools insanity.
For example, for rnnoise, see this CMakeLists.txt While I can imagine it can't be done for every dependency, I can see it being reasonable for small libraries — reducing the dependency on autotools insanity.
Sounds like something I can do. This project already has plenty of patches, so one more won't make a difference.
I think rnnoise's configure is not picking up the intended flags for some reason; maybe something autotools related.
I tried to inject all the flags from your compilation and was not able to reproduce the error. Do you know how, in a not-too-painful way, I could reproduce exactly the environment and toolchain that are used in your build?
I just tested this:
Prerequisites:
- A way to run virtual machines (e.g. virtualbox, or libvirt and virtual machine manager)
Reproduction steps:
-
Install rocky 9.5 in a VM with network access. The minimal iso is sufficient.
- Make sure to enable the root account and ssh access during install.
- I suggest at least 20-30gb of disk. Standard partition layout is fine.
-
Sign in as root. All steps after this are inside the virtual machine.
- you can typically access the machine with
ssh root@ipwhere ip is probably192.168.122.xxx - you may want to copy/set up ssh keys to ssh/scp into the VM easier.
- you can typically access the machine with
-
Install some packages to start things off by running
dnf install rpmdevtools yum-utils epel-release -
Enable the Code ready builder repository (for devel packages, among others) by running
dnf config-manager --set-enabled crb -
Run
rpmdev-setuptreeto setup the~/rpmbuildfolder. -
Download the attached dsnote.spec.txt file to
~/rpmbuild/SPECS(make sure to remove the.txtextension). -
Download
dsnotesource releasetar.gzto~/rpmbuild/SOURCES. If master release, folder in source tar must be renamed todsnote-{version}, where{version}matches the version in the rpm spec file (e.g.dsnote-mastertodsnote-YYYYMMDD). Release archives are usually named/structured correctly and don't require renaming. (For example,curl -o dsnote-4.7.1.tar.gz https://github.com/mkiol/dsnote/archive/refs/tags/v4.7.1.tar.gz) -
Install dependencies to build dsnote by running
yum-builddep ~/rpmbuild/SPECS/dsnote.spec -
Run
rpmbuild -bb ~/rpmbuild/SPECS/dsnote.specto build rpm, subsequently reporting error.
Spec file attached. It's incomplete; missing lines for runtime "Requires" (as I haven't gotten to that point yet), and there is probably some BuildRequires packages missing.
I've currently uncommented the %cmake_build macro; it normally expands to cmake --build -j16 ....... Note: rpmbuild will complain if you leave macro markers in comments.
Hope its not too painful. 🙂
This is a very cool manual :) You explained everything perfectly. I'll try it out over the weekend and let you know the results.
I managed to reproduce the problem (thanks to your amazing guidelines).
As you suggested, the problem lies in /usr/lib/rpm/redhat/redhat-hardened-ld and the linker flag -pie. The solution is to add -fpie to the CFLAGS, but cmake for rnnoise overwrites the CFLAGS, so you can't just set new CFLAGS in the RPM spec.
The only way I've found that doesn't require changes to the upstream code is to patch dsnote.
new file rpmbuild/SOURCES/dsnote.patch
diff -ruN dsnote-4.7.1/cmake/rnnoise.cmake dsnote-4.7.1-patched/cmake/rnnoise.cmake
--- dsnote-4.7.1/cmake/rnnoise.cmake 2025-01-05 15:50:08.000000000 +0100
+++ dsnote-4.7.1-patched/cmake/rnnoise.cmake 2025-02-02 19:19:06.048021554 +0100
@@ -20,7 +20,8 @@
-Dcelt_iir=rnnoise_celt_iir \
-D_celt_autocorr=rnnoise__celt_autocorr \
-Dcompute_gru=rnnoise_compute_gru \
- -Dcompute_dense=rnnoise_compute_dense")
+ -Dcompute_dense=rnnoise_compute_dense
+ -fpie")
ExternalProject_Add(rnnoise
SOURCE_DIR ${external_dir}/rnnoise
modifications in rpmbuild/SPECS/dsnote.spec
@@ -6,6 +6,7 @@
License: MPL-2.0
URL: https://github.com/mkiol/dsnote
Source0: https://github.com/mkiol/dsnote/archive/refs/tags/dsnote-%{version}.tar.gz
+Patch0: dsnote.patch
BuildRequires: autoconf
BuildRequires: automake
@@ -39,7 +40,7 @@
Linux desktop and Sailfish OS app for note taking, reading and translating with offline Speech to Text, Text to Speech and Machine Translation
%prep
-%autosetup
+%autosetup -p1
%build
rnnoise compiled successfully, but I encountered another problem:
/root/rpmbuild/BUILD/dsnote-4.7.1/src/fake_keyboard.cpp:185:22: error: 'xkb_compose_table_iterator_new' was not declared in this scope; did you mean 'xkb_compose_table_unref'?
185 | auto *iter = xkb_compose_table_iterator_new(m_xkb_compose_table);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| xkb_compose_table_unref
libxkbcommon in rocky is too old. To compile, version >= 1.6.0 is needed. The workaround is to disable X11 features with -DWITH_X11_FEATURES=OFF. I will try to solve this problem in a more general way in the next version.
An additional but minor problem: whisper.cpp was not detecting openblas:
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
CMake Warning at ggml/src/CMakeLists.txt:253 (message):
BLAS not found, please refer to
https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors
to set correct GGML_BLAS_VENDOR
Also this:
ERROR 0002: file '/usr/bin/dsnote' contains an invalid rpath '/usr/share/dsnote/lib' in [/usr/share/dsnote/lib:/usr/lib]
For some reason, rpmbuilder does not like rpath in shared libraries. The rpath is set to /usr/share/dsnote/lib because the libraries are installed in that directory. I don't know why this is a problem 🤔
Excellent Work!
An additional but minor problem: whisper.cpp was not detecting openblas:
Let's see, we have openblas-devel in the build requires list... I presume we might need a export GGML_BLAS_VENDOR=OpenBLAS line before the cmake run.
For some reason, rpmbuilder does not like rpath in shared libraries. The rpath is set to /usr/share/dsnote/lib because the libraries are installed in that directory. I don't know why this is a problem 🤔
It's a Red Hat/Fedora policy. Sometimes a foolish one, especially for apps that want to control their libraries... I believe one intent was to enforce shared library usage. I don't often agree, as creates more work... With that, we're going to package this with all libraries included and rpath checks mostly disabled, and we'll use whatever system provided libraries we can; as we often do... If it works, it works. 🙂
--disable-rpath can sometimes be used with autoconf/configure scripts. To simply disable the check in rpmbuild, add a line to the head of *.spec file: %global __brp_check_rpaths %{nil}
Currently using Wayland/KDE (on the same distro/version) — works dandy — so X11 is on the chopping block here. Ideally it would be functional, but probably not as critical.
Let's see, we have openblas-devel in the build requires list... I presume we might need a export GGML_BLAS_VENDOR=OpenBLAS line before the cmake run.
It was actually something else. Cmake didn't try to find libopenblas in /usr/lib64. Only the following directories were considered:
/root/rpmbuild/BUILD/dsnote-4.7.1/redhat-linux-build/external/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/root/rpmbuild/BUILD/dsnote-4.7.1/redhat-linux-build/external/(lib)openblas(\.so|\.a|\.so\.3gf)
/root/.local/bin/(lib)openblas(\.so|\.a|\.so\.3gf)
/root/bin/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/local/sbin/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/local/bin/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/sbin/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/bin/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/local/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/local/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/(lib)openblas(\.so|\.a|\.so\.3gf)
/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/X11R6/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/X11R6/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/pkg/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/pkg/(lib)openblas(\.so|\.a|\.so\.3gf)
/opt/lib/(lib)openblas(\.so|\.a|\.so\.3gf)
/opt/(lib)openblas(\.so|\.a|\.so\.3gf)
/usr/lib/X11/(lib)openblas(\.so|\.a|\.so\.3gf)
Fixed by adding -DCMAKE_LIBRARY_PATH=/usr/lib64.
There was also a problem in mbrola. I had to update the mbrola source code to the latest upstream version, where the problem was resolved.
To simply disable the check in rpmbuild, add a line to the head of *.spec file: %global __brp_check_rpaths %{nil}
For some reason this didn't work on my system. To workaround I used QA_RPATHS=$(( 0x0001|0x0010|0x0002 )) rpmbuild -bb ~/rpmbuild/SPECS/dsnote.spec.
Last not resolved error is this one:
error: File not found: /root/rpmbuild/BUILDROOT/dsnote-4.7.1-1.el9.x86_64/usr/share/licenses/dsnote/add-license-file-here
I guess dsnote should also install the license file? Can this also be skipped?
Current patch:
rpmbuild/SOURCES/dsnote.patch:
diff -ruN dsnote-4.7.1/cmake/espeak.cmake dsnote-4.7.1-patched/cmake/espeak.cmake
--- dsnote-4.7.1/cmake/espeak.cmake 2025-01-05 15:50:08.000000000 +0100
+++ dsnote-4.7.1-patched/cmake/espeak.cmake 2025-02-03 19:50:09.193430572 +0100
@@ -1,5 +1,5 @@
-set(mbrola_source_url "https://github.com/numediart/MBROLA/archive/refs/tags/3.3.tar.gz")
-set(mbrola_checksum "c01ded2c0a05667e6df2439c1c02b011a5df2bfdf49e24a524630686aea2b558")
+set(mbrola_source_url "https://github.com/numediart/MBROLA/archive/bf17e9e1416a647979ac683657a536e8ca5d880e.zip")
+set(mbrola_checksum "5a7c02a926dc48ab6d1af0e4c8ab53fc191a7e4337de6df57b6706e140fa3087")
set(espeak_source_url "https://github.com/rhasspy/espeak-ng/archive/8593723f10cfd9befd50de447f14bf0a9d2a14a4.zip")
set(espeak_checksum "cc8092f23a28ccd79b1c5e62984a4c4ac1959d2d0b8193ac208d728c620bd5ed")
diff -ruN dsnote-4.7.1/cmake/rnnoise.cmake dsnote-4.7.1-patched/cmake/rnnoise.cmake
--- dsnote-4.7.1/cmake/rnnoise.cmake 2025-01-05 15:50:08.000000000 +0100
+++ dsnote-4.7.1-patched/cmake/rnnoise.cmake 2025-02-02 19:33:49.181678060 +0100
@@ -20,7 +20,8 @@
-Dcelt_iir=rnnoise_celt_iir \
-D_celt_autocorr=rnnoise__celt_autocorr \
-Dcompute_gru=rnnoise_compute_gru \
- -Dcompute_dense=rnnoise_compute_dense")
+ -Dcompute_dense=rnnoise_compute_dense \
+ -fpie")
ExternalProject_Add(rnnoise
SOURCE_DIR ${external_dir}/rnnoise
diff -ruN dsnote-4.7.1/cmake/whispercpp.cmake dsnote-4.7.1-patched/cmake/whispercpp.cmake
--- dsnote-4.7.1/cmake/whispercpp.cmake 2025-01-05 15:50:08.000000000 +0100
+++ dsnote-4.7.1-patched/cmake/whispercpp.cmake 2025-02-03 20:03:04.684270101 +0100
@@ -318,6 +318,7 @@
-DCMAKE_C_FLAGS=${whispercpp_flags} -DCMAKE_CXX_FLAGS=${whispercpp_flags}
-DCMAKE_INSTALL_RPATH=${rpath_install_dir}
-DWHISPER_TARGET_NAME=whisper-openblas
+ -DCMAKE_LIBRARY_PATH=/usr/lib64
BUILD_ALWAYS False
)
I am one step ahead of successful build :)
Truly Excellent!
I guess dsnote should also install the license file? Can this also be skipped?
Yes. License: tag already included is sufficient as it is standard license.
There's a %files list at the end of the spec file. The intent is to specify all of the files that were installed into $RPM_BUILD_ROOT (typically ~/rpmbuild/BUILDROOT/dsnote-{version}). Delete the %license and %docs lines (which are artifacts of a command called rpmdev-newspec).
Once rpmbuild finishes the %build step, it should complain about "Installed (but unpackaged) file(s) found", printing a list of unpackaged files afterwards. You may take this list and copy it into the %files list.... Alternatively, do a find on $RPM_BUILD_ROOT; copy all the directories into this list (ensuring an ending slash meaning recursively); copy all the "standalone" files into this list. That'll capture all the files into the rpm.
E.g.
%files
/usr/bin/dsnote
/usr/lib64/dsnote/
P.S. You may add a -ba instead of -bb flag to build all (source rpm (*.srpm) and binary rpm (*.rpm)) instead of just binary rpm. The srpm will contain the spec file and tarball, among others. Later one may take this SRPM and pass it along; e.g. to other tools/distributions, or for automatic build.
Hello, I just wanted to give an update on the progress. I haven't had much time to play with it, but I finally managed to build the package :) It can be installed and works fine, but only under KDE. There is a problem on GNOME - the UI is completely unreadable. I'm trying to find where the problem is.
I'll upload a working spec file when it's ready to this git repo.
One last thing, so the rpm can be mostly portable between rpm based distributions:
Replace some of the literal paths/prefixes in the build file (including the %files list) with macros from "Macros for paths set and used by build systems".
e.g. /usr/bin -> %{_bindir} and /usr/lib64 -> %{_libdir}
They are macros because some distros change these up (and they may be changed in the future).
(I usually leave this step last as a simple multi-search/replace transform when composing spec files.)
I'll give it my own run down and report as necessary.
Thank You for making this good.
Great work @mkiol!
Hi. I finally found some time to finish this. That was not an easy task!
Here you can find the SPEC file and my little "helper" script to build everything from local code. I tested it on Rocky 9 and Fedora 41. Almost everything works :)
I encountered so many problems.... I almost gave up. Now I know that packaging is not an easy task.
To make package:
git clone <git repository url>
cd dsnote/fedora
# optionally install build dependencies
dnf install rpmdevtools autoconf automake boost-devel cmake git kf5-kdbusaddons-devel libarchive-devel libxdo-devel libXinerama-devel libxkbcommon-x11-devel libXtst-devel libtool meson openblas-devel patchelf pybind11-devel python3-devel python3-pybind11 qt5-linguist qt5-qtmultimedia-devel qt5-qtquickcontrols2-devel qt5-qtx11extras-devel rubberband-devel taglib-devel vulkan-headers
./make_rpm.sh
I would appreciate if you could test it and give me feedback.
Thanks!
Here you can find the SPEC file and my little "helper" script to build everything from local code. I tested it on Rocky 9 and Fedora 41. Almost everything works :)
Awesome!
I encountered so many problems.... I almost gave up. Now I know that packaging is not an easy task.
You got this 🙂
The "packaging problem" is always more tricky than it appears.
I would appreciate if you could test it and give me feedback.
I'll give a test and full run down in a couple days.
One small nitpick/suggestion: I recommend a packaging folder to collapse it all into — if you get my drift 😎
Thank You @mkiol!
While I'm just in review mode:
Some improvements to spec and script may help you cut a few lines/errors:
You may define macros from the command line to have them evaluate in the spec during build. For example, something like this should work:
VERSION="xxx"
rpmbuild -ba --define "VERSION $(VERSION)"
Tweaking the spec file (you may use the predefined %version macro, or simply use the defined %VERSION macro):
# ...
Version: %{VERSION}
Source0: https://gitlab.com/mkiol/dsnote/-/archive/main/dsnote-%{version}.tar.gz
# or:
Source0: https://gitlab.com/mkiol/dsnote/-/archive/main/dsnote-%{VERSION}.tar.gz
# ...
You may also provide a default using %{!?macro_name:value} (if macro_name not defined, return value).
For example, %{!?VERSION:%(date +%%Y%%m%%d)} to use the version defined on the command line, or the current date (via a shell expansion; note the parenthesis instead of braces, and escaping % with %% for the date command string formatting) — this may be useful during development.
Version: should start with a number, or be sort of numeric (e.g. semver), but one may use anything. Using increasing numbers is preferred as it makes upgrades sequential. I don't like to fiddle with the Release: tag unless absolutely necessary.
I believe the executable name may be parameterized similarly, but I don't know if that's recommended or not.
Thanks for the tips. I've made some improvements in e605e05798e51521eeaa1a11a6883bb4dfeae198.
Upon build, had a build failure saying bergamot with similar non-descriptive error messaging as above.
This error first showed up on a parallel build. I disabled with -DBUILD_BERGAMOT=off.
Then I built again, NASM had a similar non-descriptive error.
Then I built with cmake build -j1 and found that yacc/bison was missing (NASM probably being the original issue).
That said, a BuildRequires: bison is required to build.
In regards to NASM, while I love a project with NASM inside, or using NASM (seriously 🙂), I think a build flag would be appropriate to use the system's NASM (which I could not locate).
After all that, the rpm builds. No QA_RPATHS required on this end (that %global __brp_check_rpaths %{nil} global should probably be defined at the head of the file).
I've attached the spec file I've used: dsnote.spec.txt
Not sure about the double macro expansion on the name and version lines so I changed them (comments below on use); producing a correctly named rpm.
# provided NAME through environment or default "dsnote"
Name: %{!?NAME:dsnote}
# provided VERSION through environment or default "the current date"
Version: %{!?VERSION:%(date +%%Y%%m%%d)}
Thank you for this project. It's important. 🙏
It's one of the best things I have ever found in the open.
Please feel free to take beers, sponsorship or what have you...
This can help a lot of people everywhere, including those with language barriers, poor keyboard skills, and handicaps... This may also help prevent people from developing handicaps (i.e. those from keyboard/mouse based repetitive stress injuries). The translator function is really great.
I write — a lot — and sometimes I just don't want to write, but the communication medium is text. This helps.
The application is quite solid and stable, and I will add other things (issues) separately.
Great work!
Thank you for pushing through this!
Please close this. 🙂
P.S. Regarding the RPM, still need to add a *.service for systemd, but I haven't figured out how to build/install that artifact from source. Not using pulseaudio anymore (pipewire instead), so maybe it should be Requires=sound.target and After=sound.target.
If you ever get a chance, see the following:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Systemd/#packaging
Hi. Thanks for all suggestion and fixes!
Improvements: 7fb08c2a1407c22b718d24921dd1279a5d830d37
Name: %{!?NAME:dsnote}
It doesn't work (for me) when NAME variable is set. Maybe I don't fully understand it, but:
%{!?NAME:dsnote}=> resolves to "dsnote" when NAME is not set, otherwise to ""%{?NAME}=> resolves to "" when NAME is not set, otherwise to "value of NAME"
So, to address both cases, I need them both: %{?NAME}%{!?NAME:dsnote}. Am I right?
P.S. Regarding the RPM, still need to add a *.service for systemd, but I haven't figured out how to build/install that artifact from source. Not using pulseaudio anymore (pipewire instead), so maybe it should be Requires=sound.target and After=sound.target.
Are you referring to %{_datadir}/dbus-1/services/*.service? This is not a real Systemd service, only DBus activator. More about it is here - chapter INTEGRATING SYSTEM SERVICES. When someone/something calls the Speech Note DBus API (net.mkiol.dsnote service), thanks to this "activator", the application will be launched to handle the request. I think it works fine right now.
Hi. Thanks for all suggestion and fixes!
🙂
Improvements: 7fb08c2
Name: %{!?NAME:dsnote}
It doesn't work (for me) when NAME variable is set. Maybe I don't fully understand it, but:
%{!?NAME:dsnote}=> resolves to "dsnote" when NAME is not set, otherwise to ""%{?NAME}=> resolves to "" when NAME is not set, otherwise to "value of NAME"So, to address both cases, I need them both:
%{?NAME}%{!?NAME:dsnote}. Am I right?
Yes. RPM has no ternary if.
These lines should do it:
Name: %{?NAME}%{!?NAME:dsnote}
Version: %{?VERSION}%{!?VERSION:%(date +%%Y%%m%%d)}
P.S. Regarding the RPM, still need to add a *.service for systemd, but I haven't figured out how to build/install that artifact from source. Not using pulseaudio anymore (pipewire instead), so maybe it should be Requires=sound.target and After=sound.target.
Are you referring to
%{_datadir}/dbus-1/services/*.service? This is not a real Systemd service, only DBus activator. More about it is here - chapter INTEGRATING SYSTEM SERVICES. When someone/something calls the Speech Note DBus API (net.mkiol.dsnoteservice), thanks to this "activator", the application will be launched to handle the request. I think it works fine right now.
My bad. I saw *.service file, and I thought systemd 🤷