raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / Atom feed
* raindrops fails to install with ruby 2.2.2
@ 2015-07-09 21:47 Doug Forster
  2015-07-14 20:18 ` Eric Wong
  2015-07-14 20:23 ` Hleb Valoshka
  0 siblings, 2 replies; 3+ messages in thread
From: Doug Forster @ 2015-07-09 21:47 UTC (permalink / raw)
  To: raindrops-public

Problem seems to be the removal of rb_thread_blocking_region in ruby.

System Info:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-musl]
alpine linux
apk --update add ruby ruby-dev build-base

Build output:
/ # gem install unicorn
Fetching: raindrops-0.14.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing unicorn:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby -r ./siteconf20150709-14-j1t8nj.rb extconf.rb
checking for mmap() in sys/mman.h... yes
checking for munmap() in sys/mman.h... yes
checking for mremap() in sys/mman.h... yes
checking for getpagesize() in unistd.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_io_blocking_region()... yes
checking for GCC 4+ atomic builtins... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling linux_tcp_info.c
linux_tcp_info.c:5:23: fatal error: linux/tcp.h: No such file or directory
 #include <linux/tcp.h>
                       ^
compilation terminated.
Makefile:237: recipe for target 'linux_tcp_info.o' failed
make: *** [linux_tcp_info.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/usr/lib/ruby/gems/2.2.0/gems/raindrops-0.14.0 for inspection.
Results logged to
/usr/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/raindrops-0.14.0/gem_make.out

Other file:
/ # cat
/usr/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/raindrops-0.14.0/mkmf.log
have_func: checking for mmap() in sys/mman.h... -------------------- yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -Os -fomit-frame-pointer -fno-omit-frame-pointer
-fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed
-fstack-protector -rdynamic -Wl,-export-dynamic     -lruby  -lpthread -ldl
-lcrypt -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -Os -fomit-frame-pointer -fno-omit-frame-pointer
-fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed
-fstack-protector -rdynamic -Wl,-export-dynamic     -lruby  -lpthread -ldl
-lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <sys/mman.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))mmap; return 0;
}
/* end */

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

have_func: checking for munmap() in sys/mman.h... -------------------- yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -Os -fomit-frame-pointer -fno-omit-frame-pointer
-fno-strict-aliasing -fPIC conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed
-fstack-protector -rdynamic -Wl,-export-dynamic     -lruby  -lpthread -ldl
-lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <sys/mman.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))munmap; return
0; }
/* end */

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

have_func: checking for mremap() in sys/mman.h... -------------------- yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -Os -fomit-frame-pointer
-fno-omit-frame-pointer -fno-strict-aliasing -fPIC conftest.c  -L.
-L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <sys/mman.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))mremap; return
0; }
/* end */

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

have_func: checking for getpagesize() in unistd.h... --------------------
yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: #include <unistd.h>
 4:
 5: /*top*/
 6: extern int t(void);
 7: int main(int argc, char **argv)
 8: {
 9:   if (argc > 1000000) {
10:     printf("%p", &t);
11:   }
12:
13:   return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))getpagesize;
return 0; }
/* end */

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

have_func: checking for rb_thread_blocking_region()... --------------------
no

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function 't':
conftest.c:13:57: error: 'rb_thread_blocking_region' undeclared (first use
in this function)
 int t(void) { void ((*volatile p)()); p = (void
((*)()))rb_thread_blocking_region; return 0; }
                                                         ^
conftest.c:13:57: note: each undeclared identifier is reported only once
for each function it appears in
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void
((*)()))rb_thread_blocking_region; return 0; }
/* end */

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
/tmp/ccEklkdf.o: In function `t':
conftest.c:(.text+0x7): undefined reference to `rb_thread_blocking_region'
collect2: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { rb_thread_blocking_region(); return 0; }
/* end */

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

have_func: checking for rb_thread_io_blocking_region()...
-------------------- yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
conftest.c: In function 't':
conftest.c:13:57: error: 'rb_thread_io_blocking_region' undeclared (first
use in this function)
 int t(void) { void ((*volatile p)()); p = (void
((*)()))rb_thread_io_blocking_region; return 0; }
                                                         ^
conftest.c:13:57: note: each undeclared identifier is reported only once
for each function it appears in
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { void ((*volatile p)()); p = (void
((*)()))rb_thread_io_blocking_region; return 0; }
/* end */

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: /*top*/
 4: extern int t(void);
 5: int main(int argc, char **argv)
 6: {
 7:   if (argc > 1000000) {
 8:     printf("%p", &t);
 9:   }
10:
11:   return 0;
12: }
13: int t(void) { rb_thread_io_blocking_region(); return 0; }
/* end */

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

checking for GCC 4+ atomic builtins... -------------------- yes

"gcc -o conftest -I/usr/include/ruby-2.2.0/x86_64-linux-musl
-I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -Os
-fomit-frame-pointer   -D_GNU_SOURCE  -D_BSD_SOURCE  -Os
-fomit-frame-pointer -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
conftest.c  -L. -L/usr/lib -L. -Wl,--as-needed -fstack-protector -rdynamic
-Wl,-export-dynamic     -lruby  -lpthread -ldl -lcrypt -lm   -lc"
checked program was:
/* begin */
 1: #include "ruby.h"
 2:
 3: int main(int argc, char * const argv[]) {
 4:         unsigned long i = 0;
 5:         __sync_lock_test_and_set(&i, 0);
 6:         __sync_lock_test_and_set(&i, 1);
 7:         __sync_bool_compare_and_swap(&i, 0, 1);
 8:         __sync_add_and_fetch(&i, argc);
 9:         __sync_sub_and_fetch(&i, argc);
10:         return 0;
11: }
/* end */

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: raindrops fails to install with ruby 2.2.2
  2015-07-09 21:47 raindrops fails to install with ruby 2.2.2 Doug Forster
@ 2015-07-14 20:18 ` Eric Wong
  2015-07-14 20:23 ` Hleb Valoshka
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2015-07-14 20:18 UTC (permalink / raw)
  To: Doug Forster; +Cc: raindrops-public

Please don't send HTML portions in email, it is bloated and spammy
and incompatible with lists we may Cc:

...And I expect musl users to care about bloat like that :>

Doug Forster <doug.forster@gmail.com> wrote:
> Problem seems to be the removal of rb_thread_blocking_region in ruby.

Actually, that's a red herring, raindrops 0.13.0 onwards accounts
for that.

> System Info:
> ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-musl]
> alpine linux


> make "DESTDIR="
> compiling linux_tcp_info.c
> linux_tcp_info.c:5:23: fatal error: linux/tcp.h: No such file or directory
>  #include <linux/tcp.h>
>                        ^
> compilation terminated.
> Makefile:237: recipe for target 'linux_tcp_info.o' failed
> make: *** [linux_tcp_info.o] Error 1
> 
> make failed, exit code 2

This is the problem, raindrops blindly assumed Linux machines all have
linux/tcp.h header.  I've added a check for that.

I'll push out the patch below and release 0.14.1 final soon.

I've pushed out raindrops 0.14.0.1.g8177 with the patch below.

You should be able to install it using:

	gem install --pre raindrops -v 0.14.0.1.g8177

If possible, can you test and make sure there's no other issues?
Thanks.

------------------------------ 8< ----------------------------
From: Eric Wong <e@80x24.org>
Date: Tue, 14 Jul 2015 20:08:49 +0000
Subject: [PATCH] check for the existence of linux/tcp.h

The linux/tcp.h header may not exist on alternative libc
implementations such as musl.

Noticed-by: Doug Forster <doug.forster@gmail.com>
---
 ext/raindrops/extconf.rb       | 1 +
 ext/raindrops/linux_tcp_info.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ext/raindrops/extconf.rb b/ext/raindrops/extconf.rb
index f012808..74ed8f9 100644
--- a/ext/raindrops/extconf.rb
+++ b/ext/raindrops/extconf.rb
@@ -6,6 +6,7 @@
 
 $CPPFLAGS += " -D_GNU_SOURCE "
 have_func('mremap', 'sys/mman.h')
+have_header('linux/tcp.h')
 
 $CPPFLAGS += " -D_BSD_SOURCE "
 have_func("getpagesize", "unistd.h")
diff --git a/ext/raindrops/linux_tcp_info.c b/ext/raindrops/linux_tcp_info.c
index dcdb153..5e25d4d 100644
--- a/ext/raindrops/linux_tcp_info.c
+++ b/ext/raindrops/linux_tcp_info.c
@@ -1,4 +1,4 @@
-#ifdef __linux__
+#if defined(__linux__) && defined(HAVE_LINUX_TCP_H)
 #include <ruby.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -170,4 +170,4 @@ void Init_raindrops_linux_tcp_info(void)
 	TCPI_DEFINE_METHOD(total_retrans);
 }
 #endif /* TCP_INFO */
-#endif /* __linux__ */
+#endif /* defined(__linux__) && defined(HAVE_LINUX_TCP_H) */
-- 
EW

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: raindrops fails to install with ruby 2.2.2
  2015-07-09 21:47 raindrops fails to install with ruby 2.2.2 Doug Forster
  2015-07-14 20:18 ` Eric Wong
@ 2015-07-14 20:23 ` Hleb Valoshka
  1 sibling, 0 replies; 3+ messages in thread
From: Hleb Valoshka @ 2015-07-14 20:23 UTC (permalink / raw)
  To: raindrops-public

On 7/10/15, Doug Forster <doug.forster@gmail.com> wrote:

> Problem seems to be the removal of rb_thread_blocking_region in ruby.

Not, see your message better.

> compiling linux_tcp_info.c
> linux_tcp_info.c:5:23: fatal error: linux/tcp.h: No such file or directory
>  #include <linux/tcp.h>
>                        ^
> compilation terminated.
> Makefile:237: recipe for target 'linux_tcp_info.o' failed
> make: *** [linux_tcp_info.o] Error 1
>
> make failed, exit code 2

Here is the reason. You should install Linux support headers for
userspace development. In Debian and derivatives it's linux-libc-dev.
How it's called in your distro I don't know.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 21:47 raindrops fails to install with ruby 2.2.2 Doug Forster
2015-07-14 20:18 ` Eric Wong
2015-07-14 20:23 ` Hleb Valoshka

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox