Skip to content

Commit 4f0d2be

Browse files
contra-bitsamaaron
andauthored
Fix linux build and QT Deprecations (#3305)
* set gcc12 as the default compiler for linux * update documentation to include info about gcc12 for building with linux * update .gitignore to ignore build artefacts * Include QTQuick in the build * fix unsued return value error while loading qt translations * fix rb_data_object_allow deprecation * fix deprecation warning for QApplication::setActiveWindow(QWidget*) * Do not set default attributes * Revert "Include QTQuick in the build" This reverts commit 4280ab4. * Spider - update active support to 7.0.6 Switches transient gems - thread_safe and atomic are replaced with concurrent_ruby. tzinfo is also pulled in. * Spider - improve runtime error reporting Recent Ruby versions introduced a detailed_message method to Exception which includes the useful "did you mean" information which was dropped from the message method. * delete atomic_reference.c --------- Co-authored-by: Liam <lgh@e.email> Co-authored-by: Sam Aaron <samaaron@gmail.com>
1 parent 42549ab commit 4f0d2be

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,5 @@ etc/synthdefs/designs/overtone/sonic-pi/native
154154

155155
# Visual Studio settings folder.
156156
.vs
157+
app/.cache/clangd/index
158+
sonic-pi.desktop

BUILD-LINUX.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ and to run
4747
In order to build Sonic Pi's various components, we need to install a
4848
few dependencies:
4949

50-
* Build Tools (c++ compiler, cmake, git.)
50+
* Build Tools (c++ compiler , cmake, git.)
5151
* Qt + Dev tools (5.15+)
5252
* Jack (and pulse-audio-module-jack if you are running Raspberry Pi OS)
5353
* Ruby + Dev tools (2.5+)
5454
* Elixir + Dev tools (12.0+)
5555
* SuperCollider + SC3 plugins
5656

57+
Note: please make sure that you have gcc12 installed. Compiling vcpkg dependencies does not work with gcc13 currently
58+
5759

5860
### 1.1 Debian
5961
The following is a rough list of Debian packages that are needed that can serve as a starting position:

app/gui/qt/main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ int main(int argc, char *argv[])
5757

5858
#if defined(Q_OS_LINUX)
5959
//linux code goes here
60-
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
61-
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
6260
#elif defined(Q_OS_WIN)
6361
// windows code goes here
6462

app/gui/qt/mainwindow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ MainWindow::MainWindow(QApplication& app, QSplashScreen* splash)
270270

271271
toggleOSCServer(1);
272272

273-
app.setActiveWindow(editorTabWidget->currentWidget());
273+
editorTabWidget->currentWidget()->activateWindow();
274+
274275

275276
showWelcomeScreen();
276277

app/gui/qt/utils/sonicpi_i18n.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ bool SonicPii18n::loadTranslations(QString lang) {
111111
std::cout << "[GUI] [i18n] - Loading translations for " << language.toUtf8().constData() << std::endl;
112112

113113
i18n = translator.load("sonic-pi_" + language, ":/lang/") || language == "en_GB" || language == "en" || language == "C";
114-
if (!i18n) {
115-
std::cout << "[GUI] [i18n] - Error: Failed to load language translation for " << language.toUtf8().constData() << std::endl;
116-
language = "en_GB";
117-
}
118-
app->installTranslator(&translator);
114+
i18n = translator.load("sonic-pi_" + language, ":/lang/") || language == "en_GB" || language == "en" || language == "C";
115+
bool translator_succes_qt = qtTranslator.load("qt_" + language, QLibraryInfo::path(QLibraryInfo::TranslationsPath));
116+
if (!i18n || !translator_succes_qt)
117+
{
118+
std::cout << "[GUI] [i18n] - Error: Failed to load language translation for " << language.toUtf8().constData() << std::endl;
119+
language = "en_GB";
120+
}
121+
app->installTranslator(&translator);
119122

120-
qtTranslator.load("qt_" + language, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
121123
app->installTranslator(&qtTranslator);
122124

123125
this->currently_loaded_language = language;

app/linux-prebuild.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ cd "${SCRIPT_DIR}"
2828

2929
if [ ! "$system_libs" == true ]; then
3030
"${SCRIPT_DIR}"/linux-pre-vcpkg.sh "${args[@]}"
31+
export CC=gcc-12 CXX=g++-12 # Use gcc-12 as the default compiler, since gcc-13 fails to build vcpkg
32+
"${SCRIPT_DIR}"/linux-pre-vcpkg.sh "${args[@]}"
3133
fi
3234

3335
echo "Compiling native ruby extensions..."

0 commit comments

Comments
 (0)