美文网首页Qt 疑难杂症
macOS 下编译 qt 静态版

macOS 下编译 qt 静态版

作者: wyrover | 来源:发表于2018-08-30 14:19 被阅读162次

前提

  • 安装 xcode
  • 安装 xcode command line tools

下载 qt-everywhere-opensource-src-5.7.1.tar.gz

tar -xzvf qt-everywhere-opensource-src-5.7.1.tar.gz
cd qt-everywhere-opensource-src-5.7.1
vi build.sh

build.sh

#!/bin/sh

./configure -static -debug-and-release -nomake examples -nomake tests -prefix ~/Qt/5.7.1_static_osx -qt-sql-sqlite -plugin-sql-sqlite -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre -opensource -confirm-license -opengl -qt-freetype

chmod +x ./build.sh
./build.sh
make
make install

或者多核处理器

make -j8
make -j8 install

错误信息

编译 qt 5.7.1 下出现错误

fontdatabases/mac/qfontengine_coretext.mm:775:20: error: qualified reference to
      'QFixed' is a constructor name rather than a type in this context
    return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));

qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
修改为

return QFixed(int(CTFontGetUnitsPerEm(ctfont)));

qt/qtbase/src/plugins/platforms/cocoa/qcocoahelpers.h

OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);

改为

void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);

qt/qtbase/src/plugins/platforms/cocoa/qcocoahelpers.mm 改为

void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
{
    // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev)
    OSStatus err = noErr;

//    require_action(inContext != NULL, InvalidContext, err = paramErr);
//    require_action(inBounds != NULL, InvalidBounds, err = paramErr);
//    require_action(inImage != NULL, InvalidImage, err = paramErr);

    CGContextSaveGState( inContext );
    CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds));
    CGContextScaleCTM(inContext, 1, -1);

    CGContextDrawImage(inContext, *inBounds, inImage);

    CGContextRestoreGState(inContext);
//InvalidImage:
//InvalidBounds:
//InvalidContext:
//        return err;
}

相关文章

  • macOS 下编译 qt 静态版

    前提 安装 xcode 安装 xcode command line tools 下载 qt-everywher...

  • qt 下编译静态库

    静态库 MathFunctions.pro mathfunctions.h mathfunctions.cpp 链...

  • win下qt编译librdkafka

    windows 下使用 Qt 的 mingw81_64 编译 librdkafka , 生成静态库。librdka...

  • macOS 10.13.6 下编译 Qt 5.7.1 动态链接版

    安装 xcode 安装Homebrew Homebrew 下安装必要的软件 cmake linpng libjpe...

  • Qt静态编译

    想把项目中的Txt文件分割功能单独分离出来,用静态编译会让分发方便一点。于是开始捣鼓编译安装:https://bl...

  • macos Qt安卓 android 环境搭建

    macos qt安桌编译环境: 下载jdk(java)版本号 可以参考对应qt版本的文档里的java版本号。 比如...

  • QT 配置使用QWT

    SVN 下载版本 右键检出 用qt打开文件,进行编译,编译完成后有如下文件: 静态文件复制到QT的如下目录 动态文...

  • Ubuntu14.04下静态编译Qt

    一、什么是Qt Qt是一个1991年由奇趣科技开发的跨平台C++图形用户界面应用程序开发框架。它既可以开发GUI程...

  • /2016/06/14/ 静态编译 openCV 3.1

    去年差不多是现在的时候,在编译 Qt 的 openCV 3.0,现在有得静态编译 VS 的 openCV 3.1 ...

  • QT

    描述:QT环境分为静态编译和动态编译两种模式,其中: 静态编译,最终生成文件为一个比较大的EXE文件,不依赖任何本...

网友评论

    本文标题:macOS 下编译 qt 静态版

    本文链接:https://www.haomeiwen.com/subject/gqnrwftx.html