socketry / nio4r

Cross-platform asynchronous I/O primitives for scalable network clients and servers.
Other
965 stars 86 forks source link

Error installing 2.5.9 on M1 w. ruby 3.3.0-dev #304

Closed av-emil closed 8 months ago

av-emil commented 8 months ago

While this looks like a duplicate of https://github.com/socketry/nio4r/issues/298 I don't believe it's exactly the same.

I'm installing on M1 with Ruby 3.3.0-dev (installed via rbenv.

checking for unistd.h... yes
checking for linux/aio_abi.h... no
checking for linux/io_uring.h... no
checking for sys/select.h... yes
checking for port_event_t in poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port_event_t in port.h... no
checking for sys/resource.h... yes
creating Makefile

current directory: /Users/my-user/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/nio4r-2.5.9/ext/nio4r
make DESTDIR\= sitearchdir\=./.gem.20231115-23601-89yc4h sitelibdir\=./.gem.20231115-23601-89yc4h clean

current directory: /Users/my-user/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/nio4r-2.5.9/ext/nio4r
make DESTDIR\= sitearchdir\=./.gem.20231115-23601-89yc4h sitelibdir\=./.gem.20231115-23601-89yc4h
compiling bytebuffer.c
bytebuffer.c:296:23: error: incomplete definition of type 'struct rb_io'
    bytes_read = read(FPTR_TO_FD(fptr), buffer->buffer + buffer->position, nbytes);
                      ^          ~~~~
./nio4r.h:46:30: note: expanded from macro 'FPTR_TO_FD'
#define FPTR_TO_FD(fptr) fptr->fd
                         ~~~~^
/Users/my-user/.rbenv/versions/3.3.0-dev/include/ruby-3.3.0+0/ruby/internal/core/rfile.h:29:8: note: forward declaration of 'struct rb_io'
struct rb_io;
       ^
bytebuffer.c:308:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    return INT2NUM(bytes_read);
           ~~~~~~~ ^~~~~~~~~~
bytebuffer.c:326:27: error: incomplete definition of type 'struct rb_io'
    bytes_written = write(FPTR_TO_FD(fptr), buffer->buffer + buffer->position, nbytes);
                          ^          ~~~~
./nio4r.h:46:30: note: expanded from macro 'FPTR_TO_FD'
#define FPTR_TO_FD(fptr) fptr->fd
                         ~~~~^
/Users/my-user/.rbenv/versions/3.3.0-dev/include/ruby-3.3.0+0/ruby/internal/core/rfile.h:29:8: note: forward declaration of 'struct rb_io'
struct rb_io;
       ^
bytebuffer.c:338:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    return INT2NUM(bytes_written);
           ~~~~~~~ ^~~~~~~~~~~~~
2 warnings and 2 errors generated.
make: *** [bytebuffer.o] Error 1

make failed, exit code 2
ioquatix commented 8 months ago

Ah thanks, I'll sort it out.

ioquatix commented 8 months ago

Can you please try installing nio4r v2.6.0 and see if that fixes the issues for you? Thanks!

ioquatix commented 8 months ago

This works on my computer :)