Skip to content

Qt5Core.dll built with absolute paths #5455

@claudiofantacci

Description

@claudiofantacci

This issue is a comeback from the closed issue #3248 about the same matter. Unfortunately, I can't reopen #3248 and I did not recieve any answer to my request to reopen it. Consequently, I'm creating a new issue and the PR #5456 to address it.

This is quite a long post, so let me write a tl;dr and a Detail section.

tl;dr

Qt5Core.dll is built by vcpkg with absolute hard-coded paths, including wrong ones. As a result, applications targeting Qt may silently fail at runtime or raise a runtime error.
You can currently workaround this issue with a qt.conf like this one

[Paths]
Prefix = C:/Users/cfantacci/vcpkg/installed/x64-windows
Documentation = share/qt5/doc
Headers = include
Libraries = lib
Binaries = tools/qt5
LibraryExecutables = tools/qt5
Plugins = plugins
Qml2Imports = qml
Data = share/qt5
ArchData = share/qt5
HostData = share/qt5
HostBinaries = tools/qt5

The permanent fix is to revert the reverted commit 473d63c#diff-ae2ab5cd22202159887c7d80ea952a4e.

Details

The problem is related to the use of Qt5, and in particular to Qt5Core.dll on Windows.
When I compile applications against Qt5 provided by vcpkg, my products either do not run or shows up with no icons. The reasons behind the failures are detailed in robotology/robotology-superbuild#134 (comment) by @traversaro. This issue was present in the past and I fixed in with #3280, that was partially reverted in 473d63c.

If you open the Qt5Core.dll with an hex-editor you will get something like the following list somewhere in the file:

qt_prfxpath=C:/Users/cfantacci/vcpkg/installed/x64-windows

...

C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/doc
include
lib
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/bin
bin
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/plugins
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/imports
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/qml
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/translations
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/examples
tests 

By my understanding, Qt expands qt_prfxpath with the other entries of the list. As a results, there are a lot of malformed paths and some Qt-based application will just fails to open, either silently or raising a runtime error.

Furhter, if I look at the directory C:\Users\cfantacci\vcpkg\packages\qt5-base_x64-windows I have

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        18-Dec-18     12:49                bin
d-----        18-Dec-18     12:49                debug
d-----        18-Dec-18     12:33                include
d-----        18-Dec-18     12:50                lib
d-----        18-Dec-18     12:50                plugins
d-----        18-Dec-18     12:50                share
d-----        18-Dec-18     12:49                tools
-a----        18-Dec-18     12:50             46 BUILD_INFO
-a----        18-Dec-18     12:50            331 CONTROL

for the directory C:\Users\cfantacci\vcpkg\packages\qt5-base_x64-windows\share

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        18-Dec-18     12:49                cmake
d-----        18-Dec-18     12:49                qt5
d-----        18-Dec-18     12:50                qt5-base

for the directory C:\Users\cfantacci\vcpkg\packages\qt5-base_x64-windows\share\qt5

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        18-Dec-18     12:32                debug
d-----        18-Dec-18     12:49                doc
d-----        18-Dec-18     12:49                mkspecs

and finally for the directory C:\Users\cfantacci\vcpkg\packages\qt5-base_x64-windows\share\qt5-base

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        13-Sep-18      6:25           8173 copyright

Looking back at our list, the following paths are wrong:

C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/imports
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/qml
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/translations
C:/Users/cfantacci/vcpkg/packages/qt5-base_x64-windows/share/qt5/examples

This issue can be workaround by the following qt.conf

[Paths]
Prefix = C:/Users/cfantacci/vcpkg/installed/x64-windows
Documentation = share/qt5/doc
Headers = include
Libraries = lib
Binaries = tools/qt5
LibraryExecutables = tools/qt5
Plugins = plugins
Qml2Imports = qml
Data = share/qt5
ArchData = share/qt5
HostData = share/qt5
HostBinaries = tools/qt5

that suggest to Qt-based applications, at runtime, the correct paths.

I think that the error lies in the following reverted paths: 473d63c#diff-ae2ab5cd22202159887c7d80ea952a4e. If I revert the reverted commit everything is back in place and the Qt5Core.dll is built with the following paths:

qt_prfxpath=C:/Users/cfantacci/vcpkg-test/installed/x64-windows

...

share/qt5/doc
include
lib
share/qt5/bin
bin
plugins
share/qt5/imports
qml
share/qt5
share/qt5/translations
share/qt5/examples
tests 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions