`$(LIBRUBYARG_STATIC)` already ends with `$(MAINLIBS)`, so appending them again makes the Xcode 15+ linker warn about duplicate libraries. The shared ruby still needs `$(MAINLIBS)` [Bug #20072], so drop them only when `$(LIBRUBYARG)` is the static one. `PROGRAM_LIBS` is internal to the build and is not exported to rbconfig.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --with-static-linked-ext, the archives, libraries and Init
functions of the extensions are known only to exts.mk, and the
top-level $(PROGRAM) rule linked ruby with a bare EXTOBJS whenever
its prerequisites changed. The sub-make from exts.mk relinked it
correctly afterwards only because it happened to come later, and
because configuring ext/-test- deletes ext/extinit.c. With `make -j`
under GNU make 3.81, or 4.4 with `DOT_WAIT=`, `programs` and
`test-precheck` ran that link and the exts sub-make at once, leaving
a ruby without any extension or encoding, or no ruby at all when the
two links collided in codesign. A bare `make ruby` gave the same
broken ruby even serially.
Now the top-level $(PROGRAM) depends on `exts` instead of linking
when PROGRAM_EXTS is set, and only the sub-make, which passes
PROGRAM_EXTS empty along with the real EXTOBJS, links. EXTOBJS at
the top level is always dmyext.o so that ext/extinit.c is generated
only with the full EXTINITS. `.WAIT` stays in the test targets; it
still keeps the outputs of the dynamic build from interleaving, but
the correctness of the static build no longer depends on it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Keep the core dependency generation rule in `depend` so configure and
Windows setup share the same entry point. Preserve NMake output when
the generated dependency file is rebuilt.
Replace `-s` globals with explicit command options and standard long
option names. Group source selection under `--scope` and represent
output behavior as a single mode so command-line precedence is clear.
Keep command-line parsing and option dispatch inside `Mkdepend`, and
return command success directly from `Mkdepend.main`.
Generate only core and encoding dependencies during configure.
Generate extension dependency files from `configure-ext.mk` after
`miniruby` is available, so `THREAD_MODEL` can be resolved before
rules enter an extension Makefile.
Select the extension scope when `-extensions` is passed. Keep quoted
project-internal headers ahead of similarly named public headers while
scanning extension sources. Limit snapshot expansion to files needed
before `miniruby`.
Replace `tool/update-deps` with a Ruby source scanner so dependency
updates no longer require GNU make, a configured build, or compiler
preprocessor output.
Keep compact source mappings and scanner declarations in dependency
files, and expand complete rules into the build directory. Avoid the
temporary fixture headers required by the compiler-driven prototype.
Use the generated rules from GNU make, BSD make, and NMake builds.
Support out-of-tree and read-only source trees, and retain expanded
dependencies shipped in release archives when baseruby is unavailable.
template/Makefile.in is used only by the GNU make build, so on mswin the
common.mk stub was an empty rule and nmake check silently skipped the
SyntaxSuggest spec. Move the recipe to common.mk so both builds share it,
matching how test-bundled-gems-spec is already shared.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Select extension library directories by globbing extconf.rb.
- Exclude extensions for test before uniquifing bundled gems.
- Use `Dir.glob` base option to remove prefixed srcdir.
[Bug #21818]
Currently exceptions can be sent across ractors,
but because of a limitation in the TypedData API,
the exception backtrace is duped as an empty backtrace.
The problem is that backtraces are embedded objects,
hence the classic `rb_class_alloc(klass)` API is insufficient
because we need to know the size of the Backtrace object we're
duping to instantiate the copy.
This is worked around by changing Ractors to call `#clone` on objects
rather than use `rb_obj_clone`, and to implement `Thread::Backtrace#clone`
to properly clone the variable size object.
When building on macOS, we get a warning about duplicate libraries
ld: warning: ignoring duplicate libraries: '-ldl', '-lobjc', '-lpthread'
To fix it, we now append $(MAINLIBS) to LIBRUBYARG_SHARED (when shared
is enabled), matching what's already done for LIBRUBYARG_STATIC. And we
remove the now-redundant $(MAINLIBS) from the $(PROGRAM) link line,
since $(LIBRUBYARG) carries it in both cases.
Add `rustc_flags` option for configure that appends to RUSTC_FLAGS
flags used when compiling with rustc for customizable build flags.
It appends to existing defaults in RUSTC_FLAGS.
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
This happens if BASERUBY is Ruby 3.4.
$ rm -f *-fake.rb && make test-precheck RUBYOPT=-w >/dev/null
build/arm64-darwin24-fake.rb:28: warning: ::Ruby is reserved for Ruby 3.5
This is so that e.g. building with `--enable-zjit=dev` will test with the
disassembly feature. It makes more sense, saves on build time and
reveals that
`backend::arm64::tests::sp_movements_are_single_instruction` was in
fact failing with the `disasm` feature.
This commit allows building YJIT and ZJIT simultaneously, a "combo
build". Previously, `./configure --enable-yjit --enable-zjit` failed. At
runtime, though, only one of the two can be enabled at a time.
Add a root Cargo workspace that contains both the yjit and zjit crate.
The common Rust build integration mechanisms are factored out into
defs/jit.mk.
Combo YJIT+ZJIT dev builds are supported; if either JIT uses
`--enable-*=dev`, both of them are built in dev mode.
The combo build requires Cargo, but building one JIT at a time with only
rustc in release build remains supported.
Working towards having YJIT and ZJIT in the same build, we need to
deduplicate some glue code that would otherwise cause name collision.
Add jit.c for this and build it for YJIT and ZJIT builds. Update bindgen
to look at jit.c; some shuffling of functions in the output, but the set
of functions shouldn't have changed.