Fedora22編譯Qt3.3.X

                      FC22編譯QT3

安裝g++

dnf install gcc-c++c++

1,configure

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

2,gmake

2.1 error: 'ptrdiff_t' does not name a typegithub

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

 

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

這是png15以後的api升級了,參考函數

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

打開kernel\qpngio.cppthis

在首行#include <png.h>後加入圖片

#include <zlib.h>get

 

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

相關文章
相關標籤/搜索