Skip to content
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

Windows support #56

Merged
merged 5 commits into from
Mar 29, 2014
Merged

Windows support #56

merged 5 commits into from
Mar 29, 2014

Conversation

aebrahim
Copy link
Contributor

Pymatbridge can be successfully used on Windows.

messenger.c now can be compiled into a mex with visual studio

@aebrahim
Copy link
Contributor Author

I have the mexw64 built as well. Let me know if you want it. It is dynamically linked though, so libzmq.dll is still needed. It should be possible to statically link it.
screenshot

@arokem
Copy link
Owner

arokem commented Mar 27, 2014

Wow - that's great! Thanks for doing this. Could you also provide instructions on what Windows users would have to do to get this going on their machines?

@aebrahim
Copy link
Contributor Author

Sure, no problem.

Do you want to distribute a compiled mexw64 in git, like you do for mexa64? I can add that to the repository. In that case, all they will have to do is add libzmq.dll to their path and they would be good to go (unless I figure out how to statically link, and then they won't have to do anything)

@arokem
Copy link
Owner

arokem commented Mar 28, 2014

Yes - that would be helpful. And an explanation on how users might go about
adding libzmq.dll to their path, if that's not too hard. Thanks!

On Thu, Mar 27, 2014 at 3:58 PM, Ali Ebrahim notifications@github.comwrote:

Sure, no problem.

Do you want to distribute a compiled mexw64 in git, like you do for
mexa64? I can add that to the repository. In that case, all they will have
to do is add libzmq.dll to their path and they would be good to go (unless
I figure out how to statically link, and then they won't have to do
anything)


Reply to this email directly or view it on GitHubhttps://github.com//pull/56#issuecomment-38871461
.

Pymatbridge can be successfully used on Windows.

messenger.c now can be compiled into a mex with visual studio
Explain how to edit environment variable on windows.
@aebrahim
Copy link
Contributor Author

I added the updated install instructions and the 64 bit windows binary. I don't have 32 bit MATLAB to build the 32 bit binary.

Command line options were checking for sys.platform being "Windows", not
"win32"
arokem added a commit that referenced this pull request Mar 29, 2014
@arokem arokem merged commit 2cbd90a into arokem:master Mar 29, 2014
@aebrahim aebrahim deleted the win32 branch March 30, 2014 01:35
@bs448c
Copy link

bs448c commented May 14, 2014

any comment on how you built the messenger under Win 64 bit? I'm having trouble using the precompiled version .. see comment 5 in #67. I can also open a new issue .. ?

@aebrahim
Copy link
Contributor Author

I used mcc (the matlab compiler) and the libzmq development libraries.

Maybe the version of libzmq.dll does not match the version it was compiled
with?

On Wed, May 14, 2014 at 7:25 AM, bs448c notifications@github.com wrote:

any comment on how you built the messenger under Win 64 bit? I'm having
trouble using the precompiled version .. see comment 5 in #67#67.
I can also open a new issue .. ?


Reply to this email directly or view it on GitHubhttps://github.com//pull/56#issuecomment-43086859
.

@bs448c
Copy link

bs448c commented May 14, 2014

Thanks for your reply! I tried both ZMQ 4.0.4 as well as 3.2.4 but did not have any luck. The libzmq.dll worked with pymatbridge-0.2 .. I did not attempt to create the mexw64 myself yet.

@arokem
Copy link
Owner

arokem commented May 14, 2014

Windows, huh? I have no idea about that platform, and am hoping that you
poor souls would help us getting this thing properly working on that
strange, strange computing platform. But yeah - I don't have much to
contribute here. Note that the messenger that is distributed with the
source was apparently compiled against ZMQ 3.2.4/

On Wed, May 14, 2014 at 9:17 AM, Ali Ebrahim notifications@github.comwrote:

I used mcc (the matlab compiler) and the libzmq development libraries.

Maybe the version of libzmq.dll does not match the version it was compiled
with?

On Wed, May 14, 2014 at 7:25 AM, bs448c notifications@github.com wrote:

any comment on how you built the messenger under Win 64 bit? I'm having
trouble using the precompiled version .. see comment 5 in #67<
https://github.com/arokem/python-matlab-bridge/issues/67>.
I can also open a new issue .. ?


Reply to this email directly or view it on GitHub<
https://github.com/arokem/python-matlab-bridge/pull/56#issuecomment-43086859>

.


Reply to this email directly or view it on GitHubhttps://github.com//pull/56#issuecomment-43102307
.

@arokem
Copy link
Owner

arokem commented May 14, 2014

Version 0.2 had a very different communication protocol, that did not
depend on zmq at all. Rather it was using a webserver that was running on
matlab. We switched over because the webserver was not very robust and was
relatively slow.

On Wed, May 14, 2014 at 9:22 AM, bs448c notifications@github.com wrote:

Thanks for your reply! I tried both ZMQ 4.0.4 as well as 3.2.4 but did not
have any luck. The libzmq.dll worked with pymatbridge-0.2 .. I did not
attempt to create the mexw64 myself yet.


Reply to this email directly or view it on GitHubhttps://github.com//pull/56#issuecomment-43103034
.

@bs448c
Copy link

bs448c commented May 14, 2014

I see! Unfortunately I have no choice of OS. The ZMQ 3.2.4 I was using before was prebuilt anyways.

I have in the meanwhile built ZMQ 3.2.4 from source myself using mingw32 and following these pieces of advise

(as upon building during the automatically performed test runs, I was running into the nanosleep problem: http://grokbase.com/t/zeromq/zeromq-dev/137at84mx8/problems-with-installation-under-mingw; i.e. using this https://github.com/zeromq/zeromq3-x/blob/master/builds/mingw32/Makefile.mingw32 Makefile)

(I did not manage to build in Visual C++ 2010 following the advise of how "To build on Windows" on http://zeromq.org/area:download) .. it was complaining about an "old solution" when opening the solution in builds\msvc\msvc.sln and wanted to do some conversion and there was some obscure stuff going and I gave up)

From my MinGW build with the modified Makefile.mingw32 I obtain a libzmq.dll that I put in my PATH. I then rebuild pymatbridge-0.3-dev (using MinGW as well) which succeeds, and I can import it in iPython; however I get the same mexw64 error as described previously when trying to fire things up

I reckon I will have to settle for pymatbrigde-0.2 and only exchange real valued arrays for now ...

I would still appreciate detailed build instructions for the messenger

@aebrahim
Copy link
Contributor Author

I won't have time to look into this issue for a few weeks, but I'm not even
sure what I could do, because it worked on my system just fine so it's hard
to know what the issue is. The computer that I used to build this is no
more, so I can't easily go tell you exactly what the build configuration
was. Here is what I remember I did:

  1. Download and install the pre-built version. It was too hard to compile
    from source.
  2. copy the libzmq.lib and the .h header file from the folder it was
    installed in Program Files to the build directory
  3. Run mcc

After I patched the source and got everything working (which was kind of
simple), the build was pretty simple, at least on my system.

Just checking... you are running 64 bit matlab and zmq right?

If you're stuck with Windows and end up being unable to build this, can you
run the MATLAB installation in a linux virtual machine, and communicate
with it over tcp? Alternately, install the entire IPython stack on a
virtual machine and use the notebook?

On Wed, May 14, 2014 at 11:07 AM, bs448c notifications@github.com wrote:

I see! Unfortunately I have no choice of OS. The ZMQ 3.2.4 I was using
before was prebuilt anyways.

I have in the meanwhile built ZMQ 3.2.4 from source myself using mingw32
and following these pieces of advise

(as upon building during the automatically performed test runs, I was
running into the nanosleepproblem):
http://grokbase.com/t/zeromq/zeromq-dev/137at84mx8/problems-with-installation-under-mingw(i.e. using this
https://github.com/zeromq/zeromq3-x/blob/master/builds/mingw32/Makefile.mingw32
Makefile`)

(I did not manage to build in Visual C++ 2010 following the advise of
how "To build on Windows" on http://zeromq.org/area:download) .. it was
complaining about an "old solution" when opening the solution in
builds\msvc\msvc.sln there was some obscure stuff going on so I gave up)

From my MinGW build I obtain a libzmq.dll that I put in my PATH. I then
rebuild pymatbridge-0.3-dev (using MinGW as well) which succeeds, and I can
import it in iPython; however I get the same mexw64 error as described
previously when trying to fire things up

I reckon I will have to settle for pymatbrigde-0.2 and only exchange real
valued arrays for now ...

I would still appreciate detailed build instructions for the messenger


Reply to this email directly or view it on GitHubhttps://github.com//pull/56#issuecomment-43116182
.

@bs448c
Copy link

bs448c commented May 15, 2014

I have managed to successfully build the messenger now.

Here's the steps I went through:

  1. Install MS Visual C++ & SDK 7.1 from http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe
  2. run mex -setup in the Windows SDK 7.1 Command Prompt and select the newly installed compiler
  3. install the prebuilt 64 bit ZMQ 3.2.4 from http://miru.hk/archive/ZeroMQ-3.2.4~miru1.0-x64.exe
  4. copy libzmq-v90-mt_3_2_4.lib from the ZMQ 3.2.4 install location, C:\Program Files\ZeroMQ 3.2.4\lib and libzmq-v90-mt_3_2_4.dll from C:\Program Files\ZeroMQ 3.2.4\bin to the messenger build directory, ~\python-matlab-bridge\messenger\src
  5. I also put zmq.h and zmq_utils.h into that directory but as of now am unsure if they are necessary
  6. in the Windows SDK 7.1 Command Prompt, I cd into the messenger\src directory and issue mex messenger.c libzmq-v90-mt-3_2_4.lib -O -output messenger to obtain a messenger.mexw64
  7. in the ~\python-matlab-bridge directory, using MinGW, I python setup.py install. My gcc is TDM-GCC 4.8.1 if that is of any relevance.
  8. This automatically puts the built package into my Anaconda\Lib\site-packages along with an egg info. In Anaconda\Lib\site-packages\pymatbridge\matlab there is the messenger.mexw64 that was built in step 6 -- from ~\python-matlab-bridge\messenger\src I also copy to Anaconda\Lib\site-packages\pymatbridge\matlab all other .dlls, .libs and .hs for good measure.
  9. in the iPython 2.7 console, I can now %load_ext pymatbridge successfully.

@bs448c
Copy link

bs448c commented May 15, 2014

I created a new issue #69 to make the building steps more visible

sterlinm referenced this pull request Jul 25, 2014
1. Increment the version to be 0.3
2. In the setup, copy all versions of the messenger.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants