MinGW64 8.1 TKService

I was able to build 57 DLL's with MinGW64 except TKService

Any idea what the problem could be?
Thanks!

[ 37%] Linking CXX shared library ..\..\win32\gcc\bin\libTKService.dll
CMakeFiles\TKService.dir/objects.a(Font_FontMgr.cxx.obj):Font_FontMgr.cxx:(.text+0x4bc): undefined reference to `FT_New_Face'
CMakeFiles\TKService.dir/objects.a(Font_FontMgr.cxx.obj):Font_FontMgr.cxx:(.text+0x4de): undefined reference to `FT_Select_Charmap'
CMakeFiles\TKService.dir/objects.a(Font_FontMgr.cxx.obj):Font_FontMgr.cxx:(.text+0x4ed): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FontMgr.cxx.obj):Font_FontMgr.cxx:(.text+0x761): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x122): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x433): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x444): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x46b): undefined reference to `FT_Get_Kerning'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x50d): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x522): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x54d): undefined reference to `FT_Get_Kerning'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x5cf): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x5e4): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x60f): undefined reference to `FT_Get_Kerning'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xbcb): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xc47): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xd37): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xe38): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xf45): undefined reference to `FT_New_Memory_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xf60): undefined reference to `FT_Select_Charmap'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0xf8b): undefined reference to `FT_Set_Char_Size'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x106e): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x10c6): undefined reference to `FT_New_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x11c1): undefined reference to `FT_MulFix'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x11de): undefined reference to `FT_Set_Transform'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1760): undefined reference to `FT_Load_Char'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x17a8): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x186e): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x192e): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1943): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x196e): undefined reference to `FT_Get_Kerning'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1a0e): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1a23): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1a4e): undefined reference to `FT_Get_Kerning'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1abd): undefined reference to `FT_Load_Char'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1af8): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1bc4): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1c48): undefined reference to `FT_Load_Char'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1c98): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x1d64): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x2015): undefined reference to `FT_Done_Face'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x25b6): undefined reference to `FT_Load_Char'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x25e8): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTFont.cxx.obj):Font_FTFont.cxx:(.text+0x280e): undefined reference to `FT_Get_Char_Index'
CMakeFiles\TKService.dir/objects.a(Font_FTLibrary.cxx.obj):Font_FTLibrary.cxx:(.text+0x14): undefined reference to `FT_Done_FreeType'
CMakeFiles\TKService.dir/objects.a(Font_FTLibrary.cxx.obj):Font_FTLibrary.cxx:(.text+0x47): undefined reference to `FT_Done_FreeType'
CMakeFiles\TKService.dir/objects.a(Font_FTLibrary.cxx.obj):Font_FTLibrary.cxx:(.text+0x111): undefined reference to `FT_Init_FreeType'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\TKService\CMakeFiles\TKService.dir\build.make:1802: win32/gcc/bin/libTKService.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1830: src/TKService/CMakeFiles/TKService.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2

Kirill Gavrilov's picture

Linkage errors indicate that FreeType library (external dependency) is invalid or not properly configured. Check that 3RDPARTY_FREETYPE_LIBRARY / 3RDPARTY_FREETYPE_LIBRARY_DIR point to proper locations in your CMake configuration and that FreeType library was built using MinGW for the same architecture.

Daniel Duesentrieb's picture

I am using:

- Windows 10
- MinGW81
- OCCT 7.6.0
- freetype-2.6.3-mingw-64 (DLL copy to windows/ststem32) [https://dev.opencascade.org/system/files/occt/3rdparty/freetype-2.6.3-mi...
- tcltk-86-32 (tcltk-8.6.4-mingw-64 leads to an error right at the beginning) [https://dev.opencascade.org/system/files/occt/3rdparty/tcltk-86-32.zip]

I am following your instructions from https://www.youtube.com/watch?v=MBzu0xyUdJs

CMake config:

Info: TCL is used by OCCT
Found Tclsh: C:/Users/ballmer/Downloads/opencascade-additional/tcltk-86-32/bin/tclsh.exe (found version "8.6")
Info: TK is used from TCL folder: C:/Users/ballmer/Downloads/opencascade-additional/tcltk-86-32
Info: TK is used by OCCT
Info: FreeType is used by OCCT
Found Freetype: C:/Windows/System32/freetype.dll (found version "2.6.3")
Info: TKIVtk and TKIVtkDraw toolkits excluded due to VTK usage is disabled
Info: The directories of 3rdparty headers:
C:/Users/ballmer/Downloads/opencascade-additional/tcltk-86-32/include
C:/Users/ballmer/Downloads/opencascade-additional/freetype-2.6.3-mingw-64/include
Info: The directories of 3rdparty libraries:
C:/Users/ballmer/Downloads/opencascade-additional/tcltk-86-32/lib
C:/Users/ballmer/Downloads/opencascade-additional/freetype-2.6.3-mingw-64/lib

Info: (11:24:36) Start collecting all OCCT header files into C:/Users/ballmer/Downloads/opencascade-build/inc ...
Info: (11:24:36) Compare FILES with files in package directories...
Info: (11:24:38) Create header-links in inc folder...
Info: (11:25:05) Checking headers in inc folder...
Info: (11:25:05) End the collecting

bunch of warnings (ignoring like on the youtube video)
CMake Warning (dev) at adm/cmake/occt_toolkit.cmake:322 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.

Quoted variables like "CSF_OpenGlesLibs" will no longer be dereferenced
when the policy is set to NEW. Since the policy is not set the OLD
behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:14 (include)
src/TKViewerTest/CMakeLists.txt:3 (OCCT_INCLUDE_CMAKE_FILE)
This warning is for project developers. Use -Wno-dev to suppress it.

Info: (11:25:05) OCCT toolkits processed
Info: (11:25:05) OCCT configuration files prepared
Configuring done
Generating done

Still the same error. I am lost and after 2 days ready to smash the PC, but that wouldn't help so I am thinking about getting drunk lol

Also I tried to build freetype.dll (2.11.0 ) my self with MinGw. I can combile but all I get is a libfreetype.a file and I can not find any information how to produce a DLL

BTW: MSVC2019 works without problems. All MFC Samples are working

Daniel Duesentrieb's picture

To get freetype as a dll with mingw, in CMake add Entry:

BUILD_SHARED_LIBS = true

then

C:\mingw_w64\mingw32\bin\mingw32-make.exe PLATFORM=windows

this will produce a libFreetype.dll

Kirill Gavrilov's picture

C:\mingw_w64\mingw32

- MinGW81

I'm curious, how did you installed MinGW64? Last time I've tried I haven't found any up-to-date installation package for MinGW64 only and have to installed it through MSys2, but in that case you would have a different folders hierarchy.

Tip: use "Insert Code Snippet" in post editor to share your logs in readable way.

- freetype-2.6.3-mingw-64 (DLL copy to windows/ststem32)

This is a very bad idea to copy anything into "system32" folder - it may ruin your system / break some applications.

Daniel Duesentrieb's picture

I don't remember where I downloaded MinGW anymore.

It also comes with QT5 in the folder Tools. I attached the install

Thanks for the tips about the system32 folder and I agree - but I was desperate hahaha

Attachments: 
Kirill Gavrilov's picture

I'm asking because it seems that you are using MinGW64 targeting legacy 32-bit hosts. This doesn't make sense nowadays, as it is better targeting 64-bit hosts in all aspects (performance, compatibility, working with large models), as long as you don't have specific requirements to deal with obsolete 32-bit systems.

Your building errors also come from this difference, as FreeType and Tcl/Tk libraries downloaded from OCCT portal are built for 64-bit binaries - that's why they failed with your building toolchain.

Daniel Duesentrieb's picture

It was my intention to build 64bit of course. So you're saying I compile 32bit libs?

Daniel Duesentrieb's picture

Hallelujah - it is working now!!

Daniel Duesentrieb's picture

I was celebrating too early:

Those are the errors I get with the new libraries:

:-1: error: skipping incompatible C:\Users\username\Documents\QtProjects\windows\GabbieCam\Shared_External\opencascade-7.6.0\win64\gcc\bin/libTKBin.dll when searching for -lTKBin
:-1: error: skipping incompatible C:\Users\username\Documents\QtProjects\windows\GabbieCam\Shared_External\opencascade-7.6.0\win64\gcc\lib/libTKBin.dll.a when searching for -lTKBin
:-1: error: skipping incompatible C:\Users\username\Documents\QtProjects\windows\GabbieCam\Shared_External\opencascade-7.6.0\win64\gcc\bin/libTKBin.dll when searching for -lTKBin
:-1: error: skipping incompatible C:\Users\username\Documents\QtProjects\windows\GabbieCam\Shared_External\opencascade-7.6.0\win64\gcc\lib/libTKBin.dll.a when searching for -lTKBin
:-1: error: cannot find -lTKBin

... and so on for all the DLL

This is working (application.pro):

INCLUDEPATH +=  ../Shared_External\opencascade-7.5.0\inc
LIBS += -L$$PWD/../Shared_External\opencascade-7.5.0\win64\gcc\bin
LIBS += -L$$PWD/../Shared_External\opencascade-7.5.0\win64\gcc\lib

LIBS += -lTKernel -lTKMath -lTKService -lTKV3d -lTKOpenGl  -lTKBRep -lTKIGES -lTKSTL -lTKVRML -lTKSTEP -lTKSTEPAttr -lTKSTEP209
LIBS += -lTKSTEPBase -lTKGeomBase -lTKGeomAlgo -lTKG3d -lTKG2d -lTKXSBase -lTKShHealing -lTKHLR -lTKTopAlgo -lTKMesh -lTKPrim
LIBS += -lTKCDF -lTKBool -lTKBO -lTKFillet -lTKOffset -lTKLCAF

And this gives me the error (application.pro):

INCLUDEPATH +=  ../Shared_External/opencascade-7.6.0\inc
LIBS += -L$$PWD/../Shared_External/opencascade-7.6.0\win64\gcc\bin
LIBS += -L$$PWD/../Shared_External/opencascade-7.6.0\win64\gcc\lib

LIBS += -lTKBin -lTKBinL -lTKBinTObj -lTKBO -lTKBool -lTKBRep -lTKCAF -lTKCDF -lTKernel -lTKFeat -lTKFillet -lTKG2d
LIBS += -lTKG3d -lTKGeomAlgo -lTKGeomBase -lTKHLR -lTKIGES -lTKLCAF -lTKMath -lTKMesh -lTKOffset -lTKPrim -lTKShHealing
LIBS += -lTKStd -lTKStdL -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKSTL -lTKTObj -lTKTopAlgo -lTKXMesh -lTKXml
LIBS += -lTKXmlL -lTKXmlTObj -lTKXSBase
  • I am using QT5.15.2
  • I was compiling the libraries with C:\Qt5.15.2\5.15.2\mingw81_64\bin.

How can be the libraries be incompatible when I use the same compiler for creating the libs and running the app?

EDIT:

just checked the dll:

.\sigcheck.exe .\libTKBin.dll

C:\Users\username\Desktop\libTKBin.dll:
        Verified:       Unsigned
        Link date:      5:18 PM 2021-12-07
        Publisher:      n/a
        Company:        n/a
        Description:    n/a
        Product:        n/a
        Prod version:   n/a
        File version:   n/a
        MachineType:    32-bit
PS C:\Users\username\Desktop>

It is a 32-Bit, you was right - like always...

Attachments: 
Daniel Duesentrieb's picture

Installed the 64 version over msys. Made a hello world program, tested it and checked with sigcheck and it is a 64-bit exe. Path is ist correct Then I started cmake from scratch, config no errors. Generate OK. into the build folder and type 'mingw32-make.exe' starts compiling but stops with a new error:

[  2%] Building CXX object src/TKernel/CMakeFiles/TKernel.dir/__/Message/Message_ProgressIndicator.cxx.obj
[  2%] Building CXX object src/TKernel/CMakeFiles/TKernel.dir/__/Message/Message_Report.cxx.obj
[  3%] Linking CXX shared library ..\..\win64\gcc\bin\libTKernel.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `_CRT_INIT':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:130: undefined reference to `_execute_onexit_table'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `pre_c_init':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:64: undefined reference to `_initialize_onexit_table'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `atexit':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:206: undefined reference to `_register_onexit_function'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0xdc): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0x194): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0x2d7): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text$_Z6printfPKcz[_Z6printfPKcz]+0x2a): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(Standard_CString.cxx.obj):Standard_CString.cxx:(.text+0xf9): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o): in function `__report_error':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c:150: undefined reference to `__acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c:151: undefined reference to `__acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-mingw_vfprintf.o): in function `__mingw_vfprintf':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/stdio/mingw_vfprintf.c:53: undefined reference to `_lock_file'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/stdio/mingw_vfprintf.c:55: undefined reference to `_unlock_file'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\TKernel\CMakeFiles\TKernel.dir\build.make:2394: win64/gcc/bin/libTKernel.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1159: src/TKernel/CMakeFiles/TKernel.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2
Daniel Duesentrieb's picture
  • I had to switch from tcltk-8.6.4-mingw-64 to tcltk-86-32 and then it worked until TKDraw.
  • I restarted the make process with the parameter 'i' (ignore errors) and it finised all others except TKDraw.
  • Checked, all libs are 64bit
  • copied freetype.dll from freetype-2.6.3-mingw-64 to the same folder where the TK-dll's are
  • clean / refrbuild in QT5 - no errors!!!

start the app and this happen now

15:59:18: The program has unexpectedly finished.
15:59:18: The process was ended forcefully.

Debugging does not happen. crashes even before it comes to the main function. This usually happens when a DLL is missing.

I made sure only to load the DLL I really need. still the same.

no idea what to do now. Thanks

Daniel Duesentrieb's picture

I made a minimalistic QT5 project and tried to load the DLL's:

QString fileName760 = "../Shared_External/opencascade-7.6.0/win64/gcc/bin/libTKernel.dll";
QString fileName750 = "../Shared_External/opencascade-7.5.0/win64/gcc/bin/libTKernel.dll";

QFileInfo fileInfo760(fileName760);
qDebug() << "fileName760 exists" << fileInfo760.exists();
QFileInfo fileInfo750(fileName750);
qDebug() << "fileName750 exists" << fileInfo750.exists();

QLibrary lib760(fileName760);
lib760.load();
qDebug() << "lib760.isLoaded" <<lib760.isLoaded();
QLibrary lib750(fileName750);
lib750.load();
qDebug() << "lib750.isLoaded" << lib750.isLoaded();

The outcome is

fileName760 exists true
fileName750 exists true
lib760.isLoaded false
lib750.isLoaded true

The new DLL can be found but not be loaded.

Also freetype.dll is 64bit and can be loaded.

