“*缺少(或坏)C库:OpenAl32” - 从Haskell项目的堆栈构建

发布于 2025-01-29 15:26:41 字数 6642 浏览 6 评论 0 原文

我有一个使用sound.alut的堆栈项目。在我添加声音之前,该项目在Windows和Mac上都可以构建正常。 (Sound.Alut是一个分层在开放式上的库。)在MacOS上工作了,但是这些更改破坏了Windows的构建。仍然可以在MacOS上建立良好的状态。

从Windows上的“堆栈构建”控制台登录中的违规剪辑看起来像是这样的

GLUT           > [22 of 24] Compiling Graphics.UI.GLUT.Callbacks.Global
GLUT           > [23 of 24] Compiling Graphics.UI.GLUT.Callbacks
GLUT           > [24 of 24] Compiling Graphics.UI.GLUT
GLUT           > copy/register
GLUT           > Installing library in C:\sr\snapshots\87ecdd59\lib\x86_64-windows-ghc-8.10.7\GLUT-2.7.0.16-2jeyeunHWey2D1Huuhst8j
GLUT           > Registering library for GLUT-2.7.0.16..
OpenAL         > configure
OpenAL         > Configuring OpenAL-1.7.0.5...
OpenAL         > Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.7.exe: Missing dependency on a foreign
OpenAL         > library:
OpenAL         > * Missing (or bad) C library: OpenAL32
OpenAL         > This problem can usually be solved by installing the system package that
OpenAL         > provides this library (you may need the "-dev" version). If the library is
OpenAL         > already installed but in a non-standard location then you can use the flags
OpenAL         > --extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
OpenAL         > library file does exist, it may contain errors that are caught by the C
OpenAL         > compiler at the preprocessing stage. In this case you can re-run configure
OpenAL         > with the verbosity flag -v3 to see the error messages.
OpenAL         >
Progress 10/21

清晰度。我已经尝试过:

我遇到了类似的问题。在这种情况下,来自来源的建设似乎可以解决问题。由于构建环境不太熟悉,因此我在窗户上构建了更多麻烦。我的Windows工作主要集中在安装Cygwin并使其看起来像Unix。但是这次,我正在尝试掌握stack的mingw-w64提供的内容。我正在与Stack Exec一起拉下东西 - Pacman试图找到可以将开放式安装作为副作用但没有运气的东西。

一些细微之处是由于Stack想要在自己的独立环境中安装东西的事实而产生。它试图将安装在项目目录内部,而不是在其他地方使用目录。我的堆栈环境看起来像这样

C:\Users\Mark\slgjff>stack path
snapshot-doc-root: C:\sr\snapshots\aff7b821\doc
local-doc-root: C:\Users\Mark\slgjff\.stack-work\install\f5431f41\doc
local-hoogle-root: C:\Users\Mark\slgjff\.stack-work\hoogle\f5431f41
stack-root: C:\sr
project-root: C:\Users\Mark\slgjff
config-location: C:\Users\Mark\slgjff\stack.yaml
bin-path: .;C:\sr\snapshots\87ecdd59\bin;C:\sr\compiler-tools\x86_64-windows\ghc-8.10.7\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\mingw\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\usr\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\usr\local\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Mark\AppData\Roaming\local\bin;C:\Users\Mark\AppData\Local\Microsoft\WindowsApps
programs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows
compiler-exe: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin\ghc-8.10.7.exe
compiler-bin: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin
compiler-tools-bin: C:\sr\compiler-tools\x86_64-windows\ghc-8.10.7\bin
local-bin: C:\Users\Mark\AppData\Roaming\local\bin
extra-include-dirs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\include
extra-library-dirs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\lib, C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\bin
snapshot-pkg-db: C:\sr\snapshots\87ecdd59\pkgdb
local-pkg-db: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\pkgdb
global-pkg-db: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\lib\package.conf.d
ghc-package-path: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\pkgdb;C:\sr\snapshots\87ecdd59\pkgdb;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\lib\package.conf.d
snapshot-install-root: C:\sr\snapshots\87ecdd59
local-install-root: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8
dist-dir: .stack-work\dist\274b403a
local-hpc-root: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\hpc
local-bin-path: C:\Users\Mark\AppData\Roaming\local\bin
ghc-paths: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows

,我不确定配置是否需要快乐。我希望我可以构建一个清单,但是我不够理解编写清单。它需要标头文件的C源吗?不知道。当然,它必须在路径上的某个地方需要.lib和.dlls。但是到底是哪条路?

我的Package.yaml-在MacOS

ghc-options:
#- -dynamic
- -static

dependencies:
- base >= 4.7 && < 5
- random
- gloss
- gloss-juicy
- ALUT

library:
  source-dirs: src

executables:
  slgjff-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - slgjff

tests:
  slgjff-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - slgjff

和My stack.yaml上工作正常 - 它在MacOS上也可以正常工作

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/24.yaml

packages:
- .

extra-deps:
  - gloss-1.13.2.1@sha256:273d02d30e1896932d45424dab6022a16986c0ed3eef6937776b5f40854ce51c,4075
  - JuicyPixels-3.3.6@sha256:03bd32c3a884ac8a32f49334f14695469a710945c84cef9a1e059a79ac416996,3911
  - gloss-juicy-0.2.3

,并且因为它可能有用,所以以下是我程序的顶部。

import System.Exit ( exitSuccess, exitFailure )
import System.IO ( hPutStrLn, stderr )
import Data.List
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
import Graphics.Gloss.Interface.IO.Game
import Graphics.Gloss.Data.Vector
import Graphics.Gloss.Juicy
import Control.Monad( when, unless )
import Sound.ALUT as S

我变得如此绝望,以至于我在路径上加了C:/windows/system32,当构建试图从c:/windows/system32删除文件时,我的饮料几乎溢出。所以,我把那个拿出来。用尽了想法。

我的感觉是,由于在Windows上对GHC的经验不足,我一定会缺少对具有更多经验的人来说真的很明显的东西。事先感谢您的任何见解。

PS我创建了一个项目的脱衣版本,并将其放在 https://github.com上的Github上。 /Markcornwell/alut-glitch

有关如何重现错误的指令,请参见项目。

I have a stack project using Sound.ALUT. The project was building fine on both Windows and Mac before I added sound. (Sound.ALUT is a library layered over OpenAL.) Got thinks working on MacOS but those changes broke the Windows build. Still builds fine on MacOS.

The offending snippit from the "stack build" console log on Windows looks like this

GLUT           > [22 of 24] Compiling Graphics.UI.GLUT.Callbacks.Global
GLUT           > [23 of 24] Compiling Graphics.UI.GLUT.Callbacks
GLUT           > [24 of 24] Compiling Graphics.UI.GLUT
GLUT           > copy/register
GLUT           > Installing library in C:\sr\snapshots\87ecdd59\lib\x86_64-windows-ghc-8.10.7\GLUT-2.7.0.16-2jeyeunHWey2D1Huuhst8j
GLUT           > Registering library for GLUT-2.7.0.16..
OpenAL         > configure
OpenAL         > Configuring OpenAL-1.7.0.5...
OpenAL         > Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.7.exe: Missing dependency on a foreign
OpenAL         > library:
OpenAL         > * Missing (or bad) C library: OpenAL32
OpenAL         > This problem can usually be solved by installing the system package that
OpenAL         > provides this library (you may need the "-dev" version). If the library is
OpenAL         > already installed but in a non-standard location then you can use the flags
OpenAL         > --extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
OpenAL         > library file does exist, it may contain errors that are caught by the C
OpenAL         > compiler at the preprocessing stage. In this case you can re-run configure
OpenAL         > with the verbosity flag -v3 to see the error messages.
OpenAL         >
Progress 10/21

Cleary it can't find OpenAL. I've tried:

I had similar issues getting Sound.ALUT working on the Mac build. In that case building from the sources seemed to solve the problems. I have more trouble building on Windows since the build environment is less familiar. My Windows work has mostly been centered around installing Cygwin and making it look like Unix. But this time, I'm trying to get by on what stack's mingw-w64 provides. I was pulling down things with stack exec -- pacman trying to find something that would install OpenAL as a side effect but no luck.

Some subtleties arise from the fact that stack want to install things in its own self-contained environment. It tries to keep installs localized inside the project directory and not muck around with directories elsewhere. My stack environment looks like this

C:\Users\Mark\slgjff>stack path
snapshot-doc-root: C:\sr\snapshots\aff7b821\doc
local-doc-root: C:\Users\Mark\slgjff\.stack-work\install\f5431f41\doc
local-hoogle-root: C:\Users\Mark\slgjff\.stack-work\hoogle\f5431f41
stack-root: C:\sr
project-root: C:\Users\Mark\slgjff
config-location: C:\Users\Mark\slgjff\stack.yaml
bin-path: .;C:\sr\snapshots\87ecdd59\bin;C:\sr\compiler-tools\x86_64-windows\ghc-8.10.7\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\mingw\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\usr\bin;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\usr\local\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\Mark\AppData\Roaming\local\bin;C:\Users\Mark\AppData\Local\Microsoft\WindowsApps
programs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows
compiler-exe: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin\ghc-8.10.7.exe
compiler-bin: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\bin
compiler-tools-bin: C:\sr\compiler-tools\x86_64-windows\ghc-8.10.7\bin
local-bin: C:\Users\Mark\AppData\Roaming\local\bin
extra-include-dirs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\include
extra-library-dirs: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\lib, C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\msys2-20220503\mingw64\bin
snapshot-pkg-db: C:\sr\snapshots\87ecdd59\pkgdb
local-pkg-db: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\pkgdb
global-pkg-db: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\lib\package.conf.d
ghc-package-path: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\pkgdb;C:\sr\snapshots\87ecdd59\pkgdb;C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows\ghc-8.10.7\lib\package.conf.d
snapshot-install-root: C:\sr\snapshots\87ecdd59
local-install-root: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8
dist-dir: .stack-work\dist\274b403a
local-hpc-root: C:\Users\Mark\slgjff\.stack-work\install\363b2fd8\hpc
local-bin-path: C:\Users\Mark\AppData\Roaming\local\bin
ghc-paths: C:\Users\Mark\AppData\Local\Programs\stack\x86_64-windows

I'm not sure the configure needs to be happy. I wish I could construct a checklist run through, but I don't understand enough to write that checklist. Do it need the C source for header files? Don't know. Certainly it must need the .lib and .dlls on the path somewhere. But which path exactly?

My package.yaml -- which works fine on MacOS

ghc-options:
#- -dynamic
- -static

dependencies:
- base >= 4.7 && < 5
- random
- gloss
- gloss-juicy
- ALUT

library:
  source-dirs: src

executables:
  slgjff-exe:
    main:                Main.hs
    source-dirs:         app
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - slgjff

tests:
  slgjff-test:
    main:                Spec.hs
    source-dirs:         test
    ghc-options:
    - -threaded
    - -rtsopts
    - -with-rtsopts=-N
    dependencies:
    - slgjff

And my stack.yaml -- which also works fine on MacOS

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/24.yaml

packages:
- .

extra-deps:
  - gloss-1.13.2.1@sha256:273d02d30e1896932d45424dab6022a16986c0ed3eef6937776b5f40854ce51c,4075
  - JuicyPixels-3.3.6@sha256:03bd32c3a884ac8a32f49334f14695469a710945c84cef9a1e059a79ac416996,3911
  - gloss-juicy-0.2.3

And because it may be helpful, here are the includes at top of my program.

import System.Exit ( exitSuccess, exitFailure )
import System.IO ( hPutStrLn, stderr )
import Data.List
import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
import Graphics.Gloss.Interface.IO.Game
import Graphics.Gloss.Data.Vector
import Graphics.Gloss.Juicy
import Control.Monad( when, unless )
import Sound.ALUT as S

I got so desperate I stuck C:/Windows/System32 on the path and almost spilled my drink when the build tried to delete files from C:/Windows/System32. So, I took that out. Running out of ideas.

My sense is that out of inexperience with ghc on Windows, I must be missing something that would be really obvious to someone with more experience. Thanks in advance for any insights.

P.S. I created a stripped down version of the project and put it up on github at https://github.com/markcornwell/alut-glitch

See the README for the project for instruction on how to reproduce the error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳男子 2025-02-05 15:26:41

要安装OpenAL-1.7.0.5(Windows):

在Windows上。

https:// .openal-soft.org/#下载

“ libopenal32.dll.a”库复制到“ mingw \ lib”目录


D:\ ghcup \ ghc \ 9.4.7 \ mingw \ lib

在安装过程中发现问题,请使用-v3 flag with cabal install:
Cabal install -flag = buildExamples -v3&gt; error_file.txt

“ error_file.txt”
{ -
...
跑步:“ d:\ ghcup \ ghc \ \ 9.4.7 \ lib ../ mingw/bin \ gcc.exe” ...
与环境:...
D:\ GHCUP \ GHC \ 9.4.7 \ lib ../ mingw/bin \ gcc.exe返回exitfailure 1
d:\ ghcup \ ghc \ 9.4.7 \ lib ../ mingw/bin \ gcc.exe返回的exitfailure 1带错误

message:
 note ======> D://ghcup//ghc//9.4.7//mingw//bin/ld.exe: cannot find -lOpenAL32

...

或未经测试...)

To install OpenAL-1.7.0.5 (Windows):

Install the "OpenAL 1.1 Windows Installer (zip)" from https://openal.org/downloads/ on Windows.

Extract the contents of "openal-soft-1.23.1-bin.zip" from https://www.openal-soft.org/#download.

Copy the "libOpenAL32.dll.a" library to the "mingw\lib" directory

used ghcup
D:\ghcup\ghc\9.4.7\mingw\lib

To discover issues during installation, use the -v3 flag with cabal install:
cabal install --flag=BuildExamples -v3 > error_file.txt

"error_file.txt"
{-
...
Running: "D:\ghcup\ghc\9.4.7\lib../mingw/bin\gcc.exe" ...
with environment: ...
D:\ghcup\ghc\9.4.7\lib../mingw/bin\gcc.exe returned ExitFailure 1
D:\ghcup\ghc\9.4.7\lib../mingw/bin\gcc.exe returned ExitFailure 1 with error

message:
 note ======> D://ghcup//ghc//9.4.7//mingw//bin/ld.exe: cannot find -lOpenAL32

...

Alternatively, use cabal install --extra-lib-dirs="...lib" (not tested...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文