OCCT 7.0/7.1 :When compiling on mingw64 symbols missing in libTKV3d.dll

Hi, I'm committed to using Msys2/mingw64 as a preferred toolchain and I am verry happy to see OCCT7.0 and 7.1 compile easily now.

I compiled the release versions: opencascade-7.0.0.tgz and opencascade-7.1.0.tgz with no problems.

But, when I try to use these libs I get hard to debug errors like

error while loading shared libraries: ? : cannot open shared object file: No such file or directory

The ? is no mistake, there is no mention of a misplaced dll.

On a hunch I did "ldd libTKV3d.dll" and this is the output:

 

MINGW64-OCCT-7.0.0

$ ldd libTKV3d.dll
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffd7c410000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffd7be40000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffd79020000)
        ??? => ??? (0x6f340000)
        ??? => ??? (0x7ffd79a70000)
        ??? => ??? (0x67740000)
        ??? => ??? (0x63800000)
        ??? => ??? (0x69a80000)
        ??? => ??? (0x7ffd7b500000)
        ??? => ??? (0x7ffd7bef0000)
        ??? => ??? (0x70180000)
        ??? => ??? (0x6eb40000)
        ??? => ??? (0x7ffd7b800000)
        ??? => ??? (0x7ffd7b1b0000)
        ??? => ??? (0x68b80000)
        ??? => ??? (0x7ffd7b860000)
        ??? => ??? (0x7ffd79240000)
        ??? => ??? (0x67440000)
        ??? => ??? (0x65440000)
        ??? => ??? (0x7ffd7b780000)
        ??? => ??? (0x7ffd79910000)
        ??? => ??? (0x6a900000)
        ??? => ??? (0x7ffd7b610000)
        ??? => ??? (0x6c480000)
        ??? => ??? (0x7ffd796d0000)
        ??? => ??? (0x7ffd79390000)
        ??? => ??? (0x69d80000)
        ??? => ??? (0x7ffd7b990000)
        ??? => ??? (0x7ffd7c3d0000)
        ??? => ??? (0x65ac0000)
        ??? => ??? (0x7ffd79780000)
        ??? => ??? (0x7ffd79b70000)
        ??? => ??? (0x7ffd79340000)
        ??? => ??? (0x61440000)
        ??? => ??? (0x6fc40000)
        ??? => ??? (0x7ffd788e0000)
        ??? => ??? (0x7ffd78880000)
        ??? => ??? (0x7ffd78850000)
        ??? => ??? (0x7ffd78860000)
        ??? => ??? (0x7ffd741d0000)
        ??? => ??? (0x7ffd74a90000)
        ??? => ??? (0x7ffd6b330000)
        ??? => ??? (0x7ffd7b5a0000)

 

I went back and checked an older version I compiled from git last year ( april 16 2016) .

My app works again with the error I mentioned earlier and the "ldd libTKV3d.dll" looks a lot more promising:

MINGW64-OCCT-git-160416
branch:[master]
$ ldd libTKV3d.dll
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffd7c410000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffd7be40000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffd79020000)
        ConEmuHk64.dll => /c/Program Files/ConEmu/ConEmu/ConEmuHk64.dll (0x7e110000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7ffd7b610000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7ffd79390000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7ffd7c3d0000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7ffd79780000)
        IMM32.DLL => /c/WINDOWS/System32/IMM32.DLL (0x7ffd79980000)
        comdlg32.dll => /c/WINDOWS/System32/comdlg32.dll (0x7ffd79a70000)
        libTKBRep.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKBRep.dll (0x67740000)
        libTKG2d.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKG2d.dll (0x69a80000)
        libTKernel.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKernel.dll (0x63800000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffd7b500000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ffd7bef0000)
        combase.dll => /c/WINDOWS/System32/combase.dll (0x7ffd7b1b0000)
        libTKG3d.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKG3d.dll (0x70180000)
        libTKGeomAlgo.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKGeomAlgo.dll (0x6eb40000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ffd7b800000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffd79240000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffd7b860000)
        libTKGeomBase.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKGeomBase.dll (0x68b80000)
        libTKHLR.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKHLR.dll (0x67440000)
        bcryptPrimitives.dll => /c/WINDOWS/System32/bcryptPrimitives.dll (0x7ffd79910000)
        PSAPI.DLL => /c/WINDOWS/System32/PSAPI.DLL (0x7ffd7b780000)
        libTKMath.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKMath.dll (0x65440000)
        libTKMesh.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKMesh.dll (0x6a900000)
        shcore.dll => /c/WINDOWS/System32/shcore.dll (0x7ffd796d0000)
        libTKService.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKService.dll (0x6c480000)
        libTKShHealing.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKShHealing.dll (0x69d80000)
        SHLWAPI.dll => /c/WINDOWS/System32/SHLWAPI.dll (0x7ffd7b990000)
        libTKTopAlgo.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libTKTopAlgo.dll (0x65ac0000)
        SHELL32.dll => /c/WINDOWS/System32/SHELL32.dll (0x7ffd79b70000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x61440000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x6fc40000)
        cfgmgr32.dll => /c/WINDOWS/System32/cfgmgr32.dll (0x7ffd79340000)
        windows.storage.dll => /c/WINDOWS/System32/windows.storage.dll (0x7ffd788e0000)
        powrprof.dll => /c/WINDOWS/System32/powrprof.dll (0x7ffd78880000)
        kernel.appcore.dll => /c/WINDOWS/System32/kernel.appcore.dll (0x7ffd78850000)
        profapi.dll => /c/WINDOWS/System32/profapi.dll (0x7ffd78860000)
        WSOCK32.dll => /c/WINDOWS/SYSTEM32/WSOCK32.dll (0x7ffd6b330000)
        WINSPOOL.DRV => /c/WINDOWS/SYSTEM32/WINSPOOL.DRV (0x7ffd74a90000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ffd7b5a0000)
        libfreetype-6.dll => /d/R102-occ-devenv/unpack/MINGW64-OCCT-git-160416/bin/libfreetype-6.dll (0x693c0000)
        COMCTL32.dll => /c/WINDOWS/WinSxS/amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.14393.447_none_0d5aa7fbb6d35646/COMCTL32.dll (0x7ffd741d0000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x64940000)
        bcrypt.dll => /c/WINDOWS/SYSTEM32/bcrypt.dll (0x7ffd78430000)
        libbz2-1.dll => /mingw64/bin/libbz2-1.dll (0x626c0000)
        libharfbuzz-0.dll => /mingw64/bin/libharfbuzz-0.dll (0x61600000)
        libpng16-16.dll => /mingw64/bin/libpng16-16.dll (0x68b40000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x62e80000)
        libglib-2.0-0.dll => /mingw64/bin/libglib-2.0-0.dll (0x685c0000)
        libgraphite2.dll => /mingw64/bin/libgraphite2.dll (0x70540000)
        ole32.dll => /c/WINDOWS/System32/ole32.dll (0x7ffd7bb90000)
        WINMM.dll => /c/WINDOWS/SYSTEM32/WINMM.dll (0x7ffd76a60000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x61cc0000)
        WINMMBASE.dll => /c/WINDOWS/SYSTEM32/WINMMBASE.dll (0x7ffd76a30000)
        libpcre-1.dll => /mingw64/bin/libpcre-1.dll (0x69140000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x66000000)

So to me this looks like a snafu somewhere.

 

Forum supervisor's picture

Dear Sander,

Thanks for your comment about easy OCCT7.0 and 7.1 compilation.

“I went back and checked an older version I compiled from git last year ( april 16 2016) .”

This version was before C++ type system redesign in OCCT.
OCCT 7.0.0+ requires C++11 compliant compiler - therefore, the user issues might be caused by some bug in used version of gcc/mingw/linker/etc.
 

You can share detailed information about used toolchain including versions.

