From 5bd401b03a71d24f1d667f9ff885e3785db80ab2 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Thu, 5 Jun 2025 12:36:24 -0700 Subject: [PATCH] Fix compiler errors when using wxWidgets 3.0. (#914) * Fix compiler errors when using wxWidgets 3.0. * Add GH action to make sure we can compile on Ubuntu 22.04. * Fix package name. * Add PR #914 to changelog. * Ensure only one build per branch happens at a time. --- .github/workflows/cmake-linux.yml | 38 +++++++++++++++++++++++------ .github/workflows/cmake-macos.yml | 4 +++ .github/workflows/cmake-windows.yml | 4 +++ USER_MANUAL.md | 1 + src/gui/dialogs/freedv_reporter.cpp | 16 +++++++++++- src/gui/dialogs/freedv_reporter.h | 5 ++++ src/ongui.cpp | 2 +- src/voicekeyer.cpp | 4 +-- 8 files changed, 63 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index de364905..a4521a72 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -4,6 +4,10 @@ on: push: branches-ignore: - 'dr-render-manual' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -11,16 +15,18 @@ env: jobs: build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + os: [ubuntu-24.04, ubuntu-22.04] + + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Install LLVM/Clang >=20.0 (Required for RTSan) + if: ${{ matrix.os == 'ubuntu-24.04' }} uses: MorganCaron/latest-clang-action@master - name: Install rtkit for RT threading @@ -32,12 +38,25 @@ jobs: sudo sed -i 's/no/yes/g' /usr/share/polkit-1/actions/org.freedesktop.RealtimeKit1.policy sudo systemctl restart polkit - - name: Install packages + - name: Install common packages shell: bash run: | - sudo apt-get install codespell libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git libwxgtk3.2-dev portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity at-spi2-core octave octave-signal + sudo apt-get install libpulse-dev libspeexdsp-dev libsamplerate0-dev sox git portaudio19-dev libhamlib-dev libasound2-dev libao-dev libgsm1-dev libsndfile-dev xvfb pipewire pulseaudio-utils pipewire-pulse wireplumber metacity at-spi2-core octave octave-signal + + - name: Install version-specific packages + if: ${{ matrix.os == 'ubuntu-22.04' }} + shell: bash + run: | + sudo apt-get install libwxgtk3.0-gtk3-dev + + - name: Install version-specific packages + if: ${{ matrix.os == 'ubuntu-24.04' }} + shell: bash + run: | + sudo apt-get install codespell libwxgtk3.2-dev - name: Spellcheck codebase + if: ${{ matrix.os == 'ubuntu-24.04' }} shell: bash run: codespell --ignore-words-list=caf,radae,rade,inout,nin,ontop,parm,tthe,ue `find src -name '*.c*' -o -name '*.h' | grep -v 3rdparty` @@ -66,6 +85,7 @@ jobs: - name: Execute unit tests shell: bash + if: ${{ matrix.os == 'ubuntu-24.04' }} working-directory: ${{github.workspace}}/build_linux run: | sudo systemctl enable rtkit-daemon @@ -88,6 +108,7 @@ jobs: - name: Instrument AddressSanitizer shell: bash + if: ${{ matrix.os == 'ubuntu-24.04' }} working-directory: ${{github.workspace}} run: | . ./rade-venv/bin/activate @@ -95,6 +116,7 @@ jobs: - name: Check for memory leaks shell: bash + if: ${{ matrix.os == 'ubuntu-24.04' }} working-directory: ${{github.workspace}}/build_linux run: | export DISPLAY=:99.0 @@ -104,6 +126,7 @@ jobs: - name: Instrument RealtimeSanitizer shell: bash + if: ${{ matrix.os == 'ubuntu-24.04' }} working-directory: ${{github.workspace}} run: | . ./rade-venv/bin/activate @@ -111,6 +134,7 @@ jobs: - name: Check for RT-unsafe function calls shell: bash + if: ${{ matrix.os == 'ubuntu-24.04' }} working-directory: ${{github.workspace}}/build_linux run: | export DISPLAY=:99.0 diff --git a/.github/workflows/cmake-macos.yml b/.github/workflows/cmake-macos.yml index aa072ad9..d2876df6 100644 --- a/.github/workflows/cmake-macos.yml +++ b/.github/workflows/cmake-macos.yml @@ -4,6 +4,10 @@ on: push: branches-ignore: - 'dr-render-manual' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index e9248e3d..dece8066 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -4,6 +4,10 @@ on: push: branches-ignore: - 'dr-render-manual' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) diff --git a/USER_MANUAL.md b/USER_MANUAL.md index be9ca616..9e93461d 100644 --- a/USER_MANUAL.md +++ b/USER_MANUAL.md @@ -795,6 +795,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes 1. Bugfixes: * Reduce latency when going between TX->RX with Hamlib configured. (PR #893) * Reduce usage of non-real time safe code. (PR #900) + * Fix compiler errors when using wxWidgets 3.0. (PR #914) ## V2.0.0 June 2025 diff --git a/src/gui/dialogs/freedv_reporter.cpp b/src/gui/dialogs/freedv_reporter.cpp index c295a4fd..522a59d3 100644 --- a/src/gui/dialogs/freedv_reporter.cpp +++ b/src/gui/dialogs/freedv_reporter.cpp @@ -1721,6 +1721,20 @@ wxDataViewItem FreeDVReporterDialog::FreeDVReporterDataModel::GetParent (const w return wxDataViewItem(nullptr); } +#if !wxCHECK_VERSION(3,2,0) +unsigned int FreeDVReporterDialog::FreeDVReporterDataModel::GetColumnCount () const +{ + return RIGHTMOST_COL; +} + +wxString FreeDVReporterDialog::FreeDVReporterDataModel::GetColumnType (unsigned int col) const +{ + wxVariant tmp(""); + return tmp.GetType(); +} +#endif // !wxCHECK_VERSION(3,2,0) + + void FreeDVReporterDialog::FreeDVReporterDataModel::GetValue (wxVariant &variant, const wxDataViewItem &item, unsigned int col) const { std::unique_lock lk(const_cast(dataMtx_)); @@ -2200,7 +2214,7 @@ void FreeDVReporterDialog::FreeDVReporterDataModel::onMessageUpdateFn_(std::stri } else { - iter->second->userMessage = wxString::FromUTF8(message); + iter->second->userMessage = wxString::FromUTF8(message.c_str()); } auto lastUpdateTime = makeValidTime_(lastUpdate, iter->second->lastUpdateDate); diff --git a/src/gui/dialogs/freedv_reporter.h b/src/gui/dialogs/freedv_reporter.h index e9b2896f..ea563d3f 100644 --- a/src/gui/dialogs/freedv_reporter.h +++ b/src/gui/dialogs/freedv_reporter.h @@ -212,6 +212,11 @@ class FreeDVReporterDialog : public wxFrame virtual bool IsContainer (const wxDataViewItem &item) const override; virtual bool SetValue (const wxVariant &variant, const wxDataViewItem &item, unsigned int col) override; +#if !wxCHECK_VERSION(3,2,0) + virtual unsigned int GetColumnCount () const override; + virtual wxString GetColumnType (unsigned int col) const override; +#endif // !wxCHECK_VERSION(3,2,0) + private: struct ReporterData { diff --git a/src/ongui.cpp b/src/ongui.cpp index 29dc0fab..dff7997a 100644 --- a/src/ongui.cpp +++ b/src/ongui.cpp @@ -221,7 +221,7 @@ void MainFrame::OnToolsOptions(wxCommandEvent& event) // Update voice keyer file if different wxFileName fullVKPath(wxGetApp().appConfiguration.voiceKeyerWaveFilePath, wxGetApp().appConfiguration.voiceKeyerWaveFile); - if (wxString::FromUTF8(vkFileName_) != fullVKPath.GetFullPath()) + if (wxString::FromUTF8(vkFileName_.c_str()) != fullVKPath.GetFullPath()) { // Clear filename to force reselection next time VK is triggered. vkFileName_ = ""; diff --git a/src/voicekeyer.cpp b/src/voicekeyer.cpp index 1952a640..978e6a42 100644 --- a/src/voicekeyer.cpp +++ b/src/voicekeyer.cpp @@ -218,7 +218,7 @@ int MainFrame::VoiceKeyerStartTx(void) SNDFILE* tmpPlayFile = sf_open(vkFileName_.c_str(), SFM_READ, &sfInfo); if(tmpPlayFile == NULL) { wxString strErr = sf_strerror(NULL); - wxMessageBox(strErr, wxT("Couldn't open:") + wxString::FromUTF8(vkFileName_), wxOK); + wxMessageBox(strErr, wxT("Couldn't open:") + wxString::FromUTF8(vkFileName_.c_str()), wxOK); next_state = VK_IDLE; m_togBtnVoiceKeyer->SetBackgroundColour(wxNullColour); m_togBtnVoiceKeyer->SetValue(false); @@ -237,7 +237,7 @@ int MainFrame::VoiceKeyerStartTx(void) g_sfPlayFile = tmpPlayFile; - SetStatusText(wxT("Voice Keyer: Playing file ") + wxString::FromUTF8(vkFileName_) + wxT(" to mic input") , 0); + SetStatusText(wxT("Voice Keyer: Playing file ") + wxString::FromUTF8(vkFileName_.c_str()) + wxT(" to mic input") , 0); g_loopPlayFileToMicIn = false; g_playFileToMicIn = true;