Qt dependencies for Windows 10



  • Hi,

    My programming environment suddenly stopped working. I was using Qt 5.8 and VS 2015, the WINSDK variable is set to use 8.0, although in VS 8.1 and 10.0 are actually used. I'm trying to set it up again but I'm getting the following error on runtime in debug mode:

    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is SEEXYZImporterGUI(0x13e2d8fbdd0), parent's thread is QThread(0x13e29519640), current thread is QThread(0x13e29c34dd0)
    QCoreApplication::postEvent: Unexpected null receiver
    QWidget: Must construct a QApplication before a QWidget
    Unhandled exception at 0x00007FFBFA8FB64E (ucrtbase.dll) in SAMSON-Core.exe: Fatal program exit requested.
    

    Release mode works and this happens when running in debug from the project of any SAMSON element (I'm trying with the elements from the Developer tutorial to be sure). Compilation doesn't give any warnings or errors.

    Has anyone encountered this error? Possible causes could be:

    • A windows 10 update (I can't control them as I'm forced to use my company laptop)
    • Adding Anaconda to the path (to use Python Scripting Element, but also the Qt that comes with Anaconda gets fetched instead of the Qt installation) => already removed and the right Qt is getting selected but until I found this maybe I uninstalled something.

    Also I'm working with a colleague and our environments seem very similar (same cmake, VS and Qt versions, same environment variables), but it works for him. The only difference we notice is that in the VC++ directories of the project he only gets Win 10 SDK loaded, but I can't manage to get rid of the references to 8.1 in mine.Perhaps someone has encountered this error before and can point me in the right direction.

    I would also like to ask if it would be possible to get it working with Qt 5.12 and VS 2017, as they added at some point in Qt 5.11 more debugging capabilities.

    Thanks for your help and best regards,

    Elisa



  • Dear @Elisa ,
    SAMSON 0.7.0 uses Qt 5.9.3 and SAMSON Elements for SAMSON 0.7.0 should be compiled with Qt 5.9.3 (see SAMSON SDK Installation instructions and a tutorial on building a SAMSON Element on Windows). Could you, please, install Qt 5.9.3 and try to compile against it and see if you still have the problem.

    In SAMSON 0.8.0 we will be using Qt 5.11.



  • Thank you, I installed Qt 5.9.3, but I keep having the same problem both in VS2015 and VS2017. I think I will have to reinstall Windows and see if the problem goes away.



  • Let's try without such drastic actions.



  • Have you tried to clean your projects in MS VS? The error you have, I think, is caused by a mix of Qt versions. For example, you compiled a SAMSON Element with Qt whose version is not 5.9.3, or when you launch SAMSON a version of Qt libraries different from 5.9.3 is used. Please, check your environment variables and project settings in MS VS.

    Just for information. For Windows, SAMSON is compiled on Win7 with MS VS 2015 64bit and Qt 5.9.3. Personally, I am using Win10 with MS VS 2017 64bit (currently, my Windows SDK Version is 10.0.17134.0) and Qt 5.9.3.



  • How do you create a SAMSON Element project for VS? You can check a tutorial on building a SAMSON Element on Windows for some commands.
    In a build folder of your SAMSON Element:

    for Visual Studio 2015:

    cmake -DSAMSON_SDK_PATH=”C:\Program Files\NANO-D\SDK\0.7.0” -G”Visual Studio 14 Win64” -DQT5_CMAKE_INCLUDE_DIR=”C:\Qt\5.9.3\msvc2015_64\lib\cmake” ..
    

    for Visual Studio 2017:

    cmake -DSAMSON_SDK_PATH=”C:\Program Files\NANO-D\SDK\0.7.0” -G”Visual Studio 15 Win64” -DQT5_CMAKE_INCLUDE_DIR=”C:\Qt\5.9.3\msvc2017_64\lib\cmake” ..
    

    Actually, providing of QT5_CMAKE_INCLUDE_DIR might not be necessary if you have it specified in your environment variables.

    So, you may check the QT5_CMAKE_INCLUDE_DIR environment variable.



  • Please, check as well Path environment variables in user and system environment variables.

    For me:
    In the Path system variable I have C:\Qt\5.9.3\msvc2017_64\bin set as a first path.
    In the Path user variable I have the following paths set: C:\Users\marin\Anaconda3;C:\Users\marin\Anaconda3\Library\mingw-w64\bin;C:\Users\marin\Anaconda3\Library\usr\bin;C:\Users\marin\Anaconda3\Library\bin;C:\Users\marin\Anaconda3\Scripts;C:\Program Files\CMake\bin;C:\Qt\5.9.3\msvc2017_64\lib. The paths for Anaconda3 were set automatically by Anaconda.



  • You may also try to uninstall SAMSON Elements (both installed from samson-connect.net and developed locally) and check if the error is still there.



  • Hi! Somehow it got fixed, I can't say for sure what fixed it, as I removed several modules, but it is now working again and my module loads in debug. I will pay attention if it happens again, because there is a high chance it was caused by a module :) Thanks for your help!!



  • You may try adding modules one-by-one to see which one caused it. Was it one from samson-connect.net?



  • I will try, I don't think it was one from SAMSON connect, as most of them I had them for long. I think probably it was due to several things, maybe when re-installing all the programming environment again, some new things had a conflict with modules. It was really weird, and as I said my colleague has almost an identical installation (we went through it together) and also several modules installed and he didn't have the problem.



  • Hi!

    Another colleague had the same problem. I still don't know what caused it, but it went away after uninstalling all modules related to minimization and simulations (we uninstalled them in a batch, so I don't know which one could cause it, or if it was due to an interaction between our custom module and one of these, and therefore it could be our fault).

    Best regards,

    Elisa



  • Did you have them installed before? Did you install them again after?



  • I had them installed for a long time, so it was either an update in any of those modules, or a bug I introduced that somehow conflicts with them.

    I haven't install them after this, but once our module is ready for release I will definitely check this issue again (as I was playing with Anaconda3, and putting it on the path also affects Qt, there is a chance it was related to this).



  • I suspect it might be related more to Anaconda3 affecting Qt, since Anaconda also ships Qt libraries.
    If you suspect that it is due to SAMSON modules, could you, please, put a list of those you are suspecting causing the problem.



  • Hi!
    I think it is Anaconda3 definitely, as I had again the problem after playing around with the python bindings. I have submitted a samson log which shows an error.



  • Thank you for reporting, @Elisa !

    In the report message, you write that you get this problem when you try to run Debug. The Python scripting is supported only in Release mode since Python is not shipped with debug libraries.

    Is the crash report you submitted from the SAMSON-Debug or from SAMSON?



  • When you create Python bindings for your SAMSON Element, you should do it only for the Release version of the Element and not for the Debug version.



  • From SAMSON release I think.
    So I did the following: I configured everything to get Python Scripting working so I could work on the branch of my project that has the Python bindings. Everything went ok so far, I then checked-out to the branch without python bindings and removed Python Scripting from my elements. Then I tried to run Debug and it crashed, I could run Samson release but I got that error. I removed Anaconda3 from my path, re-run cmake and the error was gone.



  • Did you clean the project (clean, re-run cmake) after checking the version without Python bindings?

    If you add Anaconda3 to your Path environment variable now, does SAMSON crash when you run in Debug?

    I suggest adding some variable defining whether you compile the project with Python bindings or without such that it won't be compiled with Python bindings in the Debug mode at all, e.g. in the CMakeLists.txt of your Element (see the PyBindTutorial sample):

    ####################################################
    #   Python bindings
    ####################################################
    IF( NOT DEBUG ) # Disable the creation of Python bindings in the Debug mode since Python is not supported in the Debug mode
    
        FIND_PACKAGE( PythonInterp ${PYTHON_VERSION} REQUIRED )
    
    	IF ( PYTHONINTERP_FOUND )
    	    SET(CREATE_PYTHON_BINDINGS TRUE)
    	ENDIF ( PYTHONINTERP_FOUND )
    
    ENDIF()
    
    IF ( CREATE_PYTHON_BINDINGS )
    
        # Determine Python paths, see PyBindTutorial
        # ...
    
        # This define is used in the code to determine whether Python bindings should be created or not
        add_definitions(-DCREATE_PYTHON_BINDINGS)
    
    ELSE ( CREATE_PYTHON_BINDINGS )
    
        SET (PYTHON_LIBRARY "")
    
    ENDIF ( CREATE_PYTHON_BINDINGS )
    
    # ...
    
    TARGET_LINK_LIBRARIES (	${OUTPUT_NAME}
    			${QT_LIBRARIES}
    			${PYTHON_LIBRARY}
    			${OPENGL_LIBRARY}
    			${SAMSON_SDK_LIBRARIES} )
    
    

    And then use this CREATE_PYTHON_BINDINGS variable in your code like it is done in the PyBindTutorial sample, e.g.:

    #ifdef CREATE_PYTHON_BINDINGS
    
    #include "pybind11/pybind11.h"
    
    // ...
    
    #endif
    

    You can test whether you have the same problem with the PyBindTutorial sample when you compile it in the Release mode, and then launch SAMSON in the Debug mode.



  • Hi, yes, I deleted the build folder and run cmake after checking out from the Python bindings version. If I add Anaconda3 now I don't think it will crush unless I re-run cmake again, I have cloned my repository again so I don't need to check out and will test this next time I run the version with python bindings.

    I never had problems launching the version with Python Bindings in the debug mode, it just doesn't show up but otherwise runs fine, but I will check again.


Log in to reply
 

Looks like your connection to SAMSON Connect - Forum was lost, please wait while we try to reconnect.