-
Notifications
You must be signed in to change notification settings - Fork 636
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
python binding installation fails under cygwin #113
Comments
also reported at https://zeromq.jira.com/browse/LIBZMQ-219 |
I should note that the configure step that failed hasn't done anything Python related yet, it's just trying to build and run the simplest pure-C program to print the libzmq version. See here for the contents of the program that's failing to link. I think libzmq is not built properly if such a simple program doesn't work. |
It looks like the program is not linked with libstdc++ which it should be. |
@sustrik Is this a problem with the libzmq build itself, or should programs linking against libzmq have to explicitly include libstdc++? This appears unique to cygwin. |
The problem is with C programs linking with libzmq. C doesn't link in C++ runtime (libstdc++) automatically, so you have to link it by hand (-lstdc++). No idea what the actual problem here is, but the errors point to not having C++ runtime available. |
Okay, so this is only an issue when libzmq is a static library, as the dynamic library links libstc++ explicitly. Apparently nobody uses pyzmq with static libzmq, or this would have come up sooner. I removed my dynamic library, and after specifying that just the detect program be linked to libstdc++, the rest of pyzmq still built and ran fine. That would suggest that l don't need to add stdc++ to libraries for each individual Python extension, rather just the little test program, but I don't know if that's quite accurate. @jtmoon I have done this in my stdc++ branch (here), so if you can test it, that would be great. If you get past detect, and then see the same errors when you actually try to use pyzmq, I will add stdc++ to the libraries to link on the actual extensions. |
@minrk FAILED with a different error. Instead of a long list of reference errors there was 4 reference errors to _uuid functions.
-J_Tom_Moon_79 |
@jtmoon79, right - there are other libraries that it needs besides stdc++ when it's static, silly me for testing on OSX. It will need There seems to be a general problem with using static libraries, so it shouldn't be a cygwin-specific fix (though cygwin does appear to be the only place that people are trying to use a static libzmq with pyzmq). @sustrik - is there a good way to detect ahead of time whether a library will be linked as static or dynamic? |
When you link with static libzmq.a, all the dependencies are static as well. If you link with dynamic libzmq.so the dependencies are dynamic as well. |
Yes, but what I need is a way to find out whether libzmq is static before linking against it, because I need to pass different arguments to the linker if it is. Essentially I want a command that returns the answer to the question: 'if I pass -lfoo to gcc, what file will it use for libfoo?' |
@jtmoon79 Just out of curiosity, are you deliberately choosing statlic libzmq, or did the zeromq installer not build the dynamic libraries? |
@minrk The libzmq installed using the default configuration from package zeromq-2.1.7.zip (see the original posted reproduction steps above). So however zeromq-2.1.7 normally builds and installs under cygwin, that's what happened. If you need, I can post more output captured from the build and installation of libmzq. |
@sustrik - do you know why libzmq doesn't build dynamic libraries by default on Cygwin unlike everywhere else? |
No idea. This is more a question for build system maintainers, Mikko Koppanen and Martin Lucina. What about complaining on the mailing list? |
@sustrik - I setup a simple cygwin environment, and it looks like just about everything is static, so maybe that's why. I tweaked the detection so it builds a shared-lib instead of an executable. The result is that general config (like LDFLAGS) should now affect the detect program the same as extensions. @jtmoon79 Can you get my |
@minrk Failed. I re-compiled everything just to verify. Output below. -J_Tom_Moon_79 |
I just noticed that my last commend never got posted. Those symbols are in stdc++, I have no idea why they wouldn't be found when explicitly linking against it. If you succeed in compiling/running a simple c-program (not c++) with libzmq, please post flags/etc. here. For now, I am officially punting, and saying that pyzmq requires a dynamic libzmq, at least on cygwin. |
I have no idea how to help here. Mikko or Mato may be able to figure out what's going on here better than I do. |
Those symbols are in stdc++, I have no idea why they wouldn't be found when explicitly linking against it. -J_Tom_Moon_79 |
I did manage to build against a static lib (target is Android), using CC="xxxx-g++" and the libraries available in the same folder as libzmq so that the -L with the path to libstdc++ is in the search path. I am stuck though with passing -luuid as (at least for my cross compilation scenario) LDFLAGS and LDSHARED do not affect the flags and I need to pass in -luuid after the already included -lzmq to be able to link. I tried to compile vers.c manually and did succeed that way => the next step is to tweak pyzmp setup.py to link against uuid. Edit: |
cyrilh - If you are cross compiling, you can just skip the detect step. There isn't a flag for it, but you can just comment it out / return from the function immediately. |
I have some hints for linking to libstdc++ issue, probably from most relevant to least relevant
minrk - Thanks, I did manage with very little tweaking to import zmq from python-for-android. I will create my issue to try to have it pulled on git and documented. |
Hi, Just throwing this out there... Does any cygwin users out there have any hints as to why this is happening? Is the build missing headers? I've had unsuccessful attempts at building, running setup.py, and easy_install on cygwin windows 7 machine. Thanks. (5:52pm)Loc: /cygdrive/c/Users/Jonas/setup_ running install Configure: Autodetecting ZMQ settings... error: command 'gcc' failed with exit status 1 Failed with default libzmq, trying again with /usr/local Configure: Autodetecting ZMQ settings... error: command 'gcc' failed with exit status 1 Failed to build or run libzmq detection test. If you expected pyzmq to link against an installed libzmq, please check to make sure:
You can skip all this detection/waiting nonsense if you know
I will now try to build libzmq as a Python extension 1... Using bundled libzmq Fatal: Cython-generated file 'zmq/core/_device.c' not found. |
Here are my notes from a successful Cygwin64 build using hashstack: I've seen other tools in this space working with libtool, but I wasn't able to get it working with some fiddling, so I just bailed out and built the shared library by hand from the resulting static compile. Set ARTIFACT to wherever you'd like to install things. 0mq install
pyzmq install
|
Thanks, that sounds like I can close this. Unless you see something that pyzmq should be doing differently? |
@minrk I don't have any patches for pyzmq. You may want to update documentation pointing out that a Cygwin install is doable (with some hacking around the ZeroMQ shared library build). Thanks for your help. |
Thanks, I'll try to point people here. |
Just a note that UUID is currently broken on Cygwin64 Python. This will bite you if you are trying to install a usable IPython stack. Some more information here: http://permalink.gmane.org/gmane.comp.python.ipython.devel/11239 |
Compiling the python binding under cygwin fails.
This may be a problem with zeromq linking to libraries. However, pyzmq brings out the problem.
The undefined references are to many different libraries. I may re-post this error at zeromq.
-J_Tom_Moon_79
The text was updated successfully, but these errors were encountered: