首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用堆栈(在windows上)构建带有模块导入的项目

无法使用堆栈(在windows上)构建带有模块导入的项目
EN

Stack Overflow用户
提问于 2020-03-29 08:15:41
回答 1查看 803关注 0票数 2

我做了一个培训项目,需要几个模块导入(Database.Redis和Web.Scotty )。当我做stack build时,我得到了这个:

代码语言:javascript
复制
D:\ssd-data\work\my-project\my-project.cabal was modified manually. Ignoring D:\ssd-data\work\my-project\package.yaml in favor of the cabal file.
If you want to use the package.yaml file instead of the cabal file,
then please delete the cabal file.
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
WARNING: Ignoring regex-posix's bounds on base (<0 && >=4.3 && <4.14); using base-4.13.0.0.
Reason: trusting snapshot over cabal file dependency information.
regex-posix      > configure
regex-posix      > Configuring regex-posix-0.96.0.0...
regex-posix      > build
regex-posix      > Preprocessing library for regex-posix-0.96.0.0..
regex-posix      > C:\Users\user\AppData\Local\Temp\stack3628\regex-posix-0.96.0.0\Wrap.hsc:96:10: fatal error: regex.h: No such file or directory
regex-posix      > compilation terminated.
regex-posix      > compiling .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c failed (exit code 1)
regex-posix      > command was: C:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\../mingw/bin\gcc.exe -c .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c -o .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.o -D__GLASGOW_HASKELL__=808 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\cbits -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\autogen -I.stack-work\dist\29cc6475\build\global-autogen -include .stack-work\dist\29cc6475\build\autogen\cabal_macros.h -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\bytestring-0.10.10.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\base-4.13.0.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\integer-gmp-1.0.2.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib/include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3/lib/include/
streaming-commons> configure
streaming-commons> Configuring streaming-commons-0.2.1.2...
streaming-commons> build
streaming-commons> Preprocessing library for streaming-commons-0.2.1.2..
streaming-commons> Building library for streaming-commons-0.2.1.2..
streaming-commons> [ 1 of 17] Compiling Data.Streaming.ByteString.Builder.Buffer
streaming-commons> [ 2 of 17] Compiling Data.Streaming.ByteString.Builder
streaming-commons> [ 3 of 17] Compiling Data.Streaming.Filesystem
streaming-commons> [ 4 of 17] Compiling Data.Streaming.Network.Internal
streaming-commons> [ 5 of 17] Compiling Data.Streaming.Network
streaming-commons> [ 6 of 17] Compiling Data.Streaming.Process.Internal
streaming-commons> [ 7 of 17] Compiling Data.Streaming.Process
streaming-commons> [ 8 of 17] Compiling Data.Streaming.Zlib.Lowlevel
streaming-commons> [ 9 of 17] Compiling Data.Streaming.Zlib
streaming-commons> [10 of 17] Compiling Data.Text.Internal.Encoding.Utf16
streaming-commons> [11 of 17] Compiling Data.Text.Internal.Encoding.Utf32
streaming-commons> [12 of 17] Compiling Data.Text.Internal.Unsafe.Shift
streaming-commons> [13 of 17] Compiling Data.Text.Internal.Unsafe.Char
streaming-commons> [14 of 17] Compiling Data.Text.Internal.Encoding.Utf8
streaming-commons> [15 of 17] Compiling Data.Streaming.Text
streaming-commons> [16 of 17] Compiling System.Win32File
streaming-commons> [17 of 17] Compiling Data.Streaming.FileRead
streaming-commons> copy/register
streaming-commons> Installing library in C:\sr\snapshots\260bc685\lib\x86_64-windows-ghc-8.8.3\streaming-commons-0.2.1.2-7nSvofLzcDVEO2jjCYKFuK
streaming-commons> Registering library for streaming-commons-0.2.1.2..

--  While building package regex-posix-0.96.0.0 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.3.exe --builddir=.stack-work\dist\29cc6475 build --ghc-options ""
    Process exited with code: ExitFailure 1
Progress 2/9

当我构建一个没有任何导入的项目时,一切都没问题。

EN

回答 1

Stack Overflow用户

发布于 2021-01-02 13:25:04

我也有同样的问题,但我解决了。如果你还没有解决这个问题,我想如果你按照我做的去做,你就能解决这个问题。

错误消息的最重要部分如下所示。关键是头文件丢失(regex.h),您必须将它添加到正确的路径中。

代码语言:javascript
复制
regex-posix      > ...\regex-posix-0.96.0.0\Wrap.hsc:96:10: fatal error: 
                   regex.h: No such file or directory    
regex-posix      > compilation terminated.
...
regex-posix      > command was: C:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\../mingw/bin\gcc.exe -c .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.c -o .stack-work\dist\29cc6475\build\Text\Regex\Posix\Wrap_hsc_make.o -D__GLASGOW_HASKELL__=808 -Dmingw32_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dmingw32_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Icbits -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\cbits -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -I.stack-work\dist\29cc6475\build\autogen -I.stack-work\dist\29cc6475\build\global-autogen -include .stack-work\dist\29cc6475\build\autogen\cabal_macros.h -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\bytestring-0.10.10.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\base-4.13.0.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\integer-gmp-1.0.2.0\include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib/include -IC:\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3/lib/include/

您可以从regex.h文件中获取https://code.woboq.org/linux/include/regex.h.html。将文件保存到路径中,如上面的错误消息(最后一行)所示。在您的例子中,路径是:

代码语言:javascript
复制
\Users\user\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.3\lib\include

重要的是将regex.h文件放在Haskell的库文件夹中。(...\x86_64-windows\ghc-8.8.3\lib\include)之后,执行堆栈构建命令。

我希望我的回答对你有帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60911650

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档