Fix link/bundle failures on rebuilds and output-path collisions#141
Open
gbaraldi wants to merge 3 commits into
Open
Fix link/bundle failures on rebuilds and output-path collisions#141gbaraldi wants to merge 3 commits into
gbaraldi wants to merge 3 commits into
Conversation
- linking: reject output paths that resolve to an existing directory. On case-insensitive filesystems this catches `--output-exe <pkgname>` run from the package's parent dir (issue #132), which previously produced a confusing `ld: open() failed, errno=21` (EISDIR). - linking: only emit `-install_name`/`-soname`/`--out-implib` for shared outputs. These flags are dylib/import-lib concepts and were being appended for executables as well. - bundling: drop the deferred `dirs_to_remove` rm. The pre-existing `dest_julia_dir` was added to it and then `mv(force=true)` placed the fresh libs at that path, so the deferred rm would wipe the freshly-bundled libs on a second run. - bundling: clear bundle-owned subdirs (`bin/`, `lib/`, `share/julia/`) at the start so re-runs are idempotent, working around PackageCompiler's `bundle_cert`/`bundle_artifacts` cp-without-force and `bundle_julia_libraries`'s skip-if-exists (which can leave stale libs across Julia upgrades). Subdirs containing the link output are preserved for the programmatic API. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Avoids hardcoding `bin`/`lib`/`share/julia` and also cleans up any other stale top-level content. Same skip rule: preserve any entry that holds the link output (programmatic API allows outname inside output_dir). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous wipe loop also removed top-level files, which on Windows deleted the `.dll.a` import library that `link_products` emits next to the main artifact (via -Wl,--out-implib). Limit the wipe to directories: all bundle-managed state (bin/, lib/, share/julia/) lives in subdirs, and link products at the top level (the main artifact and, on Windows, its sibling import library) are preserved for bundle_products to move. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ld: open() failed, errno=21(EISDIR) when--output-exe <pkgname>collides case-insensitively with the package directory on macOS APFS / Windows NTFS (closes Can't name executable the same as the package "linker command failed with exit code 1" #132).-install_name/-soname/--out-implibfor shared outputs — they were being applied to executables too.bundle_productsre-runnable: drop the buggy deferreddirs_to_removerm (it was wiping the freshly-moved libs), and clear bundle-owned subdirs at the start so PackageCompiler's non-idempotentbundle_cert/bundle_artifacts(cp withoutforce=true) don't fail on the second build, and stale libs aren't kept across Julia upgrades. The wipe is scoped tobin/,lib/,share/julia/and skips any subdir that contains the link output (programmatic API pattern).Closes #132.
Test plan
Pkg.test()passes (all suites green, including theLibrary has install_name (MacOS)test)test/AppProjectvia the CLI produces a working bundle and the executable runs--bundle builddirectory both succeed and the resulting binary runs🤖 Generated with Claude Code