View Issue Details

IDProjectCategoryView StatusLast Update
0001638FreeCADBugpublic2019-07-29 15:16
Reporterworstsalad Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindowsOS Version7x64 
Product Version0.14 
Fixed in Version0.15 
Summary0001638: Not possible to draw anything.
DescriptionWhen changing to any workbench, I receive the error "DLL load failed: Procedure not found." and thats it, not possible to draw anything.
Steps To ReproduceJust change to any workbench.
TagsNo tags attached.
FreeCAD Information

Activities

worstsalad

2014-07-25 11:52

reporter  

FreeCAD_dependency_walker-Log.csv (Attachment missing)

worstsalad

2014-07-25 11:52

reporter  

Dependencywalker-Profile-Log.txt (Attachment missing)

wmayer

2014-07-25 13:56

administrator   ~0004851

...
00:01:13.368: Loaded "c:\program files\freecad 0.14\bin\TKERNEL.DLL" at address 0x000007FEE5750000 by thread 1. Successfully hooked module.
00:01:13.368: Loaded "c:\windows\system32\TBBMALLOC.DLL" at address 0x000000000E590000 by thread 1. Successfully hooked module.
00:01:13.368: Loaded "c:\program files\freecad 0.14\bin\TKG2D.DLL" at address 0x000007FEE69E0000 by thread 1. Successfully hooked module.
...

00:01:13.415: Loaded "c:\program files\freecad 0.14\bin\TKMESH.DLL" at address 0x000007FEE45B0000 by thread 1. Successfully hooked module.
00:01:13.415: Loaded "c:\windows\system32\TBB.DLL" at address 0x000000000FF90000 by thread 1. Successfully hooked module.
00:01:13.430: First chance exception 0xC0000139 (DLL Not Found) occurred in "c:\windows\system32\NTDLL.DLL" at address 0x000000007769D7E8 by thread 1.

The problem might be that tbb.dll and tbbmalloc.dll is already installed under c:\windows\system32\. This directory is reserved for system libraries and all other dlls have nothing lost there.

The problem is that the OpenCascade dlls try to load these dlls there instead of the local copy. Since tbb is a C++ library and apparently the version in system32 isn't binary compatible none of the OCC dlls load.

Solution: Remove or at least rename tbb.dll and tbbmalloc.dll inside c:\windows\system32\

wmayer

2014-07-25 14:46

administrator   ~0004853

Report back if the given solution works.

worstsalad

2014-07-28 13:18

reporter   ~0004862

That solved the issue. Thank's a lot!

Some other folks I work with also share(d) my DLL-Hell-Problem. One could prevent such things with using fully qualified paths to load the needed DLL's.

(Also interesting: https://support.microsoft.com/kb/2389418/en-us and https://en.wikipedia.org/wiki/DLL_Hell)

worstsalad

2014-07-28 14:07

reporter   ~0004863

Apparently does National Instruments Software cause this Problem. To be precise, the IMAQ Image Processing Framework.

It seems as if the NI-Framework needs to have these DLL's in the system32 Directory. An option would be to copy the DLL's NI copied to the system32 Directory to the NI-Directory, but then one would have a non-standard NI-Directory-Tree which could lead to further Problems.

A workaround for me was to copy the tbb*.dll's from the FreeCAD\bin to the FreeCAD\lib directory. Which solved the Problem, but that's just a workaround. Another option for you would be, to load the Python modules with FreeCAD\bin as search path for DLL-Libraries (if that is possible). (At least do i think that a Python-Module loads the tbb.dll and tbbmalloc.dll from system32.)

wmayer

2014-07-30 12:05

administrator   ~0004880

Thanks for the link to the secure loading of DLLs. Very interesting reading.
However, I'm not sure what problems it can cause to implement the secure loading because ATM it's possible that users can also use 3rd party Python extension modules like numpy or the like. Now when setting fully qualified paths this won't be possible any more, for sure.

> It seems as if the NI-Framework needs to have these DLL's in the system32 Directory....
That's totally insane design IMO. The system directory is reserved for system DLLs and it's taboo for any kind of application DLLs.

> At least do i think that a Python-Module loads the tbb.dll and tbbmalloc.dll from system32.
It's not a Python module it's one of the Opencascade libraries those starting with "TK".

wmayer

2014-07-30 15:45

administrator   ~0004891

Note to myself:
In FreeCADInit.py commenting out this block makes the load of PartDesignGui.pyd failing because Part.pyd can't be found.

#try:
# os.environ["PATH"] = PathExtension + os.environ["PATH"]
#except KeyError:
# os.environ["PATH"] = PathExtension
#path = os.environ["PATH"].split(os.pathsep)
#Log("System path after init:\n")
#for i in path:
# Log(" " + i + "\n")

However, when changing the CMake macro SET_BIN_DIR to make all .pyd files to go to ${CMAKE_BINARY_DIR}/lib everything works fine again.

wmayer

2014-07-30 16:16

administrator   ~0004892

Note to myself:
When putting a faked tbb.dll into system32 then FreeCAD fails to load all OCC-dependent modules. When adding these three lines
    std::string binPath = TempHomePath;
    binPath += "bin";
    BOOL ok = SetDllDirectory(binPath.c_str());
into Application::FindHomePath and making sure tbb.dll is in the bin directory everything works OK.

With SetDllDirectory the DLL search order changes that with the specified path comes BEFORE system32 and system. Also, the CWD is dropped which we don't need anyway.

The reason why moving tbb.dll to the lib directory fixes this problem is because the dynamically loaded Python module lies there and apparently this counts as the "application" and not the FreeCAD executable which is inside bin.

To sum up:
+ Add the three liner to fix this issue
+ Remove the block to extend PATH and create all .pyd's under lib is optional.

wmayer

2015-01-12 12:08

administrator   ~0005632

Downgrade severity as the actual problem is solved

Related Changesets

FreeCAD: master e327662d

2014-07-30 18:21:53

wmayer

Details Diff
0001638: Not possible to draw anything. Affected Issues
0001638
mod - src/App/Application.cpp Diff File

FreeCAD: releases 3ecaf877

2014-08-28 15:27:35

wmayer

Details Diff
- fix focus issue with InputField
- on document load set camera setting of the MDI views
- do not try to use framebuffer objects when it's not supported on the system
0001690: sketch.getPoint crashes FreeCAD if the point does not exist
0001630: IGES-Export in [mm] turns to [Inches]
0001684: Sweep ignores the list of subshapes
0001667: 'Save file' disabled when viewing a drawing
0001682: Crash after updating editable texts in drawing
0001659: 3dconnexion space navigator moves view even when FreeCAD is not the active application
0001696: Quantity.getValueAs('rad') touches the Property
0001638: Not possible to draw anything
Affected Issues
0001630, 0001638, 0001659, 0001667, 0001682, 0001684, 0001690, 0001696
mod - src/App/Application.cpp Diff File
mod - src/Base/QuantityPy.xml Diff File
mod - src/Gui/Application.cpp Diff File
mod - src/Gui/Document.cpp Diff File
mod - src/Gui/GuiApplicationNativeEventAware.cpp Diff File
mod - src/Gui/InputField.cpp Diff File
mod - src/Gui/MouseSelection.cpp Diff File
mod - src/Mod/Drawing/App/FeaturePage.cpp Diff File
mod - src/Mod/Drawing/Gui/DrawingView.cpp Diff File
mod - src/Mod/Part/App/PartFeatures.cpp Diff File
mod - src/Mod/Part/App/TopoShape.cpp Diff File
mod - src/Mod/Sketcher/App/SketchObjectPyImp.cpp Diff File

Issue History

Date Modified Username Field Change
2014-07-25 11:51 worstsalad New Issue
2014-07-25 11:52 worstsalad File Added: FreeCAD_dependency_walker-Log.csv
2014-07-25 11:52 worstsalad File Added: Dependencywalker-Profile-Log.txt
2014-07-25 13:56 wmayer Note Added: 0004851
2014-07-25 14:46 wmayer Note Added: 0004853
2014-07-25 14:46 wmayer Status new => feedback
2014-07-28 13:18 worstsalad Note Added: 0004862
2014-07-28 13:18 worstsalad Status feedback => new
2014-07-28 14:07 worstsalad Note Added: 0004863
2014-07-30 12:05 wmayer Note Added: 0004880
2014-07-30 15:45 wmayer Note Added: 0004891
2014-07-30 16:16 wmayer Note Added: 0004892
2014-07-30 18:53 wmayer Changeset attached => FreeCAD Master master e327662d
2014-08-24 09:04 wmayer Assigned To => wmayer
2014-08-24 09:04 wmayer Status new => assigned
2014-12-31 16:36 wmayer Status assigned => resolved
2014-12-31 16:36 wmayer Fixed in Version => 0.15
2014-12-31 16:36 wmayer Resolution open => fixed
2015-01-12 12:08 wmayer Note Added: 0005632
2015-01-12 12:08 wmayer Severity block => minor
2015-02-22 17:20 yorik Status resolved => closed
2019-07-29 15:16 Kunda1 Changeset attached => FreeCAD releases 3ecaf877