Quantcast

Python3 Crashes on 64-bit Windows

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Python3 Crashes on 64-bit Windows

Michael Gauland
My career as a SWIG user is still in its early days, so I've been
playing with a toy example to get my feet wet. My ultimate goal is to
use SWIG to provide Python3 access to a C++ library; I'd like to be able
to build it on my Linux system for deployment on Linux and Windows systems.

At present, by code provides a  very basic class, with a constructor
that takes an integer, two functions that return integers, and an empty
destructor.  Along with this is a Python test script, that imports the
library, creates an object, invokes the methods, and releases the object.

This all works just fine on Linux.

It also works fine on a Windows system, when build on Linux using the
MXE cross-compiler package to build a 32-bit library.

64-bit Windows, does not work. It goes fine, until the object is
released--then Python crashes, though (as far as I can tell) it never
gets to my destructor, or to the SWIG-generated wrapper.

Any insights or suggestions would be greatly appreciated!

Kind Regards,
Mike


------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python3 Crashes on 64-bit Windows

Martin Siggel

Dear Michael,

Without seeing the source code, there is not much we can do here. I have good experiences with swig with large projects.

It would be good, if you could provide a minimal example to demonstrate your issue.

Regards,
Martin


Am 23.09.2016 1:30 vorm. schrieb "Michael Gauland" <[hidden email]>:
My career as a SWIG user is still in its early days, so I've been
playing with a toy example to get my feet wet. My ultimate goal is to
use SWIG to provide Python3 access to a C++ library; I'd like to be able
to build it on my Linux system for deployment on Linux and Windows systems.

At present, by code provides a  very basic class, with a constructor
that takes an integer, two functions that return integers, and an empty
destructor.  Along with this is a Python test script, that imports the
library, creates an object, invokes the methods, and releases the object.

This all works just fine on Linux.

It also works fine on a Windows system, when build on Linux using the
MXE cross-compiler package to build a 32-bit library.

64-bit Windows, does not work. It goes fine, until the object is
released--then Python crashes, though (as far as I can tell) it never
gets to my destructor, or to the SWIG-generated wrapper.

Any insights or suggestions would be greatly appreciated!

Kind Regards,
Mike


------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python3 Crashes on 64-bit Windows

William S Fulton
In reply to this post by Michael Gauland
On 23 September 2016 at 00:26, Michael Gauland <[hidden email]> wrote:

> My career as a SWIG user is still in its early days, so I've been
> playing with a toy example to get my feet wet. My ultimate goal is to
> use SWIG to provide Python3 access to a C++ library; I'd like to be able
> to build it on my Linux system for deployment on Linux and Windows systems.
>
> At present, by code provides a  very basic class, with a constructor
> that takes an integer, two functions that return integers, and an empty
> destructor.  Along with this is a Python test script, that imports the
> library, creates an object, invokes the methods, and releases the object.
>
> This all works just fine on Linux.
>
> It also works fine on a Windows system, when build on Linux using the
> MXE cross-compiler package to build a 32-bit library.
>
> 64-bit Windows, does not work. It goes fine, until the object is
> released--then Python crashes, though (as far as I can tell) it never
> gets to my destructor, or to the SWIG-generated wrapper.
>
It works fine in SWIG's regression testing using Visual Studio
including 64 bit. Although the testing is very command line oriented
and avoids using Visual Studio solutions/project files, you can take a
look at Appveyor results here:
https://ci.appveyor.com/project/swig/swig/history. You can get some
details on how it is run from the appveyor.yml file
(https://github.com/swig/swig/blob/master/appveyor.yml), but it won't
be that useful as it doesn't show the command line options to cl
unless you turn on verbose output --cccl-verbose to cccl
(https://github.com/swig/cccl).

William

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python3 Crashes on 64-bit Windows

Michael Gauland
In reply to this post by Michael Gauland



On 23/09/16 18:35, Martin Siggel wrote:

Dear Michael,

Without seeing the source code, there is not much we can do here. I have good experiences with swig with large projects.

It would be good, if you could provide a minimal example to demonstrate your issue.

Regards,
Martin


I've attached source code for a small example.  I have the mxe tools (http://mxe.cc) installed to /opt/mxe, for both i686 and x85_64 using shared libraries. I build by running 'make' in each of the linux, win32, and win64 directories.
(NOTE: I've had to remove the python dlls for the mailing list; the 'embeddable' zip files from python.org and install them in swig-test/python-win32 and swig-test/python-amd64)
(NOTE: Also install the python source to Python--3.5.2)

In the linux directory, I test the results by running:

    LD_LIBRARY_PATH=. ./main

and

    LD_LIBRARY_PATH=. PYTHONPATH=. python ../test.py

To test on Windows, I copy everything to a memory stick (that also has the appropriate bin and lib directories from mxe in /win32 and /win64).

For win32, in the swig-test/win32 directory, I run main.bat to test the C++ program, and test.bat to test the python library.  Both work.
(NOTE: I had to rename the files to get the mailer to send it.)

I do the same in the swig-test/win64 directory; the C++ program runs, but the python script crashes when it tries to free the "x" object.

Thanks for your assistance,
Mike


Am 23.09.2016 1:30 vorm. schrieb "Michael Gauland" <[hidden email]>:
My career as a SWIG user is still in its early days, so I've been
playing with a toy example to get my feet wet. My ultimate goal is to
use SWIG to provide Python3 access to a C++ library; I'd like to be able
to build it on my Linux system for deployment on Linux and Windows systems.

At present, by code provides a  very basic class, with a constructor
that takes an integer, two functions that return integers, and an empty
destructor.  Along with this is a Python test script, that imports the
library, creates an object, invokes the methods, and releases the object.

This all works just fine on Linux.

It also works fine on a Windows system, when build on Linux using the
MXE cross-compiler package to build a 32-bit library.

64-bit Windows, does not work. It goes fine, until the object is
released--then Python crashes, though (as far as I can tell) it never
gets to my destructor, or to the SWIG-generated wrapper.

Any insights or suggestions would be greatly appreciated!

Kind Regards,
Mike


------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user






------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user

swig-test-zip (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Python3 Crashes on 64-bit Windows

Michael Gauland
In reply to this post by Martin Siggel
I've got it working now. In case anyone else runs into similar trouble, what worked for me was to define MS_WIN64 when building for WIN64.

On 23/09/16 18:35, Martin Siggel wrote:

Dear Michael,

Without seeing the source code, there is not much we can do here. I have good experiences with swig with large projects.

It would be good, if you could provide a minimal example to demonstrate your issue.

Regards,
Martin


Am 23.09.2016 1:30 vorm. schrieb "Michael Gauland" <[hidden email]>:
My career as a SWIG user is still in its early days, so I've been
playing with a toy example to get my feet wet. My ultimate goal is to
use SWIG to provide Python3 access to a C++ library; I'd like to be able
to build it on my Linux system for deployment on Linux and Windows systems.

At present, by code provides a  very basic class, with a constructor
that takes an integer, two functions that return integers, and an empty
destructor.  Along with this is a Python test script, that imports the
library, creates an object, invokes the methods, and releases the object.

This all works just fine on Linux.

It also works fine on a Windows system, when build on Linux using the
MXE cross-compiler package to build a 32-bit library.

64-bit Windows, does not work. It goes fine, until the object is
released--then Python crashes, though (as far as I can tell) it never
gets to my destructor, or to the SWIG-generated wrapper.

Any insights or suggestions would be greatly appreciated!

Kind Regards,
Mike


------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...