Mac book air(macOS Sierra 10.12.1)上安装QT4.8.6


今天没事在mac book air上安装QT4.8.6,遇到一些问题,记录如下:



错误1: 

“-bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory” 



解决办法:
 
我们可以通过vi编辑器来查看文件的format格式。步骤如下:
1.用vi命令打开文件,在vi命令模式中使用 :set ff 命令,可以看到改文件的格式为dos (会显示 fileformat=dos)
2.修改文件format为unix
方法一是:使用vim修改文件格式,命令:set ff=unix,执行完后再通过:set ff命令查看文件格式,结果为:fileformat=unix
方法二是:直接执行 dos2unix命令转换即可:dos2unix configure



错误2: 
“You don't seem to have 'make' or 'gmake' in your PATH. cannot proceed”



解决方法:


不要用zip包,下载tar包后,没有这个问题,stackoverflow这里有人说可能是unzip时导致的权限问题,点击打开链接

What I found was that mny of the executable programs in the archive did not have the execute bit set, so a simple chmod fixed the issue. It seems like the unix unzip utility munges the file permissions when it extracts



错误3: 
painting/qpaintengine_mac.cpp:345:19: error: use of undeclared identifier 'CMGetProfileByAVID' CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);                  
painting/qpaintengine_mac.cpp:348:9: error: use of undeclared identifier 'CMCloseProfile' CMCloseProfile(displayProfile);


解决办法:


上面的错误表明所使用的OSX系统函数不存在(我的os x系统版本是macOS Sierra 10.12.1,这个版本下没有上面这两个函数接口)。那只能手动修改Qt源代码,然后再次编译,修改的地方其实不多,就注释掉7行代码,然后添加1行代码就搞定。patch请看链接https://github.com/Homebrew/formula-patches/blob/master/qt/el-capitan.patch,附上完整patch的内容:

From 27aa46933bb32a88c310fe5918a49a3f34d65dfe Mon Sep 17 00:00:00 2001
	From: Mike McQuaid 
	Date: Sun, 13 Sep 2015 11:55:59 +0100
	Subject: [PATCH] Fix El Capitan build.


	---
	 src/gui/painting/qpaintengine_mac.cpp | 8 +-------
	 1 file changed, 1 insertion(+), 7 deletions(-)


	diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
	index 4aa0668..63b646d 100644
	--- a/src/gui/painting/qpaintengine_mac.cpp
	+++ b/src/gui/painting/qpaintengine_mac.cpp
	@@ -340,13 +340,7 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *wi
	     }
	 
	     // Get the color space from the display profile.
	-    CGColorSpaceRef colorSpace = 0;
	-    CMProfileRef displayProfile = 0;
	-    CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
	-    if (err == noErr) {
	-        colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
	-        CMCloseProfile(displayProfile);
	-    }
	+    CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(displayID);
	 
	     // Fallback: use generic DeviceRGB
	     if (colorSpace == 0)
	-- 
	2.3.8 (Apple Git-58)


修改之后,make了两个小时,本想着肯定通过,结果又报错了:

quicktimevideoplayer.h:23:9: fatal error: 'QTKit/QTDataReference.h' file not found

google后找到的说明,“Apple’s (Quicktime) QTKit framework has been removed in Sierra OSX”,意思是说苹果操作系统Sierra版本中已经没有QTKit框架了,能google到的信息不多,没有发现解决办法,如果谁知道帮忙留个言告知,小生不胜感激!


迫于无奈,最后只得安装QT5.6.2,顺利通过,不提。

你可能感兴趣的:(其他)