Backport #8606

compile with --enable-dtrace fails with dtrace version SUN D 1.11

Added by Eric Saxby over 1 year ago. Updated over 1 year ago.

[ruby-core:55815]
Status:Closed
Priority:High
Assignee:Tomoyuki Chikanaga

Description

When compiling Ruby 2.0 with --enable-dtrace on platforms with dtrace version SUN D 1.11 (for example, SmartOS with platform image joyent_20130521T084103Z or greater), the compile fails just after linking miniruby. The compile fails on linking dtrace symbols, as they are missing.

The problem is that in dtrace 1.11, the compiler was changed to fail if no probes are found. configure runs a test to check whether dtrace -G is needed, I believe because OS X does not need it.

https://github.com/ruby/ruby/blob/1c0abbf07692b21835f6c81f759b8d2d6b8963c2/configure.in#L536-L539

On newer dtrace, this results in the following error:
"dtrace: failed to link script conftest_provider: No probe sites found for declared provider"

So configure incorrectly determines that dtrace -G is not needed, and compilation fails.

From the #smartos irc channel on freenode:
rmustacc: So, the most correct solution would be to use the probe from the header file in the conftest.o that they try and run dtrace -G on.

Associated revisions

Revision 41815
Added by Nobuyoshi Nakada over 1 year ago

configure.in: correctly tests dtrace -G in version 1.11

  • configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11 introduces a check in the dtrace compiler to ensure that probes actually exist. If there are no probes, then the -G step will fail. As this test is only being used to determine whether -G is necessary (for instance, on OSX it is not), adding a real probe to the conftest allows it to succeed on newer versions of dtrace. Patch by Eric Saxby at . [Fix GH-351], [Bug #8606].

Revision 41816
Added by Nobuyoshi Nakada over 1 year ago

configure.in: check exit statuses

  • configure.in (RUBY_DTRACE_POSTPROCESS): check exit statuses of commands. [Bug #8606]

Revision 41943
Added by Tomoyuki Chikanaga over 1 year ago

merge revision(s) 41815,41816: [Backport #8606]

* configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11
  introduces a check in the dtrace compiler to ensure that probes
  actually exist. If there are no probes, then the -G step will
  fail. As this test is only being used to determine whether -G is
  necessary (for instance, on OSX it is not), adding a real probe to
  the conftest allows it to succeed on newer versions of dtrace.
  Patch by Eric Saxby <sax AT livinginthepast.org> at
  .  [Fix GH-351], [Bug #8606].

History

#1 Updated by Eric Saxby over 1 year ago

This is High priority for me, as it is blocking me from deploying Ruby 2.0 in the Joyent Public Cloud. I understand if others feel it is lower priority.

Thank you for your consideration! I will try to try to find a solution myself and submit a pull request, but I do not have much experience in this regard.

#2 Updated by Eric Saxby over 1 year ago

linking miniruby
Undefined first referenced
symbol in file
dtraceenabled_ruby_require__entry load.o
dtrace_ruby_cmethod__entry vm.o
dtrace_ruby_parse__begin parse.o
dtraceenabled_ruby_cmethod__entry vm.o
dtrace_ruby_require__entry load.o
dtrace_ruby_find__require__entry load.o
dtrace_ruby_method__return vm.o
dtraceenabled_ruby_find__require__entry load.o
dtrace_ruby_hash__create hash.o
dtraceenabled_ruby_load__return load.o
dtraceenabled_ruby_require__return load.o
dtrace_ruby_object__create object.o
dtrace_ruby_method__entry vm.o
dtraceenabled_ruby_parse__begin parse.o
dtraceenabled_ruby_object__create object.o
dtraceenabled_ruby_gc__mark__end gc.o
dtrace_ruby_gc__mark__begin gc.o
dtraceenabled_ruby_hash__create hash.o
dtrace_ruby_string__create string.o
dtraceenabled_ruby_find__require__return load.o
dtraceenabled_ruby_cmethod__return vm.o
dtrace_ruby_gc__mark__end gc.o
dtraceenabled_ruby_parse__end parse.o
dtraceenabled_ruby_method__entry vm.o
dtrace_ruby_gc__sweep__begin gc.o
dtraceenabled_ruby_string__create string.o
dtrace_ruby_raise eval.o
dtrace_ruby_require__return load.o
dtraceenabled_ruby_load__entry load.o
dtrace_ruby_parse__end parse.o
dtraceenabled_ruby_array__create array.o
dtraceenabled_ruby_gc__sweep__end gc.o
dtraceenabled_ruby_gc__sweep__begin gc.o
dtrace_ruby_gc__sweep__end gc.o
dtraceenabled_ruby_method__return vm.o
dtraceenabled_ruby_raise eval.o
dtrace_ruby_cmethod__return vm.o
dtraceenabled_ruby_gc__mark__begin gc.o
dtrace_ruby_load__return load.o
dtrace_ruby_array__create array.o
dtrace_ruby_find__require__return load.o
dtrace_ruby_load__entry load.o

#3 Updated by Eric Saxby over 1 year ago

The following code does not error on newer dtrace:

echo "provider conftest{ probe fire(); };" > conftest_provider.d
dtrace -h -o conftest_provider.h -s conftest_provider.d

cat >conftest.c <<_ACEOF
#include "conftest_provider.h"
int main(void){
CONFTEST_FIRE();
return 0;
}
_ACEOF

gcc -c -o conftest.o conftest.c
dtrace -G -s conftest_provider.d conftest.o

#4 Updated by Eric Saxby over 1 year ago

Please find a pull request here:
https://github.com/ruby/ruby/pull/351

I apologize about setting the priority to High. I just saw in the documentation for filing reports to please leave priority unassigned. In the future I will do so!

#5 Updated by Nobuyoshi Nakada over 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41815.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


configure.in: correctly tests dtrace -G in version 1.11

  • configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11 introduces a check in the dtrace compiler to ensure that probes actually exist. If there are no probes, then the -G step will fail. As this test is only being used to determine whether -G is necessary (for instance, on OSX it is not), adding a real probe to the conftest allows it to succeed on newer versions of dtrace. Patch by Eric Saxby at . [Fix GH-351], [Bug #8606].

#6 Updated by Tomoyuki Chikanaga over 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby trunk to Backport200
  • Category deleted (build)
  • Status changed from Closed to Assigned
  • Assignee changed from Nobuyoshi Nakada to Tomoyuki Chikanaga

#7 Updated by Tomoyuki Chikanaga over 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r41943.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 41815,41816: [Backport #8606]

* configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11
  introduces a check in the dtrace compiler to ensure that probes
  actually exist. If there are no probes, then the -G step will
  fail. As this test is only being used to determine whether -G is
  necessary (for instance, on OSX it is not), adding a real probe to
  the conftest allows it to succeed on newer versions of dtrace.
  Patch by Eric Saxby <sax AT livinginthepast.org> at
  .  [Fix GH-351], [Bug #8606].

Also available in: Atom PDF