-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PythonQT Fails to Build in Debug on MSVC 2010 #9
Comments
Greetings everyone, I'm having this exact same issue while compiling PythonQt path 3 that I don't know how to solve. Is there any known work around for this? PS: Is PythonQt still maintained? |
Hi, PythonQt is still maintained. The upstream is repository is [1] We would also be happy to accept contribution to fix the reported problem. Thanks [1] http://pythonqt.svn.sourceforge.net/viewvc/pythonqt/trunk/ On Fri, May 24, 2013 at 1:25 PM, Neosettler [email protected]:
+1 919 869 8849 |
Hi jc, this issue is literately a show stopper and I'd be very glad to contribute but I've been pulling my hair for the past 2 days and I still can't figure it out, nnfortunately. |
Hi, Does the problem occur for both Qt 4.7.4 and Qt 4.8.4 ? Jc On Fri, May 24, 2013 at 2:22 PM, Neosettler [email protected]:
+1 919 869 8849 |
I'm using Python 2.7.5 and Qt 4.8.4 on Windows 8! |
Could you also confirme that you are using a "Debug" build of Qt ? I was able to reproduce the error building PythonQt in Debug against a On Fri, May 24, 2013 at 4:08 PM, Neosettler [email protected]:
+1 919 869 8849 |
Sure, I'm using: I should also mentioned that it is a (64 bit) setup. |
Side note: something is fishy with PythonQt_QtAll, somehow it is not included in the VS solution when check in CMake, thus It makes it impossible to use PythonQt_QtAll::init(); |
DetailsLooking further into the issue, I am able to compile the library after commenting the line starting with [1] https://github.com/commontk/PythonQt/blob/patched-3/src/PythonQt.cpp#L83-89 Looking at the faulty macro
See https://github.com/commontk/PythonQt/blob/patched-3/src/PythonQtConversion.h#L63-66 More specifically, the line having
See https://github.com/commontk/PythonQt/blob/patched-3/src/PythonQtConversion.h#L57-61 It then turns out that the line having SummaryTo summarize, after commenting the line referenced in [1][2], PythonQt compiled in both Debug and Release. Compilation (linking) then failed in Debug by simply re-adding the following line and compiling:
Link error:
Test has been done using:
|
Very well, it does fix the 64 bit version on my side. Thank you very much for your support jc. |
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9
@Neosettler Please, let me know if commit 56cdf6c also fixes the issue for 64-bit build. |
Yes it does! wonderful fix and a million thx jc. If you'd like the challenge, it would be nice if the Debug version wouldn't require python27_d.lib as it involves to recompile the whole Python suite and honestly, it makes my head spin. |
***Debug version of PythonQt_QtAll.lib that is. |
Hint: My guess is that there is something about the generated files (Custom Build Tool) that cant live without python27_d.lib. I tried: editing the pyconfig.h replacing line326: but there is unresolved about Py_Dealloc and others... I also try to insert -DMS_NO_COREDLL in the Custom Build Tool with no luck still unresolved. still digging. |
in addition to line 326, commenting line 369: //#define Py_DEBUG ...not very elegant but it works. |
A Debug build of PythonQt should build against a release of python without As a side note, building python (in release for the moment) is made very On Mon, May 27, 2013 at 11:24 PM, Neosettler [email protected]:
+1 919 869 8849 |
Alright then, this flag was missing from the generate project. I reverted the pyconfig.h to its original state and added this PYTHONQT_USE_RELEASE_PYTHON_FALLBACK and the Debug version works like a charm now. Your the best jc! :) |
This CMake build system seems very good. Just to let you know, I've been struggling quite a lot with the PyhtonQt CMake VS for the past week. It would need more love to say that it is working out of the box. Especially for the PythonQt_QtAll not being added to the solution. |
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
Hi, Regarding the PythonQt CMake build system, when you mentioned that To clarify the role of the configure time option named At configure time, if the CMake option "PythonQt_Wrap_QtAll" is enabled Finally, the macro defined previously will be used to conditionally Let me know what you think, [1] https://github.com/commontk/PythonQt/blob/patched-3/CMakeLists.txt#L19 On Tue, May 28, 2013 at 12:01 AM, Neosettler [email protected]:
+1 919 869 8849 |
If you are using the Note that we should instead implement the mechanism allowing to configure See also #8 |
Hi jc, AFAIK PythonQt and PythonQt_QtAll are two separate libraries that need to be compiled and linked against a VS dev project. Using CMake, I made about a dozen tries to embed PythonQt_QtAll::init()in the PythonQt lib without success. I also tried the PythonQt_init_QtBindings but the #defines to enable each libraries are simply not defined anywhere in the PythonQt project. Thus, the PythonQt_init_QtBindings is not doing anything when linked in against a VS dev project. The only way I managed to use PythonQt in my VS dev project so far is to generate the PythonQt solution with CMake and create a bach file to generate the PythonQt_QtAll VS project based on the .pro and compile it. |
👍 this fixes debug build of PythonQt and CTK for MSVC 2012 Express. |
I'm trying your CMake Python and I can say that Pyhton27.lib is generated like a charm. Now, if I may, how does it work if we need the other (modules) like ctypes for instance? |
Thanks :) Within ccmake or cmake-gui, you should have an option named Note that ctypes is not yet available in macosx. See All build option are described in the Readme file: On Tue, May 28, 2013 at 6:09 PM, Neosettler [email protected]:
+1 919 869 8849 |
See commontk/PythonQt@9c92fd212605b // -------------- Fix "_invalid_parameter_noinfo_noreturn" link error By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk/PythonQt#9 Thanks @Neosettler and @ihnorton for testing the patch. Reported-by: Neosettler
Hi Jean-Christophe, to make things clear, ENABLE_CTYPES and BUILTIN_CTYPES doesn't exit but ENABLE_CTYPES_TEST and BUILTIN_CTYPES_TEST does which I thought _TEST was on the confusing side. So what you are saying is that contrary to the release version of Python27 (which distributes _ctypes.lib) the _ctypes.lib will be embed inside the compiled version Python27.lib? I compiled Python2.7.5 successfully but I'm still not sure what to do with it. I'm sorry again if I'm stretching it but I can almost see the light at the end of the tunnel after many days of darkness. Is it possible to link my dev project to the compiled Pyhton27.lib and use the installed Python27 executable to launch my python scripts or do I need to compile the executable as well? How do I use this new generated Pyhton27.lib exactly? |
Follow up... Here is my steps:
When launching my app I evalFile a script that use ctypes and I'm getting : ImportError: No module named _ctypes Any idea what am I missing? |
Edit ImportError: File "root\Python27\Lib\ctypes__init__.py", line 10, in |
Hi, To install cmake'ified python in a directory of your choice, you should do the following:
or by changing the value in Then, from within VisualStudio, building the target Within your application, setting:
should be enough. More details about embedding python: http://docs.python.org/2/extending/embedding.html Note also that if you depends on CTK and PythonQt, you could easily use the If your application is also CMake'ified, you could very easily add a Then, your application CMakeLists.txt could look like this:
Similar to this example: https://github.com/jcfr/python-cmake-custom-extension/blob/master/CMakeLists.txt I think it is now time to close this issue. The discussion is out of its original scope. If it makes sens, feel free to open an issue in the python-cmake-buildsystem tracker. See https://github.com/davidsansome/python-cmake-buildsystem/issues?state=open |
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See #9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
By ensuring that "undef" of _DEBUG macro is not done before system includes, it fixes the issue. This commit is based on what has been within VTK. See Kitware/VTK@81d4a72 See commontk#9 Thanks @Neosettler for testing the patch. Reported-by: Neosettler
I experienced this issue while building Slicer 4.2 on Windows 7 with MSVC 2010. I then tested it outside of Slicer, building it against both the x64 version of Python built by Slicer and a x86 version of Python 2.7.2. When building inside Slicer in debug, I get this error:
2>Link:
2> Creating library D:/src/Slicer4/SlicerBuild-Debug/CTK-build/PythonQt-build/Debug/PythonQt.lib and object D:/src/Slicer4/SlicerBuild-Debug/CTK-build/PythonQt-build/Debug/PythonQt.exp
2>PythonQt.obj : error LNK2019: unresolved external symbol __imp__invalid_parameter_noinfo_noreturn referenced in function "public: int const & __cdecl std::_Vector_const_iterator<class std::_Vector_val<int,class std::allocator > >::operator*(void)const " (??D?$_Vector_const_iterator@V?$_Vector_val@HV?$allocator@H@std@@@std@@@std@@QEBAAEBHXZ)
2>D:\src\Slicer4\SlicerBuild-Debug\CTK-build\PythonQt-build\Debug\PythonQt.dll : fatal error LNK1120: 1 unresolved externals
If I change to Release mode using the PythonQt.sln inside the Slicer/CTK project, it builds fine.
I get the same error when building outside of slicer in debug, but it works fine in release both for when I build against the Slicer Python and my 32 bit Python 2.7.2/Qt 4.7.4.
I know the suggestion is to use MSVC 2008, but our software needs 2010 and I figured this should at least be reported here instead of just on the mailing lists.
The text was updated successfully, but these errors were encountered: