Backport #8606

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

Added by Eric Saxby 10 months ago. Updated 9 months 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 41943
Added by Tomoyuki Chikanaga 9 months 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 10 months 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 10 months ago

linking miniruby
Undefined first referenced
symbol in file
dtraceenabled_rubyrequireentry load.o
_
dtracerubycmethodentry vm.o
dtrace_rubyparsebegin parse.o
_
dtraceenabledrubycmethodentry vm.o
dtrace_rubyrequireentry load.o
_
dtracerubyfindrequireentry load.o
_dtraceruby
methodreturn vm.o
_
dtraceenabledrubyfindrequireentry load.o
_dtraceruby
hashcreate hash.o
_
dtraceenabledrubyloadreturn load.o
dtraceenabled_rubyrequirereturn load.o
_
dtracerubyobjectcreate object.o
dtrace_rubymethodentry vm.o
_
dtraceenabledrubyparsebegin parse.o
dtraceenabled_rubyobjectcreate object.o
_
dtraceenabledrubygcmarkend gc.o
_dtraceruby
gcmarkbegin gc.o
_
dtraceenabledrubyhashcreate hash.o
dtrace_rubystringcreate string.o
_
dtraceenabledrubyfindrequirereturn load.o
_dtraceenabledruby
cmethodreturn vm.o
_
dtracerubygcmarkend gc.o
_dtraceenabledruby
parseend parse.o
_
dtraceenabledrubymethodentry vm.o
dtrace_rubygcsweepbegin gc.o
_
dtraceenabledrubystringcreate string.o
dtrace_rubyraise eval.o
_
dtracerubyrequirereturn load.o
dtraceenabled_rubyloadentry load.o
_
dtracerubyparseend parse.o
dtraceenabled_rubyarraycreate array.o
_
dtraceenabledrubygcsweepend gc.o
_dtraceenabledruby
gcsweepbegin gc.o
_
dtracerubygcsweepend gc.o
_dtraceenabledruby
methodreturn vm.o
_
dtraceenabledrubyraise eval.o
_dtraceruby
cmethodreturn vm.o
_
dtraceenabledrubygcmarkbegin gc.o
_dtraceruby
loadreturn load.o
_
dtracerubyarraycreate array.o
dtrace_rubyfindrequirereturn load.o
_
dtracerubyloadentry load.o

#3 Updated by Eric Saxby 10 months ago

The following code does not error on newer dtrace:

echo "provider conftest{ probe fire(); };" > conftestprovider.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 10 months 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 10 months 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 (RUBYDTRACEPOSTPROCESS): 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 9 months 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 9 months 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