I continued making tests with Harbour hbqt and Qt451GA for OS/2

As I was getting many errors, I opened a "ticket" in svn.netlabs.org/qt4

With the fast and excelent help of:
 - Dmitry A. Kuminov (development)
 - Silvan Scherrer (management)
Harbour for OS/2 is very close to have support of hbqt contrib
Just remain eleven .cpp files with problems

I need help on three areas:

1) Maurilio: to check changes in hbdefs.h
   /* 28/03/2000 - [email protected]
      The same holds true when using GCC under OS/2
   */
   /* xx/02/2010 - [email protected]
      Include all OS/2 API definitions to make sure other involved parties
      (such as Qt for OS/2) will get everything they want
   */
   #define OS2EMX_PLAIN_CHAR
   #define INCL_BASE
   #define INCL_PM
   #include <os2.h>
   #undef INT
   #undef UINT
   #define HB_DONT_DEFINE_BASIC_TYPES

2) Pritpal:
1. Add #ifndef QT_NO_PRINTER / #endif around the parts in the source code that use printing classes (QAbstractPrintDialog, QPageSetupDialog etc.) This btw will let it build on all platforms that don't provide printing support for some reason, not only OS/2.

3) Pritpal:
#ifndef QT_NO_ACCESSIBILITY / #endif around the places that complain about missing accessibility methods.

Below are text with relevant facts of tests, info, responses, ...

Qt for OS/2 (4.6.1) will be available soon, with printer support using CUPS

README.OS2 file contain this section, useful for management of unavailable classes

>>>>>========================
CURRENT LIMITATIONS
[...]
4. In order to let Qt correctly detect the regional settings and choose the right language for translating the user interface, the LANG environment variable must be set. The format is
       set LANG=ll_CC
where <ll> is the language code and <CC> is the country code (refer to wikipedia.org to find correct letters for your langage and country if you do not know them). Note that the optional encoding part of the LANG specification is ignored by Qt for OS/2 since 4.5.1 Beta 5 because it now detects the encoding automatically based on the system OS/2 settings.
Later, the correct language will be detected from the system settings so
that specifying LANG will be not necessary at all.

[...]

8. The followign classes are not available due to their rare usage or low importance on the OS/2 platform: QSharedMemory, QSystemSemaphore,
QInputContext, QAccessible. The following macros are defined to indicate
this: QT_NO_SYSTEMSEMAPHORE, QT_NO_SHAREDMEMORY, QT_NO_IM, QT_NO_ACCESSIBILITY. Applications normally use them to guard the
relevant parts of code so they should still build.
<<<<<<========================

David Macias


I installed Qt451GA using .wpi files from Netlabs

Using "Qt4 Command Prompt", setting os2gcc442 environment and Harbour environment as usual

In first try to build Harbour-hbqt it fail with this error:

E:\ecs\system\qt4\include/QtCore/qt_os2.h:59:33: error:
API_FPU_CW_Wrappers.h: No such file or directory

Searching for API_FPU_CW_Wrappers.h it does not exist anywhere in e:\ecs\system\qt4\include\ directories

Looking for API_FPU_CW_Wrappers.h it exist in:

    E:\ecs\system\qt4\mkspecs\os2-g++
    E:\ecs\system\qt4\mkspecs\default

with same date and content:

    17/12/09 3:22a 145,271 0 a--- API_FPU_CW_Wrappers.h

Copying API_FPU_CW_Wrappers.h to e:\ecs\system\qt4\include\ and trying again build of Harbour-hbqt many errors are raised from
API_FPU_CW_Wrappers.h and then GPF with "Killed by SIGSEGV"

So something are wrong in API_FPU_CW_Wrappers.h reference, content and use under OS/2

[...]

Dmitry response:
>>>>>========================
As far as I can see, the project doesn't use qmake. For this reason, the include path E:\ecs\system\qt4\mkspecs\default (or E:\ecs\system\qt4\mkspecs\os2-g++ which is the same in this case) is not passed to the compiler. Adding it to the list of include directories for the compier should fix the problem for you. Please try and report back.

