[英]GHC/GCC compiler issue __STDC_VERSION__ w/ C99 from Stg.h, fails for every package
每當我嘗試在OSX 10.12.6和GCC 4.8.0上安裝帶有cabal(2.0.0)的軟件包時,都會遇到以下有關GHC 8.2.1中Stg.h文件的錯誤,該錯誤是難以置信的。 我不能在OSX上安裝任何軟件包。
預期行為:
cabal install $packagename
應該在OSX上安裝$packagename
,因為cabal和cabal-install已正確安裝。
觀察到的行為:
cabal install $packagename
由於與名為__STDC_VERSION__
的變量有關的低級GHC / GCC問題而__STDC_VERSION__
。 我不是C程序員,並且我不希望正確安裝GHC和cabal會導致安裝包失敗。 AFAICT此問題與用戶錯誤無關。
Matthew@Mattmac git:the_D*+ ~/Projects/kata/euler>cabal update && cabal
install optparse-applicative
Downloading the latest package list from hackage.haskell.org
gcc: warning: couldn’t understand kern.osversion ‘16.7.0
gcc: warning: couldn’t understand kern.osversion ‘16.7.0
Warning: --root-cmd is no longer supported, see
https://github.com/haskell/cabal/issues/3353 (if you didn't type --root-cmd,
comment out root-cmd in your ~/.cabal/config file)
Resolving dependencies...
Downloading transformers-compat-0.5.1.4...
Configuring colour-2.3.4...
Configuring transformers-compat-0.5.1.4...
Building colour-2.3.4...
Building transformers-compat-0.5.1.4...
Failed to install transformers-compat-0.5.1.4
Build log ( /Users/Matthew/.cabal/logs/ghc-8.2.1/transformers-compat-0.5.1.4-HHfl4KyHCH71PMx2CRgdve.log ):
cabal: Entering directory '/var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/cabal-tmp-91946/transformers-compat-0.5.1.4'
Configuring transformers-compat-0.5.1.4...
gcc: warning: couldn’t understand kern.osversion ‘16.7.0
Preprocessing library for transformers-compat-0.5.1.4..
Building library for transformers-compat-0.5.1.4..
[1 of 2] Compiling Control.Monad.Trans.Instances ( src/Control/Monad/Trans/Instances.hs, dist/build/Control/Monad/Trans/Instances.o )
[2 of 2] Compiling Paths_transformers_compat ( dist/build/autogen/Paths_transformers_compat.hs, dist/build/Paths_transformers_compat.o )
[1 of 2] Compiling Control.Monad.Trans.Instances ( src/Control/Monad/Trans/Instances.hs, dist/build/Control/Monad/Trans/Instances.p_o )
In file included from /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/include/Rts.h:30:0: error:
0,
from /var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/ghc92089_0/ghc_7.c:2:
/Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/include/Stg.h:30:3: error:
error: #error __STDC_VERSION__ does not advertise C99 or later
# error __STDC_VERSION__ does not advertise C99 or later
^
|
30 | # error __STDC_VERSION__ does not advertise C99 or later
| ^
`gcc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Leaving directory '/var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/cabal-tmp-91946/transformers-compat-0.5.1.4'
Failed to install colour-2.3.4
Build log ( /Users/Matthew/.cabal/logs/ghc-8.2.1/colour-2.3.4-9c0ktEQZfar3Wigr5kT6BU.log ):
cabal: Entering directory '/var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/cabal-tmp-91945/colour-2.3.4'
Configuring colour-2.3.4...
Preprocessing library for colour-2.3.4..
Building library for colour-2.3.4..
[ 1 of 14] Compiling Data.Colour.CIE.Chromaticity (
Data/Colour/CIE/Chromaticity.hs, dist/build/Data/Colour/CIE/Chromaticity.o )
...
[ 1 of 14] Compiling Data.Colour.CIE.Chromaticity ( Data/Colour/CIE/Chromaticity.hs, dist/build/Data/Colour/CIE/Chromaticity.p_o )
In file included from /Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/include/Rts.h:30:0: error:
0,
from /var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/ghc92201_0/ghc_3.c:2:
/Library/Frameworks/GHC.framework/Versions/8.2.1-x86_64/usr/lib/ghc-8.2.1/include/Stg.h:30:3: error:
error: #error __STDC_VERSION__ does not advertise C99 or later
# error __STDC_VERSION__ does not advertise C99 or later
^
|
30 | # error __STDC_VERSION__ does not advertise C99 or later
| ^
`gcc' failed in phase `C Compiler'. (Exit code: 1)
cabal: Leaving directory '/var/folders/qw/k0t4r5fd5_b0phjvwtxx_n700000gq/T/cabal-tmp-91945/colour-2.3.4'
cabal: Error: some packages failed to install:
ansi-terminal-0.7.1.1-3eOIKoB8mo97DkHMJ6AgBw depends on ansi-terminal-0.7.1.1
which failed to install.
ansi-wl-pprint-0.6.8.1-Ctcte9oFd5tFGoIV7u576g depends on
ansi-wl-pprint-0.6.8.1 which failed to install.
colour-2.3.4-9c0ktEQZfar3Wigr5kT6BU failed during the building phase. The
exception was:
ExitFailure 1
optparse-applicative-0.14.0.0-Iaq7kOKFg2Z4XsKvk269H6 depends on
optparse-applicative-0.14.0.0 which failed to install.
transformers-compat-0.5.1.4-HHfl4KyHCH71PMx2CRgdve failed during the building phase. The exception was:
ExitFailure 1
該錯誤是難以置信的
實際上,它看起來很清楚:
error: #error __STDC_VERSION__ does not advertise C99 or later
C頭文件Stg.h
正在使用標准宏__STDC_VERSION__
檢查編譯器是否支持C99(標准ISO C的1999版本)。 由於未相應設置,因此編譯器不符合C99,並且C源代碼觸發錯誤。
基本上, Stg.h
拒絕使用甚至不支持18年歷史的C標准的C編譯器進行編譯。 相當合理。
GCC 4.8確實看起來很古老:最新的GCC是7.1。 我會嘗試將GCC升級到更新的版本,如果不是最新版本的話。
更新:正如Keith Thompson在下面指出的那樣,盡管GCC 4.8 -std=c99
年限,但如果傳遞標志-std=c99
,它仍可以支持C99。 應該有某種方法指示cabal
將此標志傳遞給gcc
,但我不記得如何。 應該有一些為此選項命名的選項,例如cflags
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.