pierr3 / VectorAudio

An Audio-For-VATSIM ATC Client for macOS, Linux and Windows
GNU General Public License v3.0
47 stars 12 forks source link

Ubuntu 22.04: segfault in afv_native::audio::PortAudioAudioDevice::getCompatibleInputDevicesForApi() #21

Closed jonaseberle closed 1 year ago

jonaseberle commented 2 years ago

Opening any of the device dropdowns in the settings image

gives a segfault in afv_native::audio::PortAudioAudioDevice::getCompatibleInputDevicesForApi(unsigned int):

(gdb) run
Starting program: /home/jonas/src/github.com/jonaseberle/VectorAudio/build/vector_audio 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff6c5c640 (LWP 1336252)]
[New Thread 0x7fffec780640 (LWP 1336253)]
[New Thread 0x7fffebe3e640 (LWP 1336254)]
[New Thread 0x7fffeb63d640 (LWP 1336255)]
[New Thread 0x7fffeae3c640 (LWP 1336256)]
[New Thread 0x7fffea63b640 (LWP 1336257)]
[New Thread 0x7fffe9e3a640 (LWP 1336258)]
[New Thread 0x7fffe9639640 (LWP 1336259)]
[New Thread 0x7fffe8e38640 (LWP 1336260)]
[New Thread 0x7fffc3fff640 (LWP 1336261)]
[New Thread 0x7fffc37fe640 (LWP 1336262)]
[New Thread 0x7fffc2ffd640 (LWP 1336263)]
[New Thread 0x7fffc2492640 (LWP 1336272)]
TerminateHostApis in 
TerminateHostApis out
[New Thread 0x7fffc1c91640 (LWP 1336273)]

Thread 1 "vector_audio" received signal SIGSEGV, Segmentation fault.
0x00007ffff79ea3fd in afv_native::audio::PortAudioAudioDevice::getCompatibleInputDevicesForApi(unsigned int) () from /home/jonas/src/github.com/jonaseberle/VectorAudio/build/extern/afv-native/libafv.so

Ubuntu 22.04 is using pulseaudio

pierr3 commented 1 year ago

I just pushed a new version that implements miniaudio from Justin Shannon's work. Can you give it a try ?

jonaseberle commented 1 year ago

Well, that is how far I got:

I was not able to build it so far:

$ cmake ..
-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
The following packages will be built and installed:
  * alsa[core]:x64-linux -> 1.2.6.1
  * brotli[core]:x64-linux -> 1.0.9#3
  * bzip2[core,tool]:x64-linux -> 1.0.8#3
    cpp-jwt[core]:x64-linux -> 2021-10-18
    curl[core,non-http,openssl,ssl]:x64-linux -> 7.84.0#2
    fmt[core]:x64-linux -> 9.1.0
  * freetype[brotli,bzip2,core,png,zlib]:x64-linux -> 2.12.1#2
    libevent[core,thread]:x64-linux -> 2.1.12#7
  * libflac[core]:x64-linux -> 1.3.4#1
  * libogg[core]:x64-linux -> 1.3.5
  * libpng[core]:x64-linux -> 1.6.37#19
  * libvorbis[core]:x64-linux -> 1.3.7#2
    msgpack[core]:x64-linux -> 3.3.0#2
    nlohmann-json[core]:x64-linux -> 3.11.2
  * openal-soft[core]:x64-linux -> 1.22.2#4
  * opengl[core]:x64-linux -> 2022-03-14#1
    openssl[core]:x64-linux -> 3.0.7
    opus[core]:x64-linux -> 1.3.1#9
    sfml[core]:x64-linux -> 2.5.1#14
    spdlog[core]:x64-linux -> 1.10.0#1
    speexdsp[core]:x64-linux -> 1.2.1
  * stb[core]:x64-linux -> 2021-09-10#1
    toml11[core]:x64-linux -> 3.7.1
  * zlib[core]:x64-linux -> 1.2.13
Additional packages (*) will be modified to complete this operation.
Restored 0 packages from /home/jonas/.cache/vcpkg/archives in 36.44 us. Use --debug to see more details.
Starting package 1/24: openssl:x64-linux
Building package openssl[core]:x64-linux...
CMake Error at scripts/cmake/vcpkg_minimum_required.cmake:29 (message):
  Your vcpkg executable is from 2022-02-24 which is older than required by
  the caller of vcpkg_minimum_required(VERSION 2022-10-12).  Please
  re-acquire vcpkg by running bootstrap-vcpkg.
Call Stack (most recent call first):
  ports/openssl/portfile.cmake:1 (vcpkg_minimum_required)
  scripts/ports.cmake:147 (include)

Error: Building package openssl:x64-linux failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `git pull` and `./vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+openssl
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[openssl]+Build+error
including:
  package: openssl[core]:x64-linux -> 3.0.7
    vcpkg-tool version: 2022-02-24-7efe7f2b04912a7d674f86a406f9f2711c0221c6
    vcpkg-scripts version: 49931943a 2022-11-02 (25 hours ago)

Additionally, attach any relevant sections from the log files above.
-- Running vcpkg install - failed
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:868 (message):
  vcpkg install failed.  See logs for more information:
  /home/jonas/src/github.com/jonaseberle/VectorAudio/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:3 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

Downloaded from https://github.com/pierr3/VectorAudio/releases/tag/v0.3.1-33e225b gives me:

$ ./vector_audio 
./vector_audio: error while loading shared libraries: libafv.so: cannot open shared object file: No such file or directory

and

$ LD_LIBRARY_PATH=. ./vector_audio 
Segmentation fault (core dumped)

and the backtrace from the core dump is

(gdb) bt
#0  0x000055981af0125d in httplib::Request::Request(httplib::Request const&) ()
#1  0x000055981af3dc15 in httplib::ClientImpl::handle_request(httplib::Stream&, httplib::Request&, httplib::Response&, bool, httplib::Error&) ()
#2  0x000055981aecc09c in httplib::SSLClient::process_socket(httplib::ClientImpl::Socket const&, std::function<bool (httplib::Stream&)>) ()
#3  0x000055981af3a788 in httplib::ClientImpl::send(httplib::Request&, httplib::Response&, httplib::Error&) ()
#4  0x000055981afc59aa in afv_unix::updater::updater() ()
#5  0x000055981aec5c6e in main ()
pierr3 commented 1 year ago

I updated VCPKG! you’ll need to do the same if you’re not cloning from scratch. Run ./bootstrap_vcpkg.sh inside the vcpkg folder.

It’s also hidden deep in the error message:

Your vcpkg executable is from 2022-02-24 which is older than required by the caller of vcpkg_minimum_required(VERSION 2022-10-12). Please re-acquire vcpkg by running bootstrap-vcpkg.

On Thu, 3 Nov 2022 at 16:05, Jonas Eberle @.***> wrote:

Well, that is how far I got:

I was not able to build it so far:

$ cmake .. -- Running vcpkg install Detecting compiler hash for triplet x64-linux... The following packages will be built and installed:

  • alsa[core]:x64-linux -> 1.2.6.1
  • brotli[core]:x64-linux -> 1.0.9#3
  • bzip2[core,tool]:x64-linux -> 1.0.8#3 cpp-jwt[core]:x64-linux -> 2021-10-18 curl[core,non-http,openssl,ssl]:x64-linux -> 7.84.0#2 fmt[core]:x64-linux -> 9.1.0
  • freetype[brotli,bzip2,core,png,zlib]:x64-linux -> 2.12.1#2 libevent[core,thread]:x64-linux -> 2.1.12#7
  • libflac[core]:x64-linux -> 1.3.4#1
  • libogg[core]:x64-linux -> 1.3.5
  • libpng[core]:x64-linux -> 1.6.37#19
  • libvorbis[core]:x64-linux -> 1.3.7#2 msgpack[core]:x64-linux -> 3.3.0#2 nlohmann-json[core]:x64-linux -> 3.11.2
  • openal-soft[core]:x64-linux -> 1.22.2#4
  • opengl[core]:x64-linux -> 2022-03-14#1 openssl[core]:x64-linux -> 3.0.7 opus[core]:x64-linux -> 1.3.1#9 sfml[core]:x64-linux -> 2.5.1#14 spdlog[core]:x64-linux -> 1.10.0#1 speexdsp[core]:x64-linux -> 1.2.1
  • stb[core]:x64-linux -> 2021-09-10#1 toml11[core]:x64-linux -> 3.7.1
  • zlib[core]:x64-linux -> 1.2.13 Additional packages (*) will be modified to complete this operation. Restored 0 packages from /home/jonas/.cache/vcpkg/archives in 36.44 us. Use --debug to see more details. Starting package 1/24: openssl:x64-linux Building package openssl[core]:x64-linux... CMake Error at scripts/cmake/vcpkg_minimum_required.cmake:29 (message): Your vcpkg executable is from 2022-02-24 which is older than required by the caller of vcpkg_minimum_required(VERSION 2022-10-12). Please re-acquire vcpkg by running bootstrap-vcpkg. Call Stack (most recent call first): ports/openssl/portfile.cmake:1 (vcpkg_minimum_required) scripts/ports.cmake:147 (include)

Error: Building package openssl:x64-linux failed with: BUILD_FAILED Please ensure you're using the latest portfiles with git pull and ./vcpkg update. Then check for known issues at: https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+openssl You can submit a new issue at: https://github.com/microsoft/vcpkg/issues/new?template=report-package-build-failure.md&title=[openssl]+Build+error including: package: openssl[core]:x64-linux -> 3.0.7 vcpkg-tool version: 2022-02-24-7efe7f2b04912a7d674f86a406f9f2711c0221c6 vcpkg-scripts version: 49931943a 2022-11-02 (25 hours ago)

Additionally, attach any relevant sections from the log files above. -- Running vcpkg install - failed CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:868 (message): vcpkg install failed. See logs for more information: /home/jonas/src/github.com/jonaseberle/VectorAudio/build/vcpkg-manifest-install.log Call Stack (most recent call first): /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:124 (include) CMakeLists.txt:3 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool. CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!

Downloaded from https://github.com/pierr3/VectorAudio/releases/tag/v0.3.1-33e225b gives me:

$ ./vector_audio ./vector_audio: error while loading shared libraries: libafv.so: cannot open shared object file: No such file or directory

and

$ LD_LIBRARY_PATH=. ./vector_audio Segmentation fault (core dumped)

and the backtrace from the core dump is

Core was generated by `./vector_audio'. Program terminated with signal SIGSEGV, Segmentation fault.

0 0x000055981af0125d in httplib::Request::Request(httplib::Request const&) ()

[Current thread is 1 (Thread 0x7ff73f7ca780 (LWP 1018542))] (gdb) bt

0 0x000055981af0125d in httplib::Request::Request(httplib::Request const&) ()

1 0x000055981af3dc15 in httplib::ClientImpl::handle_request(httplib::Stream&, httplib::Request&, httplib::Response&, bool, httplib::Error&) ()

2 0x000055981aecc09c in httplib::SSLClient::process_socket(httplib::ClientImpl::Socket const&, std::function<bool (httplib::Stream&)>) ()

3 0x000055981af3a788 in httplib::ClientImpl::send(httplib::Request&, httplib::Response&, httplib::Error&) ()

4 0x000055981afc59aa in afv_unix::updater::updater() ()

5 0x000055981aec5c6e in main ()

— Reply to this email directly, view it on GitHub https://github.com/pierr3/VectorAudio/issues/21#issuecomment-1302773483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN7UKY4IL3A2YJMOAJ6R5DWGRALHANCNFSM544LJCCQ . You are receiving this because you commented.Message ID: @.***>

jonaseberle commented 1 year ago

Thanks! Let's add that to the README.

The enumeration of devices is very clean now, but "Start Mic Test" is not working yet:

==> afv.log <==
Fri Nov  4 09:09:46 2022: afv::ATCClient: /home/jonas/src/github.com/jonaseberle/VectorAudio/extern/afv-native/src/core/atcClient.cpp(222): Initialising Speaker Audio...
Fri Nov  4 09:09:46 2022: afv::ATCClient: /home/jonas/src/github.com/jonaseberle/VectorAudio/extern/afv-native/src/core/atcClient.cpp(234): Unable to open Speaker audio device.
Fri Nov  4 09:09:46 2022: afv::ATCClient: /home/jonas/src/github.com/jonaseberle/VectorAudio/extern/afv-native/src/core/atcClient.cpp(241): Initialising Headset Audio...
Fri Nov  4 09:09:46 2022: afv::ATCClient: /home/jonas/src/github.com/jonaseberle/VectorAudio/extern/afv-native/src/core/atcClient.cpp(254): Unable to open Headset audio device.
pierr3 commented 1 year ago

Can you try with the latest commit? I hard forgotten to set the audio device when running the test and now it works on my side.

jonaseberle commented 1 year ago

@pierr3 Yes, very nice! The Mic Test works and also audio output.

It seems the audio client is now called "xpilot" ;) image EDIT: that is qpwgraph if anybody is interested - it is able to visualize, edit, save and restore pipewire connections.

It would be nice to have the "SPKR" output stream named differently for easier routing. ❤️

pierr3 commented 1 year ago

Oops, will need to edit that ! I should be able to name the two outputs differently as well. Let me know if you end up using this live on the network and you notice any issues.

jonaseberle commented 1 year ago

Thanks @pierr3!