dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

Profiler compilation failure related to malloc_stats function missing

Open ivoanjo opened this issue 11 months ago • 1 comments

Current behaviour

Reported by @mintuhouse. It seems there may be an issue with the change from #3425, as reported in https://github.com/DataDog/dd-trace-rb/pull/3425#issuecomment-1962724499 .

I'm opening this ticket to investigate the issue.

When I try to install the gem inside docker on M1/ARM Mac, getting error


LD_LIBRARY_PATH=.:/opt/rubies/ruby-3.3.0/lib "gcc -o conftest -I/opt/rubies/ruby-3.3.0/include/ruby-3.3.0/aarch64-linux -I/opt/rubies/ruby-3.3.0/include/ruby-3.3.0/ruby/backward -I/opt/rubies/ruby-3.3.0/include/ruby-3.3.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -std=gnu99 -Wno-unused-function -Wno-declaration-after-statement -Werror-implicit-function-declaration -fvisibility=hidden -Wold-style-definition -Wall -Wextra conftest.c  -L. -L/opt/rubies/ruby-3.3.0/lib -Wl,-rpath,/opt/rubies/ruby-3.3.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/opt/rubies/ruby-3.3.0/lib -L/opt/rubies/ruby-3.3.0/lib -lruby-static -lz -lrt -lrt -ldl -lcrypt -lm -lpthread   -lm -lpthread  -lc"
conftest.c: In function ‘t’:
conftest.c:14:57: error: ‘malloc_stats’ undeclared (first use in this function)
   14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))malloc_stats; return !p; }
      |                                                         ^~~~~~~~~~~~

Expected behaviour

Profiler compilation should not be affected by missing malloc_stats.

Steps to reproduce

Still trying to figure this out.

Environment

  • ddtrace version: 1.20.0?
  • Configuration block (Datadog.configure ...): ?
  • Ruby version: 3.3.0
  • Operating system: macOS, arm64
  • Relevant library versions: ?

ivoanjo avatar Mar 01 '24 10:03 ivoanjo

A compilation failure caused by malloc_stats being missing is not expected at all, since the code is supposed to gracefully degrade when it's not available.

@mintuhouse I noticed the log you shared is a snippet for Ruby's mkmf.log. Could you share the full mkmf.log you get, as well as any other messages you see when installing the gem fails?

ivoanjo avatar Mar 01 '24 10:03 ivoanjo