CQtDeployer icon indicating copy to clipboard operation
CQtDeployer copied to clipboard

Can't add some extra libraries to the application

Open kartaris opened this issue 3 years ago • 16 comments

I have a problem to start my application on Windows because it needs libEGL, libGLESv2 and d3dcompiler libraries(the screenshot below).

image

I tried to add them myself. Just copied them to the application folder and application started.

The problem: I haven't found correct way to add libraries(libEGL, libGLESv2, d3dcompiler*) as extra libraries. I used commands like(with many variations):

  • cqtdeployer deploySystem extractPlugins -extraLibs EGL,GLESv2,d3dcompiler -bin $${BINPATH} -qmake $${QMAKE_EXECUTABLE} -qmlDir $${QMLPATH} -targetDir $${TARGETDIR} clear
  • cqtdeployer deploySystem extractPlugins -extraLibs EGL,GLESv2,d3dcompiler,libEGL,libGLESv2,d3dcompiler_47,egl,glesv2,libegl,libglesv2 -bin $${BINPATH} -qmake $${QMAKE_EXECUTABLE} -qmlDir $${QMLPATH} -targetDir $${TARGETDIR} clear
  • cqtdeployer deploySystem extractPlugins -libDir $${PATHTOLIBS} -extraLibs EGL,GLESv2,d3dcompiler,libEGL,libGLESv2,d3dcompiler_47,egl,glesv2,libegl,libglesv2 -bin $${BINPATH} -qmake $${QMAKE_EXECUTABLE} -qmlDir $${QMLPATH} -targetDir $${TARGETDIR} clear

Non of them helped. Also I tried adding path to to the libraries by setting PATH variable(just for the cqtdeployer's command session) and it doesn't work too. I don't know if there is a bug but it looks like a bug.

PS: HanoiTowers application can't start on my PC because of the same problem.

kartaris avatar Feb 19 '21 08:02 kartaris

hmm. show me please your DistributionKit folder and what version are you using?

EndrII avatar Feb 19 '21 09:02 EndrII

Forgot to add information about toolkit. I use Qt 5.15.2 MinGW 32-bit. And cqtdeployer 1.5

kartaris avatar Feb 19 '21 09:02 kartaris

You can install opengl driver in your PC. it is should be resolve you trouble.

i faced similar problem,

The main solution to the problem is to install the driver. The described libraries in the message are stubs that simply redirect gl requests to the processor and "angle" windows driver. If you are using qml as the QML inside a QQuickWidget then most likely you will need to use a driver anyway. Throwing in these libraries can only help if you are using a pure qml application without the Widgets wrapper.

As for the fact that the distribution does not have these libraries, then this is a bug of the cqtdeployer, I will double-check their availability now. If we confirm that they were not added, we will correct it.

EndrII avatar Feb 19 '21 09:02 EndrII

@kartaris yes. I am confirm this is a bug of The CQtdeployer.

Trouble in the parsing pe files. I think than The CQtDeployer do not search delay-loaded libraries.

@pzhlkj6612 maybe you know how to parse PE delay-loaded libraries?

EndrII avatar Feb 19 '21 09:02 EndrII

@EndrII Oh. I thought extraLibs key should search libraries in environment paths. Just checking the name pattern and arch compatibility.

kartaris avatar Feb 19 '21 13:02 kartaris

@EndrII Oh. I thought extraLibs key should search libraries in environment paths. Just checking the name pattern and arch compatibility.

No The extraLibs option allows you to copy the required system libraries with an appropriate name.

Provided that they are required for your application.

The error lies in the fact that the PE parser could not determine the dependencies due to the fact that they are loaded deferred with the first call of their functions and not at the start of the application.

If you want to force copy this libs use the bin option or the extraData option example

cqtdeployer -bin my.exe,path/to/EGL.dll,path/to/GLESv2.dll,path/to/d3dcompiler_47.dll

or

cqtdeployer  -bin my.exe -extraData path/to/EGL.dll,path/to/GLESv2.dll,path/to/d3dcompiler_47.dll -extraDataOut path/myLibraryDir

The extraDataOut option is optional because The Windows distribution kit collect libraries in to root folder.

EndrII avatar Feb 19 '21 13:02 EndrII

@EndrII Oh. I thought extraLibs key should search libraries in environment paths. Just checking the name pattern and arch compatibility.

No The extraLibs option allows you to copy the required system libraries with an appropriate name.

Provided that they are required for your application.

The error lies in the fact that the PE parser could not determine the dependencies due to the fact that they are loaded deferred with the first call of their functions and not at the start of the application.

If you want to force copy this libs use the bin option or the extraData option example

cqtdeployer -bin my.exe,path/to/EGL.dll,path/to/GLESv2.dll,path/to/d3dcompiler_47.dll

or

cqtdeployer  -bin my.exe -extraData path/to/EGL.dll,path/to/GLESv2.dll,path/to/d3dcompiler_47.dll -extraDataOut path/myLibraryDir

The extraDataOut option is optional because The Windows distribution kit collect libraries in to root folder.

Great! I will use the solution as a temporary hack.

kartaris avatar Feb 19 '21 14:02 kartaris

@kartaris Thanks you for bug report.

EndrII avatar Feb 19 '21 14:02 EndrII

maybe you know how to parse PE delay-loaded libraries?

Well, for now I have no idea about that.

pzhlkj6612 avatar Feb 19 '21 14:02 pzhlkj6612

maybe you know how to parse PE delay-loaded libraries?

Well, for now I have no idea about that.

when i'm free from other projects i will take on this task

EndrII avatar Feb 19 '21 14:02 EndrII

maybe you know how to parse PE delay-loaded libraries?

@EndrII Hi. Did you inspect the dependency tree of that program which needs the three dlls (EGL.dll GLESv2.dll d3dcompiler_47.dll) with lucasg/Dependencies ? Are they all delay-loaded?

pzhlkj6612 avatar Feb 22 '21 03:02 pzhlkj6612

maybe you know how to parse PE delay-loaded libraries?

@EndrII Hi. Did you inspect the dependency tree of that program which needs the three dlls (EGL.dll GLESv2.dll d3dcompiler_47.dll) with lucasg/Dependencies ? Are they all delay-loaded?

No, but I have encountered this problem in webengine before, I even had to hardcode these cqtdeployer libraries so that they would be copied into the distribution, provided that the program depends on webengine. Then I decided that they are loaded as plugins and are not marked anywhere in the Dll. Now I understand that PE has delay load libraryes and they are marked somewhere in the PE file, unlike classic plugins.

EndrII avatar Feb 22 '21 06:02 EndrII

Maybe you mean "run-time load library" instead of "delay-loaded library"?

As Linker support for delay-loaded DLLs | Microsoft Docs said, delay-loading uses the technology of run-time loading, and they are not the same.

pzhlkj6612 avatar Feb 22 '21 07:02 pzhlkj6612

i mean that the run-time load library is plugin and delay-loaded library is run-time load library that marked in the import table and possible to the extract from PE file. Microsoft docs have a instruction for extracting list of delay-loaded libraries

EndrII avatar Feb 22 '21 07:02 EndrII

Yes, "DUMPBIN" can do this work.

pzhlkj6612 avatar Feb 22 '21 07:02 pzhlkj6612

Yes, "DUMPBIN" can do this work.

DUMPBIN uses system function of the window, it sucks because it breaks our parsing on Linux and the planned Mac OS.

We need to use the PE parser lib for this. See PE-parser issue

EndrII avatar Feb 22 '21 08:02 EndrII

@kartaris On the new cqtdeployer you can add custom dependencies manually. Using the extraDepends option it should solve this issue. So I close it.

EndrII avatar Aug 15 '23 07:08 EndrII