For the second case, it's the wrong include order -- a typical problem for the OS/2 environment caused by the way the os2.h file (which is a central access point to the OS/2 APIs) is organized. In your case, it seems that os2.h is manually included from either hbqt_hbqmainwindow.cpp or hbqt_hbqmainwindow.h (or from another file they include) before Qt4 headers are included. Such an order is not supported and should not take place -- Qt includes must go first. Also, it's not clear why os2.h is included manually in a Qt source file in the first place: in theory, this should be never needed. If you give me more details on this, I will be able to suggest you the best solution.

P.S. SIGSEGV is probably due to too many errors (e.g. maybe a bug of the GCC4 port) and is not related to Qt4.
<<<<<<========================


We use GNU make
Using:

    set C_INCLUDE_PATH=E:\ecs\system\qt4\mkspecs\default;%C_INCLUDE_PATH%
set CPLUS_INCLUDE_PATH=E:\ecs\system\qt4\mkspecs\default;%CPLUS_INCLUDE_PATH%

then API_FPU_CW_Wrappers.h missing has gone, and we have a lot of errors due API_FPU_CW_Wrappers.h
Are more than 600 lines in build output
Most of them are of type:

    'somevalue' was not declared in this scope

After long section of API_FPU_CW_Wrappers.h errors, begin a new section with qmime.h errors
[...]


Dmitry response:
>>>>>========================
Just to clarify Silvan, os2.h is indeed included very early: from hbdefs.h which is included before <QtGui?/QMouseEvent> through other hb* headers (hbapi.h -> hbvmpub.h).

So, my assumption was correct. Please make sure Qt headers are included before hb* ones in all sources -- there is no other way to make it work on OS/2 (*). Also note that it's not necessary to include qt_os2.h directly as suggested by Silvan unless you need to directly access OS/2 API from the Qt-based part of the code (which is non-portable and therefore should be avoided by all means).

(*) The thing with os2.h is that you have to specify what parts of the API you want before including it (using the #define INCL_xxx directives). If you do it once, all subsequent attempts to include os2.h again (probably with a different set of INCL_xxx defines) will be ignored by the compiler because os2.h contains a protection code that allows to include its contents only once per every compilation unit (.cpp file). Therefore, if your set of INCL_xxx doesn't drag in APIs needed by some other parties involved in the compilation process there is nothing these parties can do.

BTW, if you don't want to toss the Qt includes around in all sources, there is one alternative solution. Just add the following to hbdefs.h right before the line where os2.h is included:

#define OS2EMX_PLAIN_CHAR
#define INCL_BASE
#define INCL_PM

This will make sure that os2.h will drag in all the APIs it has so every party will be eventually happy.
<<<<<<========================


Now the section for OS/2 in hbdefs.h is:

#elif defined( HB_OS_OS2 )

   /* With the exception of WORD, the IBM Visual Age C++ compiler has
its own definitions of the Harbour types most of which conflict with the
      Harbour #undefs, due to typedef being the prevalent method of
      defining the types in IBMCPP, whereas Harbour assumes that the
      definitions that it is replacing have been defined using
      #define. Therefore, it is necessary to skip the Harbour
      definition section when using the IBMCPP compiiler, include
      the IBMCPP type definitions, and then add the definition for WORD

      NOTE: This only applies to the common types that most C compilers
            define. Any new types, particulary those that start with
            HB_, must be placed AFTER the #endif __IBMCPP__ line!
   */
   /* 28/03/2000 - [email protected]
      The same holds true when using GCC under OS/2
   */
   #define INCL_TYPES
   #define INCL_DOSEXCEPTIONS    /* DOS exception values */
   #define INCL_ERRORS           /* DOS error values     */
#define INCL_LONGLONG /* include native compiler LONGLONG definition */

   /* DAVID:
   */
   #define OS2EMX_PLAIN_CHAR
   #define INCL_BASE
   #define INCL_PM

   #include <os2.h>
   #undef INT
   #undef UINT
   #define HB_DONT_DEFINE_BASIC_TYPES

and most of hbqt build error has gone :-)
You got the key

It build fine three of four libs:

    17/02/10 2:30p 300,032 124 a--- hbqt.lib
    17/02/10 3:44p 809,984 124 a--- hbqtcore.lib
    17/02/10 3:51p 71,168 124 a--- hbqtnetwork.lib

and fail with hbqtgui