Just did a build again with

C:\Qt5.15.2\Tools\mingw810_64\bin\mingw32-make.exe

it produces a  64bit

sigcheck.exe ./libTKernel.dll

opencascade-build\win64\gcc\bin\libTKernel.dll:
        Verified:       Unsigned
        Link date:      4:57 PM 2021-12-08
        Publisher:      n/a
        Company:        n/a
        Description:    n/a
        Product:        n/a
        Prod version:   n/a
        File version:   n/a
        MachineType:    64-bit

Still not able to load

 .\dumpbin.exe /dependents opencascade-7.6.0\win64\gcc\bin\libTKernel.dll

File Type: DLL

  Image has the following dependencies:

    ADVAPI32.dll
    KERNEL32.dll
    msvcrt.dll
    USER32.dll
    WSOCK32.dll
    libgcc_s_seh-1.dll
    libstdc++-6.dll

  Summary

        1000 .CRT
        D000 .bss
        2000 .data
       2D000 .edata
        4000 .idata
        A000 .pdata
       C8000 .rdata
        2000 .reloc
       AA000 .text
        1000 .tls          
 .\dumpbin.exe /dependents opencascade-7.5.0\win64\gcc\bin\libTKernel.dll

File Type: DLL

  Image has the following dependencies:

    ADVAPI32.dll
    libgcc_s_seh-1.dll
    KERNEL32.dll
    msvcrt.dll
    PSAPI.DLL
    USER32.dll
    WSOCK32.dll
    libstdc++-6.dll

  Summary

        1000 .CRT
        E000 .bss
        1000 .data
       2B000 .edata
        4000 .idata
        A000 .pdata
       C3000 .rdata
        1000 .reloc
       AA000 .text
        1000 .tls
       12000 .xdata

