FC22编译QT3

安装g++

dnf install gcc-c++

1,configure

./configure -thread -no-nis -system-libpng -system-libjpeg -system-libmng -system-zlib -xft -sm

2,gmake

2.1 error: 'ptrdiff_t' does not name a type

打开include\qvaluelist.h 加入#include <stddef.h>

 

2.2 forward declaration of 'png_info {aka struct png_info_def}'

这是png15之后的api升级了,参考

https://github.com/alekseysidorov/gentoo-stuff/blob/master/x11-libs/qt/files/qt-3.3.8-libpng15.patch

打开kernel\qpngio.cpp

在首行#include <png.h>后加入

#include <zlib.h>

 

setup_qt函数中png_get_IHDR函数后面加入

png_colorp info_ptr_palette = NULL;

int info_ptr_num_palette = 0;

if (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) {

    png_get_PLTE(png_ptr, info_ptr, &info_ptr_palette, &info_ptr_num_palette);

}

 

png_bytep info_ptr_trans_alpha = NULL;

int info_ptr_num_trans = 0;

png_color_16p info_ptr_trans_color = NULL;

 

if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {

    png_get_tRNS(png_ptr, info_ptr, &info_ptr_trans_alpha, &info_ptr_num_trans, &info_ptr_trans_color);

}

 

if ( bit_depth == 1 && info_ptr->channels == 1 ) { 改为

if ( bit_depth == 1 && png_get_channels(png_ptr, info_ptr) == 1 ) {

 

163行

const int g = info_ptr->trans_values.gray; 改为

const int g = info_ptr_trans_color->gray;

 

187行

&& info_ptr->num_palette <= 256 ) 改为

&& info_ptr_num_palette <= 256 )

 

196行

if (!image.create(width, height, bit_depth, info_ptr->num_palette

改为

if (!image.create(width, height, bit_depth, info_ptr_num_palette

 

201行

            while ( i < info_ptr->num_trans ) {

                image.setColor(i, qRgba(

                    info_ptr->palette[i].red,

                    info_ptr->palette[i].green,

                    info_ptr->palette[i].blue,

                    info_ptr->trans[i]

                    )

                );

                i++;

            }

改为

            while ( i < info_ptr_num_trans ) {

                image.setColor(i, qRgba(

                    info_ptr_palette[i].red,

                    info_ptr_palette[i].green,

                    info_ptr_palette[i].blue,

                    info_ptr_trans_alpha[i]

                    )

                );

                i++;

            }

 

303行:

if (setjmp(png_ptr->jmpbuf)) { 改为

if (setjmp(png_jmpbuf(png_ptr))) {

 

488行:

if (setjmp(png_ptr->jmpbuf)) { 改为

if (setjmp(png_jmpbuf(png_ptr))) {

 

510行:

info_ptr->channels = 一段注释掉

 

527行:    //png_set_sBIT(png_ptr, info_ptr, 8);

    info_ptr->sig_bit.red = 8;

    info_ptr->sig_bit.green = 8;

    info_ptr->sig_bit.blue = 8;

注释掉,添加

 

    png_color_8 sig_bit;

    sig_bit.red = 8;

    sig_bit.green = 8;

    sig_bit.blue = 8;

    png_set_sBIT(png_ptr, info_ptr, &sig_bit);

 

551行:

            info_ptr->palette[i].red = qRed(rgb);

            info_ptr->palette[i].green = qGreen(rgb);

            info_ptr->palette[i].blue = qBlue(rgb);

改为

            info_ptr_palette[i].red = qRed(rgb);

            info_ptr_palette[i].green = qGreen(rgb);

            info_ptr_palette[i].blue = qBlue(rgb);

上面添加:

png_colorp info_ptr_palette = NULL;

int tmp;

png_get_PLTE(png_ptr, info_ptr, &info_ptr_palette, &tmp);

 

573行:

info_ptr->sig_bit.alpha = 8;

改为

        png_color_8p sig_bit;

        png_get_sBIT(png_ptr, info_ptr, &sig_bit);

        sig_bit->alpha = 8;

        png_set_sBIT(png_ptr, info_ptr, sig_bit);

 

1063行

if (setjmp(png_ptr->jmpbuf)) { 改为

if (setjmp(png_jmpbuf(png_ptr))) {

 

1090行

if (setjmp(png_ptr->jmpbuf)) { 改为

if (setjmp(png_jmpbuf(png_ptr))) {

 

1150行:

unused_data = (int)png->buffer_size; // Since libpng doesn't tell us 改为

unused_data = png_process_data_pause(png, 0);

 

 

2.3 qjpegio.cpp:59:21: fatal error: jpeglib.h: No such file or directory

yum install libjpeg-devel

 

2.4 qmngio.cpp:58:20: fatal error: libmng.h: No such file or directory

yum install libmng-devel

 

2.5 undefined reference to `qInitImages_designercore()'

qInitImages_designercore() 原本因该在

tools/designer/designer/qmake_image_collection.cpp

文件中,打开一看,文件中没有这个函数

该文件不是qt自带的文件,是通过命令生成的:

/qt3/bin/uic  -embed designercore images/designer_adjustsize.png -o qmake_image_collection.cpp

运行该命令报错:

libpng error: bad parameters to zlib

uic: cannot load image file images/designer_adjustsize.png

归结原因是qt无法读取png图片.

最终定位原因,是qt自带的zlib和系统的版本不匹配!

configure中加入-system-zlib

顺利编译通过

 

2.6 qmake: command not found

 

3,重新加入xft参数configure

报错:

Xft support cannot be enabled due to functionality tests!

 Turn on verbose messaging (-v) to ./configure to see the final report.

 If you believe this message is in error you may use the continue

 switch (-continue) to ./configure to continue.

用-v查看:

Xft auto-detection... ()

  Found libXft.so in /usr/lib

  Found libXft.so in /lib

  Found X11/Xft/Xft.h in /usr/include

  Found Xft version 2.3.2

  Could not find freetype2/freetype/freetype.h anywhere in  /usr/X11R6/include  /usr/include /include

freetype.h在/usr/include/freetype2/下面,查找的路径多了个freetype,手工建立一个目录把头文件拷贝进去.

可以正常configure了.gmake了

 

4, OpenGL

查看configure信息

OpenGL auto-detection... ()

  Found GLU lib in /usr/lib

  Found GL lib in /usr/lib

  Found Xmu lib in /usr/lib

  Found GL/gl.h in /usr/include

  Could not find GL/glu.h anywhere in

找不到glu头文件,没打开OpenGL支持.

yum install mesa-libGLU-devel

yum install libXmu-devel

5,SM

kernel/qapplication_x11.cpp:5964:26: fatal error: X11/SM/SMlib.h: No such file or directory

yum install libSM-devel

6,设置环境变量

 

#export QT env

export QTDIR=/qt3

export PATH=$QTDIR/bin:$PATH

export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

export DISPLAY=:0.0

#end export QT env

 

posted on 2016-09-27 16:56  Red_angelX  阅读(1136)  评论(1编辑  收藏  举报