powertab / powertabeditor

View and edit guitar tablature.
https://powertab.github.io
GNU General Public License v3.0
519 stars 68 forks source link

Build problem on openSUSE Leap #397

Closed aaly11 closed 1 year ago

aaly11 commented 1 year ago

Привет. Пытаюсь собрать powertabeditor для openSUSE Leap 15.x на Open Build Service (OBS). Сборка заканчивается сообщением:

 [  141s] FAILED: source/midi/CMakeFiles/ptemidi.dir/midifile.cpp.o 
 [  141s] /usr/bin/g++-8 -DJSON_DIAGNOSTICS=0 -DJSON_USE_IMPLICIT_CONVERSIONS=1 -DQT_DEPRECATED_WARNINGS -I../source/midi/.. -I../source/midi -Isource/midi -I../source/score/.. -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -Wall -Wnon-virtual-dtor -Wextra -Werror=switch -Wimplicit-fallthrough -fdiagnostics-color=always -std=c++17 -MD -MT source/midi/CMakeFiles/ptemidi.dir/midifile.cpp.o -MF source/midi/CMakeFiles/ptemidi.dir/midifile.cpp.o.d -o source/midi/CMakeFiles/ptemidi.dir/midifile.cpp.o -c ../source/midi/midifile.cpp
 [  141s] ../source/midi/midifile.cpp:42:79: error: call to non-'constexpr' function 'boost::rational<I>::rational(const T&, const U&, const typename boost::enable_if_c<(boost::rational_detail::is_compatible_integer<T, IntType>::value && boost::rational_detail::is_compatible_integer<U, IntType>::value)>::type*) [with T = int; U = int; IntType = int; typename boost::enable_if_c<(boost::rational_detail::is_compatible_integer<T, IntType>::value && boost::rational_detail::is_compatible_integer<U, IntType>::value)>::type = void]'
 [  141s]      (Midi::MAX_MIDI_CHANNEL_EFFECT_LEVEL - DEFAULT_BEND), 2 * PITCH_BEND_RANGE);
 [  141s]                                                                                ^
 [  141s] ../source/midi/midifile.cpp:45:42: error: call to non-'constexpr' function 'typename boost::enable_if_c<boost::rational_detail::is_compatible_integer<FromInt, ToInt>::value, boost::rational<IntType> >::type boost::operator-(const Arg&, const boost::rational<IntType>&) [with Arg = int; IntType = int; typename boost::enable_if_c<boost::rational_detail::is_compatible_integer<FromInt, ToInt>::value, boost::rational<IntType> >::type = boost::rational<int>]'
 [  141s]      DEFAULT_BEND - SLIDE_OUT_STEPS * 2 * BEND_QUARTER_TONE);
 [  141s]                                           ^~~~~~~~~~~~~~~~~
 [  141s] ../source/midi/midifile.cpp:47:42: error: call to non-'constexpr' function 'typename boost::enable_if_c<boost::rational_detail::is_compatible_integer<FromInt, ToInt>::value, boost::rational<IntType> >::type boost::operator+(const Arg&, const boost::rational<IntType>&) [with Arg = int; IntType = int; typename boost::enable_if_c<boost::rational_detail::is_compatible_integer<FromInt, ToInt>::value, boost::rational<IntType> >::type = boost::rational<int>]'
 [  141s]      DEFAULT_BEND + SLIDE_OUT_STEPS * 2 * BEND_QUARTER_TONE);
 [  141s]                                           ^~~~~~~~~~~~~~~~~

Полный отчёт о сборке. Сборки для openSUSE Tumbleweed, Debian, Raspbian, Ubuntu, Arch Linux, также на OBS, завершаются успешно. Добавил файл перевода для русского языка. На OBS можно найти другие проекты с похожим результатом сборки.

cameronwhite commented 1 year ago

Let me know if 88451c2a works, or if there are any further errors!

Also, if you'd like to add the translation upstream, feel free to make a PR or add it on https://hosted.weblate.org/engage/powertabeditor/

aaly11 commented 1 year ago

Спасибо. Сборка завершилась успешно, если пропустить предупреждение системы проверки пакета rpm:

powertabeditor.x86_64: W: position-independent-executable-suggested /usr/bin/powertabeditor This executable should be position independent (all binaries should). Check that it is built with -fPIE/-fpie in compiler flags and -pie in linker flags.

В прошлом, первые попытки сборки заканчивались следующей ошибкой:

[  528s] FAILED: source/formats/CMakeFiles/pteformats.dir/gp7/from_pt2.cpp.o 
[  528s] /usr/bin/g++ -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_IOSTREAMS_NO_LIB -DQT_DEPRECATED_WARNINGS -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/formats/.. -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/formats -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/build/source/formats -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/score/.. -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/util/.. -I/home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/midi/.. -isystem /usr/include/minizip -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -O2 -g -DNDEBUG -Wall -Wnon-virtual-dtor -Wextra -Werror=switch -Wimplicit-fallthrough -fdiagnostics-color=always -std=c++17 -MD -MT source/formats/CMakeFiles/pteformats.dir/gp7/from_pt2.cpp.o -MF source/formats/CMakeFiles/pteformats.dir/gp7/from_pt2.cpp.o.d -o source/formats/CMakeFiles/pteformats.dir/gp7/from_pt2.cpp.o -c /home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/formats/gp7/from_pt2.cpp
[  528s] /home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/formats/gp7/from_pt2.cpp: In function 'Gp7::Note::FingerType convertFingering(LeftHandFingering::Finger)':
[  528s] /home/abuild/rpmbuild/BUILD/powertabeditor-2.0.0alpha18.49+git.be25bc89/source/formats/gp7/from_pt2.cpp:567:1: error: control reaches end of non-void function [-Werror=return-type]
[  528s]   567 | }
[  528s]       | ^
[  528s] cc1plus: some warnings being treated as errors

Помог патч, немного обновлённый мной:

--- a/source/formats/gp7/from_pt2.cpp   2022-09-26 19:13:39.924250069 +0300
+++ b/source/formats/gp7/from_pt2.cpp   2022-09-26 19:14:10.056631368 +0300
@@ -564,6 +564,7 @@
         case Finger::Thumb:
             return GpFingerType::P;
     }
+    return GpFingerType::Open;
 }

 static void
aaly11 commented 1 year ago

Запуск программы в Leap 15.2, 15.4 из командной строки:

Segmentation fault (core dumped)
cameronwhite commented 1 year ago

Thanks, I've added that other patch in a547c01

For the segmentation fault, are you able to get a stack trace (e.g. from running in a debugger)? Another thing would be to try running the unit tests as well to see if the same crash occurs there

aaly11 commented 1 year ago

Привет. Не подскажете, как получить трассировку стека?

# gdb powertabeditor
GNU gdb (GDB; SUSE Linux Enterprise 15) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from powertabeditor...
Reading symbols from /usr/lib/debug/usr/bin/powertabeditor-2.0.0alpha18.59+git.a547c01-lp154.2.1.x86_64.debug...
(gdb) run
Starting program: /usr/bin/powertabeditor
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:444
444             VMOVU   (%rsi), %VEC(4)
Missing separate debuginfos, use: zypper install libQt5Core5-debuginfo-5.15.2+kde294-150400.6.3.1.x86_64 libQt5Gui5-debuginfo-5.15.2+kde294-150400.6.3.1.x86_64 libQt5Network5-debuginfo-5.15.2+kde294-150400.6.3.1.x86_64 libQt5PrintSupport5-debuginfo-5.15.2+kde294-150400.6.3.1.x86_64 libQt5Widgets5-debuginfo-5.15.2+kde294-150400.6.3.1.x86_64 libX11-6-debuginfo-1.6.5-3.21.1.x86_64 libXau6-debuginfo-1.0.8-1.26.x86_64 libasound2-debuginfo-1.2.6.1-150400.1.4.x86_64 libboost_iostreams1_66_0-debuginfo-1.66.0-12.3.1.x86_64 libbz2-1-debuginfo-1.0.8-150400.1.122.x86_64 libcap2-debuginfo-2.63-150400.1.7.x86_64 libdouble-conversion3-debuginfo-3.1.5-3.2.1.x86_64 libfreetype6-debuginfo-2.10.4-150000.4.12.1.x86_64 libgcrypt20-debuginfo-1.9.4-150400.4.6.x86_64 libglib-2_0-0-debuginfo-2.70.4-150400.1.5.x86_64 libglvnd-debuginfo-1.3.3-150400.3.4.x86_64 libgraphite2-3-debuginfo-1.3.11-2.12.x86_64 libharfbuzz0-debuginfo-3.4.0-150400.3.3.1.x86_64 libicu-suse65_1-debuginfo-65.1-150200.4.5.1.x86_64 libjack0-debuginfo-1.9.12-1.33.x86_64 liblz4-1-debuginfo-1.9.3-150400.1.7.x86_64 liblzma5-debuginfo-5.2.3-150000.4.7.1.x86_64 libminizip1-debuginfo-1.2.11-150000.3.33.1.x86_64 libopenssl1_1-debuginfo-1.1.1l-150400.7.7.1.x86_64 libpcre1-debuginfo-8.45-150000.20.13.1.x86_64 libpcre2-16-0-debuginfo-10.39-150400.4.6.1.x86_64 libpng16-16-debuginfo-1.6.34-3.9.1.x86_64 libproxy1-debuginfo-0.4.17-150400.1.8.x86_64 libpugixml1-debuginfo-1.11.4-bp154.1.78.x86_64 librtmidi5-debuginfo-4.0.0-bp154.1.29.x86_64 libstdc++6-debuginfo-11.3.0+git1637-150000.1.11.2.x86_64 libsystemd0-debuginfo-249.12-150400.8.10.1.x86_64 libxcb1-debuginfo-1.13-150000.3.9.1.x86_64 libz1-debuginfo-1.2.11-150000.3.33.1.x86_64 libzstd1-debuginfo-1.5.0-150400.1.71.x86_64
(gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Temporary breakpoint 1 at 0x451b10: file /usr/src/debug/powertabeditor-2.0.0alpha18.59+git.a547c01-lp154.2.1.x86_64/source/build/main.cpp, line 175.
Starting program: /usr/bin/powertabeditor
Starting program: /usr/bin/powertabeditor
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:444
444             VMOVU   (%rsi), %VEC(4)
(gdb) quit
A debugging session is active.

        Inferior 1 [process 3680] will be killed.

Quit anyway? (y or n) y

Единственное, что останавливает - это большое количество пакетов, которые необходимо будет скачать и установить.

cameronwhite commented 1 year ago

In gdb, after the crash occurs you can run the backtrace command. This should print out the stack trace

aaly11 commented 1 year ago
(gdb) backtrace
#0  __memmove_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:444
#1  0x0000000000456c3d in std::char_traits<char>::copy (__n=9943848, __s2=<optimized out>, __s1=0x7fffeca05010 "") at /usr/include/c++/8/bits/char_traits.h:350
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy (__n=9943848, __s=<optimized out>, __d=0x7fffeca05010 "") at /usr/include/c++/8/bits/basic_string.h:340
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate (this=this@entry=0x7fffffffdda0, __pos=__pos@entry=0, __len1=__len1@entry=0, __s=<optimized out>, __len2=9943848) at /usr/include/c++/8/bits/basic_string.tcc:322
#4  0x000000000048935d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append (__n=<optimized out>, __s=<optimized out>, this=0x7fffffffdda0) at /usr/include/c++/8/bits/basic_string.tcc:370
#5  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append (__str=<error: Cannot access memory at address 0x200000002>, this=0x7fffffffdda0) at /usr/include/c++/8/bits/basic_string.h:1213
#6  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+= (__str=<error: Cannot access memory at address 0x200000002>, this=0x7fffffffdda0) at /usr/include/c++/8/bits/basic_string.h:1160
#7  std::filesystem::__cxx11::path::generic_string<char, std::char_traits<char>, std::allocator<char> > (this=this@entry=0x7fffffffddc0, __a=...) at /usr/include/c++/8/bits/fs_path.h:981
#8  0x0000000000452fb4 in std::filesystem::__cxx11::path::generic_string (this=0x7fffffffddc0) at /usr/include/c++/8/ext/new_allocator.h:79
#9  __static_initialization_and_destruction_0 (__priority=65535, __initialize_p=1) at /usr/src/debug/powertabeditor-2.0.0alpha18+git59.a547c01-lp154.3.1.x86_64/source/app/settings.cpp:31
#10 0x0000000000640e3d in __libc_csu_init (argc=1, argv=0x7fffffffdf78, envp=0x7fffffffdf88) at elf-init.c:88
#11 0x00007ffff442f22c in __libc_start_main (main=0x451b10 <main(int, char**)>, argc=1, argv=0x7fffffffdf78, init=0x640dee <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdf68) at ../csu/libc-start.c:264
#12 0x000000000045528a in _start () at ../sysdeps/x86_64/start.S:120
(gdb)
cameronwhite commented 1 year ago

I'm not 100% sure what the issue is... Since gcc 8 is being used, I wonder if we also need to link against libstdc++fs? In cmake/PTE_CompilerFlags.cmake you could try adding target_link_libraries( ${target} PRIVATE libstdc++fs ) around line 7

aaly11 commented 1 year ago

Огромное спасибо. Всё получилось. Программа работает. Для начала попробовал сменить компилятор с gcc8 до gcc10 и эта замена сработала. По умолчанию в openSUSE Leap 15.2, 15.3, 15.4, 15.5 используется gcc7 компилятор, но также имеется возможность использовать gcc8, 9, 10, вплоть до 11 для openSUSE 15.4 и выше.

cameronwhite commented 1 year ago

Great, glad that's working now!