Other then the order of the depended DLL's they are the same

Kirill Gavrilov's picture
QLibrary lib760(fileName760);
lib760.load();
qDebug() << "lib760.isLoaded" <<lib760.isLoaded();

I guess QLibrary is not very helpful to get the reasons why library cannot be loaded. You may try my small tool checkdll or classical "depends" to get more details why library cannot be loaded (like missing or broken dependencies - FreeType, libgcc_s_seh-1.dll, etc.).

Daniel Duesentrieb's picture

Kirill, first a big thank you for not giving up on me and thanks for the tools!

I tried

.\checkDLL64.exe ..\Shared_External\opencascade-7.6.0\win64\gcc\bin

Outcome:

"freetype.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  freetype.dll not found!
"libTKBin.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBin.dll not found!
"libTKBinL.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBinL.dll not found!
"libTKBinTObj.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBinTObj.dll not found!
"libTKBinXCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBinXCAF.dll not found!
"libTKBO.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBO.dll not found!
"libTKBool.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBool.dll not found!
"libTKBRep.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKBRep.dll not found!
"libTKCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKCAF.dll not found!
"libTKCDF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKCDF.dll not found!
"libTKDCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKDCAF.dll not found!
"libTKernel.dll" Loading... Success!
"libTKFeat.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKFeat.dll not found!
"libTKFillet.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKFillet.dll not found!
"libTKG2d.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKG2d.dll not found!
"libTKG3d.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKG3d.dll not found!
"libTKGeomAlgo.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKGeomAlgo.dll not found!
"libTKGeomBase.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKGeomBase.dll not found!
"libTKHLR.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKHLR.dll not found!
"libTKIGES.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKIGES.dll not found!
"libTKLCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKLCAF.dll not found!
"libTKMath.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKMath.dll not found!
"libTKMesh.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKMesh.dll not found!
"libTKMeshVS.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKMeshVS.dll not found!
"libTKOffset.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKOffset.dll not found!
"libTKOpenGl.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKOpenGl.dll not found!
"libTKOpenGlTest.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKOpenGlTest.dll not found!
"libTKPrim.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKPrim.dll not found!
"libTKQADraw.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKQADraw.dll not found!
"libTKRWMesh.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKRWMesh.dll not found!
"libTKService.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKService.dll not found!
"libTKShHealing.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKShHealing.dll not found!
"libTKStd.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKStd.dll not found!
"libTKStdL.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKStdL.dll not found!
"libTKSTEP.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKSTEP.dll not found!
"libTKSTEP209.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKSTEP209.dll not found!
"libTKSTEPAttr.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKSTEPAttr.dll not found!
"libTKSTEPBase.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKSTEPBase.dll not found!
"libTKSTL.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKSTL.dll not found!
"libTKTObj.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKTObj.dll not found!
"libTKTObjDRAW.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKTObjDRAW.dll not found!
"libTKTopAlgo.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKTopAlgo.dll not found!
"libTKTopTest.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKTopTest.dll not found!
"libTKV3d.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKV3d.dll not found!
"libTKVCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKVCAF.dll not found!
"libTKVRML.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKVRML.dll not found!
"libTKXCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXCAF.dll not found!
"libTKXDEDRAW.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXDEDRAW.dll not found!
"libTKXDEIGES.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXDEIGES.dll not found!
"libTKXDESTEP.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXDESTEP.dll not found!
"libTKXMesh.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXMesh.dll not found!
"libTKXml.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXml.dll not found!
"libTKXmlL.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXmlL.dll not found!
"libTKXmlTObj.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXmlTObj.dll not found!
"libTKXmlXCAF.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXmlXCAF.dll not found!
"libTKXSBase.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXSBase.dll not found!
"libTKXSDRAW.dll" Loading... FAILED!
  Error #126: The specified module could not be found!
  libTKXSDRAW.dll not found!
Press any key to continue . . .

locks bad, but there is hope:

"libTKernel.dll" Loading... Success!

Hope that is a clue BUT I have the same result when I test with the 7.5.0 libs and they work for me in my software :(

I wrote above that I had to change from

tcltk-8.6.4-mingw-64

to

tcltk-86-32

in order to get libTKernel.dll compiled. I was assuming to use the 64 bit version but that didn't work.

Here the error again with

  • freetype-2.6.3-mingw-64
  • tcltk-8.6.4-mingw-64
[  2%] Building CXX object src/TKernel/CMakeFiles/TKernel.dir/__/Message/Message_Report.cxx.obj
[  3%] Linking CXX shared library ..\..\win64\gcc\bin\libTKernel.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `_CRT_INIT':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:130: undefined reference to `_execute_onexit_table'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `pre_c_init':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:64: undefined reference to `_initialize_onexit_table'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o: in function `atexit':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:206: undefined reference to `_register_onexit_function'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0xdc): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0x194): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text+0x2d7): undefined reference to `strdup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(OSD_PerfMeter.cxx.obj):OSD_PerfMeter.:(.text$_Z6printfPKcz[_Z6printfPKcz]+0x2a): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\TKernel.dir/objects.a(Standard_CString.cxx.obj):Standard_CString.cxx:(.text+0xf9): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o): in function `__report_error':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c:150: undefined reference to `__acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c:151: undefined reference to `__acrt_iob_func'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-mingw_vfprintf.o): in function `__mingw_vfprintf':
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/stdio/mingw_vfprintf.c:53: undefined reference to `_lock_file'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/stdio/mingw_vfprintf.c:55: undefined reference to `_unlock_file'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\TKernel\CMakeFiles\TKernel.dir\build.make:2394: win64/gcc/bin/libTKernel.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1159: src/TKernel/CMakeFiles/TKernel.dir/all] Error 2
mingw32-make: *** [Makefile:135: all] Error 2

just saw that at the end of the error:

C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/stdio/mingw_vfprintf.c

There is no C:/M/ folder on my drive ?!

Additional info: I did not download the code from git but from here: https://dev.opencascade.org/system/files/occt/OCC_7.6.0_release/opencasc...

Daniel Duesentrieb's picture

Please see my screenshot with 2 x depends open with libTKerner.dll open on both.
On the left the (functioning) 7.5.0 and on the right 7.6.0

libTKernel can be loaded by your checkDLL64, libTKService can not be loaded

The only difference I can is is that LIBSTDC++-6.DLL doesn't have the red icon on 7.6.0 like it has on 7.5.0.

Daniel Duesentrieb's picture

I just tried to rebuild 7.5.0 with no look. I get the same problem: can't load the lib.

I don't remember how I made the last set but I did somehow.

attached 2 x libTKernerl.dll from 7.5.0: one is working/loading, the other is not. Maybe you can find something.

Attachments: 
Daniel Duesentrieb's picture

I downloaded QT5.15.1 (that is what I had when I made the functioning lib's 7.5.0) just in case the MinGW version would be different and compiled the libraries again. They all don't load and also have a different file size. I must have made something different and I don't know/remember what.

What I still not understand: Why do I have to use tcltk-86-32 and not tcltk-8.6.4-mingw-64 to get libTKernel.dll going?

In fact, with tcltk-8.6.4-mingw-64  and C:\Qt5.15.2\Tools\mingw810_64\bin\mingw32-make.exe -i (ignore errors) not one single dll but all lib will be compiled.

Daniel Duesentrieb's picture

I just remember: wasn't there a switch somewhere to decide if QT4 or QT5?

Daniel Duesentrieb's picture

Problem solved:

added this https://packages.msys2.org/package/mingw-w64-x86_64-opencascade?repo=min... and copied all DLL's in the folder /mingw64/bin to my folder and the app is finally starting now.

replaced all libTKxxx.dll with 7.6.0 dll's and this is working now as well.