We would suggest to try using up-to-date version of TDM-GCC-64 (http://tdm-gcc.tdragon.net/) without MSYS2
(it just requires calling mingwvars.bat before starting CMake and then using mingw32-make.exe for building OCCT from standard Windows command line tool).
 

Best Regards, FSR

sander boer's picture

Dear FSR,

thank you for the input,

Msys2 is like arch linux/manjaro, it follows a bleeding edge of package versions.

MSYS2 gcc and g++ version is 6.3.0. 

So in time, this bug will rear its ugly head.

BTW, what was the motivation for C++11 over C++14 ? I hear 14 is "11 done right"...

S

sander boer's picture

Alas,

I compiled opencascade 7.1.0 and today's git repo using a fresh install of TDM-GCC-64, gcc 5.1.0, and the problem persists:

$ ldd libTKV3d.dll
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x771b0000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x77090000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefcf50000)
        ConEmuHk64.dll => /c/Applications/ConEmuPack.161022/ConEmu/ConEmuHk64.dll (0x7e110000)
        USER32.dll => /c/Windows/system32/USER32.dll (0x76f90000)
        GDI32.dll => /c/Windows/system32/GDI32.dll (0x7fefd2f0000)
        LPK.dll => /c/Windows/system32/LPK.dll (0x7fefd7a0000)
        USP10.dll => /c/Windows/system32/USP10.dll (0x7fefed20000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefd6b0000)
        IMM32.DLL => /c/Windows/system32/IMM32.DLL (0x7fefd770000)
        MSCTF.dll => /c/Windows/system32/MSCTF.dll (0x7fefde60000)
        api-ms-win-core-synch-l1-2-0.DLL => /c/Windows/system32/api-ms-win-core-synch-l1-2-0.DLL (0x7fef67c0000)
        ??? => ??? (0x69f00000)
        ??? => ??? (0x6efc0000)
        ??? => ??? (0x62d40000)
        ??? => ??? (0x7fefd7b0000)
        ??? => ??? (0x7fefd750000)
        ??? => ??? (0x7fefefe0000)
        ??? => ??? (0x77380000)
        ??? => ??? (0x7fefa6d0000)
        ??? => ??? (0x7fefd930000)
        ??? => ??? (0x7fefedf0000)
        ??? => ??? (0x62000000)
        ??? => ??? (0x2150000)
        ??? => ??? (0x6a580000)
        ??? => ??? (0x702c0000)
        ??? => ??? (0x6d4c0000)
        ??? => ??? (0x6bd80000)
        ??? => ??? (0x69340000)
        ??? => ??? (0x6a980000)
        ??? => ??? (0x6ba40000)
        ??? => ??? (0x2410000)

Also other files are affected:

libTKBinXCAF.dll, libTKDCAF.dll, libTKDCAF.dll, libTKMeshVS.dll, libTKOpenGl.dll, libTKQADraw.dll, libTKService.dll, libTKTObjDRAW.dll, libTKTopTest.dll, libTKVCAF.dll, libTKV3d.dll, libTKViewerTest.dll, libTKVRML.dll, libTKXCAF.dll, libTKXDEDRAW.dll, libTKXDEIGES.dll, libTKXDESTEP.dll, libTKXmlXCAF.dll, libTKXSDRAW.dll,

I have added the ldd output of all the occt 7.1 dlls I compiled on win7 with gcc 5.1,

Interestingly, these addresses are recurring.

For instance 0x7fefd750000 is referenced in libTKService.dll and libTKV3d.dll as empty, but in other dlls like libTKShHealing.dll, it is referencing sechost.dll​

libTKV3d.dll:

??? => ??? (0x7fefd750000)

 libTKShHealing.dll:

sechost.dll => /c/Windows/SYSTEM32/sechost.dll (0x7fefd750000)

My dear Watson, I think we've stumbled upon a clue...

S

Kirill Gavrilov's picture

I have just built current master using TDM-GCC-64, gcc 5.1.0 without issues - e.g. Draw Harness starts without errors, loads it's plugins (pload ALL) and shows the viewer.

I have added the ldd output

ldd is not packaged with TDM-GCC-64 - I suppose you are using it from MSYS2.
Native library dependency walking tools show proper dependencies between DLLs. I believe you should report issue to MSYS2 developers.

BTW, what was the motivation for C++11 over C++14 ? I hear 14 is "11 done right"...

You've got the message wrong - C++ standards are usually backward compatible, e.g. code written for older standard should be compilable by a compiler supporting newer standard, but not in another direction.
OCCT 7.0.0 uses features of C++11 standard (it uses flag -std=c++0x within g++) which makes it incompatible with compilers not supporting C++11 features in proper way (but compatible with C++14 compilers), while OCCT 6.9.1 was compatible with C++03 compilers (as well as C++11 and C++14).

There is no point to use new features of C++ standard "just to look modern" - it will break compatibility with older compilers without any profit. And this is not a good thing for a framework used by many applications in various environments.

sander boer's picture

Well I'll be.. 

I can confirm that Draw.exe also works on my gcc 5.1 compiled versions of opencascade 7.1.0 and git.

Good news that. But it makes my original issue all the more confounding. Now I have zero clues on what makes msys2 builds fail in this manner....

S