{"action":"reopened","issue":{"url":"https://api.github.com/repos/phusion/passenger/issues/1846","repository_url":"https://api.github.com/repos/phusion/passenger","labels_url":"https://api.github.com/repos/phusion/passenger/issues/1846/labels{/name}","comments_url":"https://api.github.com/repos/phusion/passenger/issues/1846/comments","events_url":"https://api.github.com/repos/phusion/passenger/issues/1846/events","html_url":"https://github.com/phusion/passenger/issues/1846","id":167596091,"number":1846,"title":"Errors printed in mkmf.log during building native libraries.","user":{"login":"vov-crao","id":4724998,"avatar_url":"https://avatars.githubusercontent.com/u/4724998?v=3","gravatar_id":"","url":"https://api.github.com/users/vov-crao","html_url":"https://github.com/vov-crao","followers_url":"https://api.github.com/users/vov-crao/followers","following_url":"https://api.github.com/users/vov-crao/following{/other_user}","gists_url":"https://api.github.com/users/vov-crao/gists{/gist_id}","starred_url":"https://api.github.com/users/vov-crao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vov-crao/subscriptions","organizations_url":"https://api.github.com/users/vov-crao/orgs","repos_url":"https://api.github.com/users/vov-crao/repos","events_url":"https://api.github.com/users/vov-crao/events{/privacy}","received_events_url":"https://api.github.com/users/vov-crao/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phusion/passenger/labels/SupportCentral","name":"SupportCentral","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-26T12:34:16Z","updated_at":"2016-09-01T10:36:11Z","closed_at":null,"body":"Hello.\r\n\r\nDuring building native support libraries for passenger I have found in /buildout/ruby/ruby-2.1.8-x86_64-linux/mkmf.log file error messages:\r\n\r\nhave_var: checking for ruby_version... -------------------- no\r\n\r\n\"gcc -I/opt/alt/ruby21/include/ruby-2.1.0/x86_64-linux-gnu -I/opt/alt/ruby21/include/ruby-2.1.0/rub\r\ny/backward -I/opt/alt/ruby21/include/ruby-2.1.0 -I/opt/passenger-httpd24/src/ruby_native_extension\r\n   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-siz\r\ne=4 -mtune=generic -fPIC -g -m64  -c conftest.c\"\r\nconftest.c: In function ‘t’:\r\nconftest.c:13: error: ‘ruby_version’ undeclared (first use in this function)\r\nconftest.c:13: error: (Each undeclared identifier is reported only once\r\nconftest.c:13: error: for each function it appears in.)\r\nchecked program was:\r\n/* begin */\r\n 1: #include \"ruby.h\"\r\n 2:\r\n 3: /*top*/\r\n 4: extern int t(void);\r\n 5: int main(int argc, char **argv)\r\n 6: {\r\n 7:   if (argc > 1000000) {\r\n 8:     printf(\"%p\", &t);\r\n 9:   }\r\n10:\r\n11:   return 0;\r\n12: }\r\n13: int t(void) { const volatile void *volatile p; p = &(&ruby_version)[0]; return 0; }\r\n/* end */\r\n\r\nI have investigated this messages and found the problem place in src/ruby_native_extension/extconf.rb:\r\n`have_var('ruby_version')`\r\nWhen I change this line to be:\r\n`have_var('ruby_version[0]', 'ruby/version.h')`\r\nThe error is disappeared. \r\n\r\nTested for ruby 2.0, 2.1, 2.2, 2.3. We have custom build ruby, but in fact it is as same as the original one.\r\n\r\nSame problem exists for 2 more lines in extconf.rb:\r\n * have_func('rb_thread_io_blocking_region', 'ruby/io.h')\r\nit cannot be tested with ruby, because ruby has no any have_<x> function to test only exported functions without any declarations.\r\n * have_func('rb_thread_call_without_gvl', 'ruby/thread.h')\r\nIt can be changed to:\r\n`have_func('&rb_thread_call_without_gvl', 'ruby/thread.h')`\r\nto fix problem.\r\n\r\nThe full patch looks like:\r\n```\r\n--- a/src/ruby_native_extension/extconf.rb  2016-06-06 13:02:02.000000000 +0300\r\n+++ b/src/ruby_native_extension/extconf.rb  2016-07-21 18:52:14.739651798 +0300\r\n@@ -39,9 +39,9 @@\r\n have_header('ruby/version.h')\r\n have_header('ruby/io.h')\r\n have_header('ruby/thread.h')\r\n-have_var('ruby_version')\r\n-have_func('rb_thread_io_blocking_region', 'ruby/io.h')\r\n-have_func('rb_thread_call_without_gvl', 'ruby/thread.h')\r\n+have_var('ruby_version[0]', 'ruby/version.h')\r\n+#have_func('rb_thread_io_blocking_region', 'ruby/io.h')\r\n+have_func('&rb_thread_call_without_gvl', 'ruby/thread.h')\r\n\r\n with_cflags($CFLAGS) do\r\n    create_makefile('passenger_native_support')\r\n\r\n\r\n```"}}
{"actor":{"display_login":"OnixGH"}}