Backport #8606

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

Added by Eric Saxby almost 2 years ago. Updated almost 2 years 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 almost 2 years 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 almost 2 years ago

configure.in: check exit statuses

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

Revision 41943
Added by Tomoyuki Chikanaga almost 2 years 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 almost 2 years 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 almost 2 years ago

linking miniruby
Undefined first referenced
symbol in file
dtraceenabled_rubyrequireentry load.o
_dtraceruby
cmethodentry vm.o
dtrace_rubyparsebegin parse.o
_dtraceenabledruby
cmethodentry vm.o
dtrace_rubyrequireentry load.o
_dtraceruby
findrequire_entry load.o
_dtraceruby
methodreturn vm.o
dtraceenabled_rubyfindrequireentry load.o
_dtraceruby
hashcreate hash.o
dtraceenabled_rubyloadreturn load.o
_dtraceenabledruby
requirereturn load.o
dtrace_rubyobjectcreate object.o
_dtraceruby
methodentry vm.o
dtraceenabled_rubyparsebegin parse.o
_dtraceenabledruby
objectcreate object.o
dtraceenabled_rubygcmarkend gc.o
_dtraceruby
gcmark_begin gc.o
_dtraceenabledruby
hashcreate hash.o
dtrace_rubystringcreate string.o
_dtraceenabledruby
findrequire_return load.o
_dtraceenabledruby
cmethodreturn vm.o
dtrace_rubygcmarkend gc.o
_dtraceenabledruby
parseend parse.o
dtraceenabled_rubymethodentry vm.o
_dtraceruby
gcsweep_begin gc.o
_dtraceenabledruby
stringcreate string.o
dtrace_rubyraise eval.o
_dtraceruby
requirereturn load.o
dtraceenabled_rubyloadentry load.o
_dtraceruby
parseend parse.o
dtraceenabled_rubyarraycreate array.o
_dtraceenabledruby
gcsweep_end gc.o
_dtraceenabledruby
gcsweep_begin gc.o
_dtraceruby
gcsweep_end gc.o
_dtraceenabledruby
methodreturn vm.o
dtraceenabled_rubyraise eval.o
_dtraceruby
cmethodreturn vm.o
dtraceenabled_rubygcmarkbegin gc.o
_dtraceruby
loadreturn load.o
dtrace_rubyarraycreate array.o
_dtraceruby
findrequire_return load.o
_dtraceruby
loadentry load.o

#3 Updated by Eric Saxby almost 2 years 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 almost 2 years 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 almost 2 years 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 almost 2 years 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 almost 2 years 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