[...]

In order to go ahead to solve hbqtgui I was trying build discarding each file with error. hbqtgui have hundreds of .cpp and .prg files (more than 400) and fail with these eleven:

# QAbstractPrintDialog.cpp \
# QInputContext.cpp \
# QPageSetupDialog.cpp \
# QPlainTextEdit.cpp \
# QPrintDialog.cpp \
# QPrintEngine.cpp \
# QPrinter.cpp \
# QPrintPreviewDialog.cpp \
# QTextDocument.cpp \
# QTextEdit.cpp \
# QWidget.cpp \

Notes:
Note 1) Many files even without error show this group of warnings:
E:\ecs\system\qt4\include/QtGui/qmime.h:150: warning: unused parameter 'targetName' E:\ecs\system\qt4\include/QtGui/qmime.h:150: warning: unused parameter 'supportedOps'
E:\ecs\system\qt4\include/QtGui/qmime.h:154: warning: unused parameter 'drm'
E:\ecs\system\qt4\include/QtGui/qmime.h:154: warning: unused parameter 'drf'
E:\ecs\system\qt4\include/QtGui/qmime.h:154: warning: unused parameter 'item' E:\ecs\system\qt4\include/QtGui/qmime.h:154: warning: unused parameter 'itemIndex' E:\ecs\system\qt4\include/QtGui/qmime.h:156: warning: unused parameter 'type'
E:\ecs\system\qt4\include/QtGui/qmime.h:156: warning: unused parameter 'ext'
E:\ecs\system\qt4\include/QtGui/qmime.h:190: warning: unused parameter 'drf'
E:\ecs\system\qt4\include/QtGui/qmime.h:190: warning: unused parameter 'type'
E:\ecs\system\qt4\include/QtGui/qmime.h:190: warning: unused parameter 'ext'
E:\ecs\system\qt4\include/QtGui/qmime.h:213: warning: unused parameter 'isAccepted' E:\ecs\system\qt4\include/QtGui/qmime.h:289: warning: unused parameter 'mimeType' E:\ecs\system\qt4\include/QtGui/qmime.h:289: warning: unused parameter 'mimeData' E:\ecs\system\qt4\include/QtGui/qmime.h:291: warning: unused parameter 'info'

Note 2) Most errors seem to be related to printer/printing

    Perhaps some component are missing, and solution are related

Note 3) Discarding files with errors, we have a big lib:

    18/02/10 12:44a 2,792,960 124 a--- hbqtgui.lib

[...]


Dmitry response:
>>>>>========================
Okay, good. I would just change this part in hbdefs.h to the following:

   /* 28/03/2000 - [email protected]
      The same holds true when using GCC under OS/2
   */
   /* xx/02/2010 - [email protected]
      Include all OS/2 API definitions to make sure other involved parties
      (such as Qt for OS/2) will get everything they want
   */
   #define OS2EMX_PLAIN_CHAR
   #define INCL_BASE
   #define INCL_PM
   #include <os2.h>
   #undef INT
   #undef UINT
   #define HB_DONT_DEFINE_BASIC_TYPES

A new bunch of the errors from the .zip is indeed due to the missing printing support and missing accessibility support in Qt 4.5.1 for OS/2. For printing, there are three things you can do:

1. Add #ifndef QT_NO_PRINTER / #endif around the parts in the source code that use printing classes (QAbstractPrintDialog, QPageSetupDialog etc.) This btw will let it build on all platforms that don't provide printing support for some reason, not only OS/2.

2. Wait until the next release of Qt for OS/2 (4.6.1) is available. It will include printer support.

3. Check out the Qt4 source trunk from this site (which is already 4.6.1) and build Qt yourself.

As of accessibility, we may also provide a dummy implementation in 4.6.1, but it's not there yet, so you will have to do #ifndef QT_NO_ACCESSIBILITY / #endif around the places that complain about missing accessibility methods.

The warnings in qmime.h are known you may ignore them for now.
<<<<<<========================



Do you have plan to do it ? If so then I can wait for changes before to try a checkout/build of Qt

Dmitry response:
>>>>>========================
Yes, we decided to provide the dummy QAccessible implementation in 4.6.1. Which is to be released within about a week.
<<<<<<========================

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to