Project

General

Profile

Actions

Bug #21862

closed

dtrace is passed unmodified CPPFLAGS, but not all compiler flags are supported by dtrace

Bug #21862: dtrace is passed unmodified CPPFLAGS, but not all compiler flags are supported by dtrace

Added by wiz (Thomas Klausner) 9 days ago. Updated 9 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:124680]

Description

I use "CPPFLAGS=-g" to enable symbols in my builds. This works for most software, except for ruby.
The problem is that, in template/Makefile.in, CPPFLAGS are passed unmodified to dtrace:

.d.h:
        @$(ECHO) translating probes $<
        $(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) $(CPPFLAGS) -s $<

which on NetBSD leads to a dtrace usage warning, because -g is not supported:

        BASERUBY = ./tool/missing-baseruby.bat
        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O2 -g -fstack-clash-protection -pthread -I/usr/pkg/include -I/usr/include -fPIC -pipe
        XCFLAGS = -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-netbsd -I.ext/include -I./include -I. -I./prism -I./enc/unicode/17.0.0   -Dmodular_gc_dir=
        CPPFLAGS = -g -I/usr/pkg/include -I/usr/include
        DLDFLAGS = -Wl,-zrelro -Wl,-znow -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -pthread -Wl,--compress-debug-sections=zlib -Wl,-soname,libruby40.so.40
        SOLIBS = -lexecinfo -lz -lrt -lrt -lcrypt -lm -lpthread
        LANG = C
        LC_ALL = C
        LC_CTYPE = C
        MFLAGS =
        RUSTC = rustc
        YJIT_RUSTC_ARGS = --crate-name=yjit  --crate-type=staticlib --cfg feature="stats_allocator"  --edition=2021  -g  -C lto=thin  -C opt-level=3  -C overflow-checks=on  '--out-dir=/tmp/lang/ruby40/work/ruby-4.0.1/tar
get/release/'  './yjit/src/lib.rs'
        ZJIT_RUSTC_ARGS = --crate-name=zjit  --crate-type=staticlib --cfg feature="stats_allocator"  --edition=2024  -g  -C lto=thin  -C opt-level=3  -C overflow-checks=on  '--out-dir=/tmp/lang/ruby40/work/ruby-4.0.1/tar
get/release/'  './zjit/src/lib.rs'
gcc (nb2 20260118) 14.3.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

compiling ./main.c
compiling dmydln.c
compiling miniinit.c
translating probes probes.d
dtrace: unknown option -- g
Usage: dtrace [-32|-64] [-aACeFGhHlqSvVwZ] [-b bufsz] [-c cmd] [-D name[=def]]
        [-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
        [-x opt[=val]] [-X a|c|s|t]

        [-P provider [[ predicate ] action ]]
        [-m [ provider: ] module [[ predicate ] action ]]
        [-f [[ provider: ] module: ] func [[ predicate ] action ]]
        [-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
        [-i probe-id [[ predicate ] action ]] [ args ... ]
...

which breaks the build.

Updated by nobu (Nobuyoshi Nakada) 9 days ago Actions #1 [ruby-core:124681]

-g is not a C pre-processor flag.

Updated by wiz (Thomas Klausner) 9 days ago Actions #2 [ruby-core:124682]

I had thought it was, but reading the man page it seems you're right.
Sorry for the noise.

Updated by wiz (Thomas Klausner) 9 days ago Actions #3 [ruby-core:124683]

This can be closed. I don't see a button to do it myself.

Updated by jeremyevans0 (Jeremy Evans) 9 days ago Actions #4

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom