Closed HiiGHoVuTi closed 3 years ago
This is how the audiolib is selected: https://github.com/csabahruska/proteaaudio/blob/master/proteaaudio/proteaaudio.cabal#L79-L82
if os(linux)
CC-Options: "-D__LINUX_PULSE__"
Extra-Libraries: stdc++ pthread pulse-simple pulse
pkgconfig-depends: libpulse-simple, libpulse
Maybe the issue is related to a recent flag handling Cabal change. I'd suggest to add an extra line:
CXX-Options: "-D__LINUX_PULSE__"
Or try proteaaudio-sdl
:
https://github.com/csabahruska/proteaaudio/tree/master/proteaaudio-sdl
The SDL version isn't much better from what I've seen.
proteaaudio-sdl > /tmp/stack-da8996fe9d4d5d34/proteaaudio-sdl-0.9.0/cbits/proteaaudio_binding.cpp:11:2: error:
proteaaudio-sdl > error: #error "neither PROTEAAUDIO_SDL and PROTEAAUDIO_RT is defined"
proteaaudio-sdl > 11 | #error "neither PROTEAAUDIO_SDL and PROTEAAUDIO_RT is defined"
And does your other solution imply building the lib from source ? I had been using the simple "add to package.yaml" solution for now.
Ok, I see.
Try to modify the .cabal
files and build it from source (add the source path to your stack project).
Please also check the used GHC and Cabal version.
proteaaudio> Warning: proteaaudio.cabal:81:5: The field "cxx-options" is available only
proteaaudio> since the Cabal specification version 2.2. This field will be ignored.
I'm not sure how to change that, I have the latest stack and am not sure how to change the used cabal version (some googling didn't help)
Change this line: https://github.com/csabahruska/proteaaudio/blob/master/proteaaudio/proteaaudio.cabal#L12
Cabal-Version: >= 1.10
to:
Cabal-Version: >= 2.2
AFAIK: you should move version specification line to the beginning of the file. (first line)
After changing everything necessary to upgrade cabal, same error:
proteaaudio> /home/maxime/tmp/proteaaudio/proteaaudio/cbits/proAudioRt.cpp:9:2: error:
proteaaudio> error: #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
proteaaudio> 9 | #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
proteaaudio> | ^~~~~
proteaaudio> |
proteaaudio> 9 | #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
proteaaudio> | ^
proteaaudio> `gcc' failed in phase `C Compiler'. (Exit code: 1)
It's the local version this time.
by the way, in case it helps:
$ ls /usr/include/pulse ✔ ghc-8.8.3
cdecl.h context.h direction.h ext-device-manager.h ext-stream-restore.h gccmacro.h introspect.h mainloop.h operation.h pulseaudio.h sample.h simple.h subscribe.h timeval.h util.h volume.h
channelmap.h def.h error.h ext-device-restore.h format.h glib-mainloop.h mainloop-api.h mainloop-signal.h proplist.h rtclock.h scache.h stream.h thread-mainloop.h utf8.h version.h xmalloc.h
It would be useful to compile in cabal verbose mode to see the include paths and the defined values (-D flags) that are passed to the C/C++ compiler. I'm pretty sure that this is issue is related to flag handling. Could you please copy the full .cabal file and the output of the verbose mode compilation?
I'll note that I'm doing this inside my current project, because for some reason the error is different in here and in the original repo.
Here is my project's .cabal file:
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.4.
--
-- see: https://github.com/sol/hpack
-- snip --
build-type: Simple
extra-source-files:
README.md
ChangeLog.md
source-repository head
type: git
location: https://github.com/HiiGHoVuTi/rhythm # doesn't exist
library
exposed-modules:
Lib
other-modules:
Paths_rhythm
hs-source-dirs:
src
build-depends:
-- snip --
base >=4.7 && <5
, proteaaudio
default-language: Haskell2010
executable rhythm-exe
main-is: Main.hs
other-modules:
Paths_rhythm
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
build-depends:
base >=4.7 && <5
-- snip --
, proteaaudio
default-language: Haskell2010
test-suite rhythm-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Paths_rhythm
hs-source-dirs:
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
-- snip --
, proteaaudio
, rhythm
default-language: Haskell2010
and here is (the end of) the verbose output:
> not proteaaudio stuff
2021-07-06 11:48:33.253397: [info] proteaaudio> configure
2021-07-06 11:48:33.253496: [debug] Run process within /tmp/stack-7c4dfd32b9334951/proteaaudio-0.9.0/: /home/maxime/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/pkgdb --libdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/lib --bindir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/bin --datadir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/share --libexecdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/libexec --sysconfdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/etc --docdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --htmldir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --haddockdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --dependency=base=base-4.14.1.0 --dependency=bytestring=bytestring-0.10.12.0 -f-example --exact-configuration --ghc-option=-fhide-source-paths
2021-07-06 11:48:33.615976: [info] proteaaudio> Configuring proteaaudio-0.9.0...
2021-07-06 11:48:33.745687: [debug] Process finished in 492ms: /home/maxime/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 configure --user --package-db=clear --package-db=global --package-db=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/pkgdb --libdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/lib --bindir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/bin --datadir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/share --libexecdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/libexec --sysconfdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/etc --docdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --htmldir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --haddockdir=/home/maxime/.stack/snapshots/x86_64-linux-tinfo6/65a4477cad71b1507db5ef609f0c1e12896c815e31d369a5be5f3eb3fc47deba/8.10.4/doc/proteaaudio-0.9.0 --dependency=base=base-4.14.1.0 --dependency=bytestring=bytestring-0.10.12.0 -f-example --exact-configuration --ghc-option=-fhide-source-paths
2021-07-06 11:48:33.746030: [info] proteaaudio> build
2021-07-06 11:48:33.746148: [debug] Run process within /tmp/stack-7c4dfd32b9334951/proteaaudio-0.9.0/: /home/maxime/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 build --ghc-options " -fdiagnostics-color=always"
2021-07-06 11:48:33.772142: [info] proteaaudio> Preprocessing library for proteaaudio-0.9.0..
2021-07-06 11:48:33.783796: [info] proteaaudio> Building library for proteaaudio-0.9.0..
2021-07-06 11:48:33.867616: [info] proteaaudio> [1 of 1] Compiling Sound.ProteaAudio
2021-07-06 11:48:36.592166: [warn] proteaaudio>
2021-07-06 11:48:36.592509: [warn] proteaaudio> /tmp/stack-7c4dfd32b9334951/proteaaudio-0.9.0/cbits/proAudioRt.cpp:9:2: error:
2021-07-06 11:48:36.592582: [warn] proteaaudio> error: #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
2021-07-06 11:48:36.592607: [warn] proteaaudio> 9 | #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
2021-07-06 11:48:36.592640: [warn] proteaaudio> | ^~~~~
2021-07-06 11:48:36.592662: [warn] proteaaudio> |
2021-07-06 11:48:36.592684: [warn] proteaaudio> 9 | #error "No suitable audio backend has found for RtAudio! Install the dev package with headers for the system's audio library and make sure it is in the include path!"
2021-07-06 11:48:36.592706: [warn] proteaaudio> | ^
2021-07-06 11:48:36.592728: [warn] proteaaudio> `gcc' failed in phase `C Compiler'. (Exit code: 1)
Progress 1/2
2021-07-06 11:48:36.609144: [error]
-- While building package proteaaudio-0.9.0 (scroll up to its section to see the error) using:
/home/maxime/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
I don't think there's all you asked for, but I'm not sure I know how to show those
2021-07-06 11:48:33.746148: [debug] Run process within /tmp/stack-7c4dfd32b9334951/proteaaudio-0.9.0/: /home/maxime/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 build --ghc-options " -fdiagnostics-color=always"
It seems that you use GHC 8.10 which has issues with building proteaaudio: https://github.com/csabahruska/proteaaudio/issues/6
Please check the latest version of the package if it works: https://hackage.haskell.org/package/proteaaudio-0.9.1
Just for info, I don't think this should happen:
WARNING: Ignoring rhythm's bounds on proteaaudio (==0.9.1); using proteaaudio-0.9.0.
Reason: allow-newer enabled.
proteaaudio must match ==0.9.1, but the stack configuration has no specified version (no package with that name
found, perhaps there is a typo in a package's build-depends or an omission from the stack.yaml
packages list?)
with no recommendation
Could you show your project's stack.yaml
please?
This is not a stack.yaml
.
Do you use stack?
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml
packages:
- .
# extra-deps:
Add proteaaudio-0.9.1
to the extra-deps
section.
Oh... For some reason now it finds it, and it compiles. This was quite a journey for a simple fix. Thank you very much, I wonder how all that (wrong default version, it not finding the version with some specs but with others, ..) happened.
well now I'm having a pulseAudio device does not support output
warning..
This is how stack works. Either the packages are in the specified stackage version (specified by the resolver) or they should be specified as an extra-dep
with a specific version.
try proteaaudio-sdl-0.9.1
then.
Finally it doesn't give me any errors. I will try playing a sound, and if it works, this issue is closed. Thanks for your patience, I have a lot to learn with haskell tooling.
Thanks for all again, works wonders and is far better than the old method I was using. Worth the pain :)
I tried to install proteaaudio for my project using stack, and get this error:
I thought this was due to the fact that I didn't have
libpulse-dev
. However, it is not available for arch so I tried the most similar packages:libpulse
andpulseaudio
. Neither of those seemed to fix the compiling error, so I might be on the wrong track.