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

Build fail because sys/eventfd.h not available on Cygwin32 #747

Closed
nowox opened this issue Nov 9, 2015 · 8 comments
Closed

Build fail because sys/eventfd.h not available on Cygwin32 #747

nowox opened this issue Nov 9, 2015 · 8 comments

Comments

@nowox
Copy link

nowox commented Nov 9, 2015

Although this question as been asked many times with different words, I still did not find a solution yet.

I was able to successfully install zeromq with this Makefile snippet:

zeromq: zeromq-4.1.3.tar.gz
    tar xvzf $<
    cd $(patsubst %.tar.gz,%, $<) && ./configure
    patch $(patsubst %.tar.gz,%, $<)/src/curve_client.cpp curve_client.patch
    patch $(patsubst %.tar.gz,%, $<)/src/curve_server.cpp curve_server.patch
    cd $(patsubst %.tar.gz,%, $<) && make
    cd $(patsubst %.tar.gz,%, $<) && make install
    rm -rf $(patsubst %.tar.gz,%, $<)

Where the patch I made was because of a warning treated as an error:

$ cat curve_client.patch
61c61
<     sodium_init();

---
>     zmq_assert (sodium_init() == 0);

The build of pyzmq-14.7.0.tar.gz fail with this:

$ python setup.py install
running install
running build
running build_py
running build_ext
running configure
************************************************
Using bundled libzmq
already have bundled/zeromq
already have platform.hpp
************************************************
checking for timer_create
cc -c /tmp/timer_createtkc5eI.c -o build/temp.cygwin-2.1.0-i686-2.7/tmp/timer_createtkc5eI.o
cc build/temp.cygwin-2.1.0-i686-2.7/tmp/timer_createtkc5eI.o -o build/temp.cygwin-2.1.0-i686-2.7/a.out.exe
ok
************************************************
Using bundled libsodium
already have bundled/libsodium
already have crypto_scalarmult_curve25519.h
already have crypto_stream_salsa20.h
already have version.h
************************************************
building 'zmq.libzmq' extension
...
...
...
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
bundled/zeromq/src/signaler.cpp:62:25: fatal error: sys/eventfd.h: No such file or directory
 #include <sys/eventfd.h>
                         ^
compilation terminated.
error: command 'gcc' failed with exit status 1

According to #467 I patched bundled/zeromq/src/platform.hpp

$ diff pyzmq-14.7.0/bundled/zeromq/src/platform.hpp platform.hpp.new
70c70
< /* #undef HAVE_LIBSODIUM */

---
> #define HAVE_LIBSODIUM 1
115c115
< #define HAVE_SYS_EVENTFD_H 1

---
> #undef HAVE_SYS_EVENTFD_H
195c195
<

---
> #define ZMQ_HAVE_CYGWIN
197c197
< #define ZMQ_HAVE_EVENTFD 1

---
> //#define ZMQ_HAVE_EVENTFD 1
236c236
< #define ZMQ_HAVE_SOCK_CLOEXEC 1

---
> #undef ZMQ_HAVE_SOCK_CLOEXEC

And this time I get this error:

cygwin-2.1.0-i686-2.7/bundled/zeromq/src/tcp.o
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
bundled/zeromq/src/tcp.cpp: In function ‘void zmq::tune_tcp_keepalives(zmq::fd_t, int, int, int, int)’:
bundled/zeromq/src/tcp.cpp:125:51: error: ‘TCP_KEEPCNT’ was not declared in this scope
             int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPCNT, &keepalive_cnt_, sizeof (int));
                                                   ^
bundled/zeromq/src/tcp.cpp:132:51: error: ‘TCP_KEEPIDLE’ was not declared in this scope
             int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPIDLE, &keepalive_idle_, sizeof (int));
                                                   ^
bundled/zeromq/src/tcp.cpp:146:51: error: ‘TCP_KEEPINTVL’ was not declared in this scope
             int rc = setsockopt (s_, IPPROTO_TCP, TCP_KEEPINTVL, &keepalive_intvl_, sizeof (int));
                                                   ^
error: command 'gcc' failed with exit status 1

When also disabling TCP_KEEP* and LIBSODIUM I eventually have linking issues:

q/devices/monitoredqueue.dll
build/temp.cygwin-2.1.0-i686-2.7/zmq/devices/monitoredqueue.o: In function `_pyx_f_3zmq_7backend_6cython_7checkrc__ch                                             eck_rc':
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1438: undefined reference to `zmq_errno'
build/temp.cygwin-2.1.0-i686-2.7/zmq/devices/monitoredqueue.o: In function `_pyx_pf_3zmq_7devices_14monitoredqueue_mo                                             nitored_queue':
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1164: undefined reference to `zmq_msg_init_size'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1182: undefined reference to `zmq_msg_size'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1182: undefined reference to `zmq_msg_data'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1202: undefined reference to `zmq_msg_init_size'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1243: undefined reference to `zmq_msg_size'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:1243: undefined reference to `zmq_msg_data'
...
...
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:3549: undefined reference to `zmq_msg_copy'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:3571: undefined reference to `zmq_msg_send'
/usr/src/pyzmq-14.7.0/zmq/devices/monitoredqueue.c:3593: undefined reference to `zmq_msg_send'
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

What can I do next?

To me #113 is a different issue and #467 was not solved yet...

Update

I realized that the setup is falling back on the bundled libzmq while I was able to successfully install libzmq. When I execute:

python setup.py install --zmq=/usr/local

I have a lot of undefined references that I don't understand:

/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x0): undefined reference to `operator new(unsigned long)'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x10): undefined reference to `operator delete(void*)'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x20): undefined reference to `operator new(unsigned long, std::nothrow_t const&)'
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x30): undefined reference to `operator delete(void*, std::nothrow_t const&)'
collect2: error: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

Fatal: Falling back on bundled libzmq, but setup.cfg has explicitly prohibited building the libzmq extension.
@minrk
Copy link
Member

minrk commented Nov 10, 2015

Can you run ./configure in zeromq-4.1.3 and post your platform.hpp?

@nowox
Copy link
Author

nowox commented Nov 10, 2015

Eventually I did it...

all: zeromq
zeromq: zeromq-4.1.3.tar.gz
    @echo -e '\e[1;32mInstalling $(strip $<)\e[0m' 
    if [ ! -f /usr/lib/libzmq.dll.a ]; then \
        tar xvzf $<; \
        cd $(patsubst %.tar.gz,%, $<); \
        ./configure; \
        patch src/curve_client.cpp ../curve_client.patch; \
        patch src/curve_server.cpp ../curve_server.patch; \
        make -j4; \
        make install; \
        gcc -shared -o cygzmq.dll -Wl,--out-implib=libzmq.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive .libs/libzmq.a -Wl,--no-whole-archive -lstdc++ -L/usr/local/lib -lsodium; \
        cp src/libzmq.pc /usr/lib/pkgconfig/; \
        cp include/zmq.h /usr/include/; \
        cp include/zmq_utils.h /usr/include/; \
        cp cygzmq.dll /usr/bin/; \
        cp libzmq.dll.a /usr/lib/; \
        cd .. && rm -rf $(patsubst %.tar.gz,%, $<); \
    else \
        echo -e '   \e[1;33mDone\e[0m\n'; \
    fi

all: pyzmq
pyzmq: pyzmq-14.7.0.tar.gz
    @echo -e '\e[1;32mInstalling $(strip $2)\e[0m' 
    if ! python -c 'import $@'; then \
        cd $(patsubst %.tar.gz,%, $<); \
        python setup.py build_ext --zmq=/usr; \
        python setup.py test --zmq=/usr; \
        python setup.py install --zmq=/usr; \
        cd .. && rm -rf $(patsubst %.tar.gz,%, $<); \
    else \
        echo -e '   \e[1;33mDone\e[0m\n'; \
    fi     

@ofaurax
Copy link

ofaurax commented Dec 15, 2015

Same here. This breaks "pip install jupyter" from cygwin.

@myloginid
Copy link

This fails on Cygwin 64 also :-(

@ptizoom
Copy link

ptizoom commented Jan 2, 2017

any update on this!?
is there a replacement for envenfd under cygwin ?

@dariushazimi
Copy link

@minrk
Fails on Windows 7. Here are the details.
Os; Windows 7
Platform: Babun Terminal on windows with Zsch
Both python 2 and 3.x
Here is the output of python -c 'import pprint,pip.pep425tags; pprint.pprint(pip.pep425tags.get_supported())'

 ✘ / ~ > `python -c 'import pprint,pip.pep425tags; pprint.pprint(pip.pep425tags.get_supported())'`
[('cp27', 'cp27m', 'cygwin_2_6_1_i686'),
 ('cp27', 'none', 'cygwin_2_6_1_i686'),
 ('py2', 'none', 'cygwin_2_6_1_i686'),
 ('cp27', 'none', 'any'),
 ('cp2', 'none', 'any'),
 ('py27', 'none', 'any'),
 ('py2', 'none', 'any'),
 ('py26', 'none', 'any'),
 ('py25', 'none', 'any'),
 ('py24', 'none', 'any'),
 ('py23', 'none', 'any'),
 ('py22', 'none', 'any'),
 ('py21', 'none', 'any'),
 ('py20', 'none', 'any')]
And here is the output of pip3 install jupyter or pip install jupyter
    /tmp/Darius/timer_create9rqqtoq6.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^
    /tmp/Darius/timer_create9rqqtoq6.c: In function ‘main’:
    /tmp/Darius/timer_create9rqqtoq6.c:2:5: warning: implicit declaration of function ‘timer_create’                                                                               [-Wimplicit-function-declaration]
         timer_create();
         ^
    cc build/temp.cygwin-2.6.1-i686-3.4/tmp/Darius/timer_create9rqqtoq6.o -o build/temp.cygwin-2.6.1                                                                              -i686-3.4/a.out.exe
    ok
    ************************************************
    building 'zmq.libzmq' extension
    creating build/temp.cygwin-2.6.1-i686-3.4/buildutils
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq/src
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq/tweetnacl
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq/tweetnacl/src
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq/tweetnacl/contrib
    creating build/temp.cygwin-2.6.1-i686-3.4/bundled/zeromq/tweetnacl/contrib/randombytes
    gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -ggdb -O2 -pipe -Wimpli                                                                              cit-function-declaration -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.i686/build=/usr/s                                                                              rc/debug/python3-3.4.5-1 -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.i686/src/Python-3                                                                              .4.5=/usr/src/debug/python3-3.4.5-1 -DZMQ_HAVE_CURVE=1 -DZMQ_USE_TWEETNACL=1 -DZMQ_USE_POLL=1 -Ibund                                                                              led/zeromq/include -Ibundled/zeromq/tweetnacl/src -Ibundled/zeromq/tweetnacl/contrib/randombytes -Ib                                                                              undled -I/usr/include/python3.4m -c buildutils/initlibzmq.c -o build/temp.cygwin-2.6.1-i686-3.4/buil                                                                              dutils/initlibzmq.o
    buildutils/initlibzmq.c:10:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/Darius/pip-build-66w7hu2                                                                              4/pyzmq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.                                                                              close();exec(compile(code, __file__, 'exec'))" install --record /tmp/Darius/pip-nr1y502z-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/Darius/pip-build-66w7hu24/pyzmq/

@fenchu
Copy link

fenchu commented Jul 3, 2017

Hi
Came here because 'pip3 install jupyter' failed on pyzmq installation.

I already had a working python3.6.1 with ipython3 in cygwin64 on win7
It was solved by first updating everything pending on latest cygwin64 2.8.0
download, compile and install zeromq-4.2.1.tar.gz and then just running pip3 install jupyter in the same directory:

cd /tmp
wget https://github.com/zeromq/libzmq/releases/download/v4.2.1/zeromq-4.2.1.tar.gz
cd zeromq-4.2.1
./configure
make
make install
pip3 install jupyter
# Successfully installed bleach-2.0.0 entrypoints-0.2.3 html5lib-0.999999999 ipykernel-4.6.1 ipywidgets-6.0.0 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.1.0 jupyter-console-5.1.0 mistune-0.7.4 nbconvert-5.2.1 nbformat-4.3.0 notebook-5.0.0 pandocfilters-1.4.1 qtconsole-4.3.0 termin
ado-0.6 testpath-0.3.1 webencodings-0.5.1 widgetsnbextension-2.0.0

cd
jupyter notebook password
# <enter password twice>
jupyter notebook --no-browser
# then open your favorite browser in http://localhost:8888
# <You are asked to enter password, then you are in>

@minrk
Copy link
Member

minrk commented Feb 27, 2024

The new build system for v26 prerelease runs the standard libzmq build instead of the setup, so I believe this should be resolved. Please feel free to test and open new issues against v26.

@minrk minrk closed this as completed Feb 27, 2024
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

No branches or pull requests

7 participants