mesonbuild / mesonbuild/meson

Name clash bug

Open
#8,752 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

Describe the bug
If a target has the same name as a sub directory, attempting to build will output

/usr/local/bin/ld: cannot open output file $directoryname: Is a directory

To Reproduce

Download bug.zip or create it as follows:

$ tree
.
├── clash
│   ├── lib.cpp
│   └── meson.build
├── main.cpp
└── meson.build

meson.build:

project('Bug', 'cpp')
subdir('clash')
executable('clash', 'main.cpp')

clash/meson.build:

library('irrelevant', 'lib.cpp')

main.cpp and lib.cpp are simple nearly empty, valid C++ files.

$ meson setup build
...
$ meson compile -C build
ninja: Entering directory `build'
[3/4] Linking target clash
FAILED: clash 
c++  -o clash clash.p/main.cpp.o -Wl,--as-needed -Wl,--no-undefined
/usr/local/bin/ld: cannot open output file clash: Is a directory
collect2: error: ld returned 1 exit status
[4/4] Linking target clash/libirrelevant.so
ninja: build stopped: subcommand failed.

system parameters

  • ArchLinux
  • Python 3.9.4
  • 0.58.0
  • 1.10.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the root meson.build, clash/meson.build, main.cpp, and clash/lib.cpp from the issue or bug.zip; run meson setup build followed by meson compile -C build. Trace how the executable target and subdirectory output paths are generated. Done means the target named clash builds successfully even when clash is also a subdirectory.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.