Opened 4 years ago

Last modified 4 years ago

#312 new defect

Path separators broken in qmake.conf when compiling via rpmbuild

Reported by: Alex Taylor Owned by:
Priority: minor Milestone:
Component: qmake Version: 4.7.3
Severity: low Keywords: qmake shell rpmbuild
Cc:

Description

This is an informational ticket, as Qt4 is no longer maintained.

I ran into this trying to run a Qt4 compile under rpmbuild.

"e:/usr/share/qt4/mkspecs/os2-g++"\runmapsym.cmd mapsym qe.map qe.sym
/@unixroot/usr/bin/sh.exe: 1: e:/usr/share/qt4/mkspecs/os2-g++runmapsym.cmd: not
 found
make: *** [qe.exe] Error 127
error: Bad exit status from /@unixroot/var/tmp/rpm-tmp.dU9en5 (%build)

The problem is that \usr\share\qt4\mkspecs\os2-g++\qmake.conf defines

ilink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)\\runmapsym.cmd \
    mapsym $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE
wlink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)\\runmapsym.cmd \
    $(QMAKESPECDIR)\\wmapsym.cmd $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE

which works fine when run from a normal CMD prompt, but the "
" breaks when run under the Unix shell used by rpmbuild.

Another problem is that the DEL_FILE variable resolves to the "del" command which, again, works under CMD but not in rpmbuild. In this case, there's a conditional check for the variable QMAKE_SH which is supposed to handle this, but it seems that QMAKE_SH is never true.

I have addressed both of these problems by modifying qmake.conf as follows:

  1. Add the line:

QMAKE_SH = $$(QMAKE_SHELL)

  1. Replace the mapsym lines with the following:
    !isEmpty(QMAKE_SH) {
        ilink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)/runmapsym.cmd \
            mapsym $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE
        wlink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)/runmapsym.cmd \
            $(QMAKESPECDIR)/wmapsym.cmd $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE
    } else {
        ilink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)\\runmapsym.cmd \
            mapsym $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE
        wlink:QMAKE_RUN_MAPSYM  = $(QMAKESPECDIR)\\runmapsym.cmd \
            $(QMAKESPECDIR)\\wmapsym.cmd $$QMAKE_MAP_FILE $$QMAKE_SYM_FILE
    }
    
  1. Define QMAKE_SHELL=[path\]sh.exe in the environment.

I will attach the modified qmake.conf here, for the benefit of anyone who encounters this issue in the future.

Attachments (1)

qmake.conf (6.7 KB ) - added by Alex Taylor 4 years ago.
Modified qmake.conf (to replace existing %UNIXROOT%\usr\share\qt4\mkspecs\os2-g++\qmake.conf ) - updated

Download all attachments as: .zip

Change History (4)

by Alex Taylor, 4 years ago

Attachment: qmake.conf added

Modified qmake.conf (to replace existing %UNIXROOT%\usr\share\qt4\mkspecs\os2-g++\qmake.conf ) - updated

comment:1 by Alex Taylor, 4 years ago

It quickly occurred to me that it's much more logical to piggyback on one of the shell environment that rpmbuild already defines.

i.e.

QMAKE_SH = $$(MAKESHELL)

As this is not normally defined in my environment, building Qt4 apps works both inside and outside rpmbuild, and I don't have to manually set something like QMAKE_SHELL before running rpmbuild.

Attached qmake.conf updated.

comment:2 by Dmitry A. Kuminov, 4 years ago

IIRC Qt4 makefiles (and the OS/2 backend for qmake) were specifically tailored for CMD.EXE on OS/2. I.e. Posix shells are not supported at all. In Qt5 we went a different way and fully support the Posix shell and don't support CMD.EXE. This simplified porting quite a bit by reducing the differences between *nix and OS/2.

If you want to change that for Qt4, I'm ready to accept the patch but please try to build the whole Qt4 in this mode (both release and debug) to make sure there are no regressions.

comment:3 by Silvan Scherrer, 4 years ago

this was already discussed in #303 and the fixed qmake.conf is there as well :)

Note: See TracTickets for help on using tickets.