在OS X Mavericks上安装libsndfile时出现致命错误

时间:2014-01-08 08:27:47

标签: c libsndfile

我正在尝试在运行os x 10.9.1的mac上安装libsndfile。但是,在运行命令'make'后,它会运行一段时间,然后显示以下消息:sndfile-play.c:61:11: fatal error: 'Carbon.h' file not found.我找不到有类似问题的人。从我发现它看起来可能与不受支持的较新的OS版本有关。有谁知道如何解决这个问题?提前谢谢!

5 个答案:

答案 0 :(得分:7)

以下对我有用(我正在运行OS X 10.9.1):

  1. 下载源代码
  2. 解开捆绑
  3. $ ./configure
  4. $ make
  5. Carbon.h应该出现问题(sndfile-play.c:61:21: 错误:Carbon.h:没有这样的文件或目录)
  6. 使用以下命令搜索计算机中的Carbon.h:$ find /Applications/Xcode.app/Contents/Developer/ | grep Carbon.h
  7. 编辑**程序/ ** Makefile
  8. 查找CFLAGS,确保配置CFLAGS: CFLAGS =
    -I / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.7.sdk / System / Library / Frameworks / Carbon.framework / Versions / A / Headers / -g -O2 - std = gnu99 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -funsigned-char -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite- strings -Wundef -pipe -I / Developer / Headers / FlatCarbon
  9. $ make
  10. $ make check(所有测试都应该通过),然后:
  11. $ sudo make install
  12. 来源:http://comunidad.udistrital.edu.co/ocala/2013/06/09/building-libsndfile-on-mac-os-x/

答案 1 :(得分:5)

我建议您使用brew来安装它:http://brew.sh/

安装完成后,只需运行brew install libsndfile

即可

答案 2 :(得分:2)

另外,删除#include也可以。

答案 3 :(得分:0)

要以一般方式解决(即不使用黑客攻击Makefile),请执行"导出CPPFLAGS =' -I /"在运行./configure之前,使用包含Carbon.h的Xcode头文件目录的路径。以下是步骤,全部来自终端窗口:

在您的系统上查找Carbon.h的实例:

find /Applications/Xcode.app/Contents/Developer/ | grep Carbon.h

输出:

/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/Headers/FlatCarbon/Carbon.h
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h
/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/Carbon.h

使用第一行(因为它似乎是最通用的头目录),复制路径而不包括最终的Carbon.h:

/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/

最后,将该内容粘贴到导出行中(确保在路径的两端包含撇号),如下所示:

export CPPFLAGS='-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Headers/'

现在重新运行./configure并编译行进行编译。

答案 4 :(得分:0)

我使用此方法取得了成功(使用Mac OSX 10.9.2):

1)选择终端应用程序 2)确保我在bash shell中(方法在csh或tcsh中失败) 3)响应bash $ type     ruby -e“$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” ******注意:这会从网上带来啤酒。你必须给你的        系统管理员密码*****。
4)响应bash $ type      “brew install libsndfile” ******注意:这会带来sndfile.h和其他各种libsndfile文件        Web并将它们安装在/ usr / local的子目录中。再说一次,你会的        必须提供您的系统管理员密码*****。

相关问题