Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name clash bug #8752

Open
Volker-Weissmann opened this issue May 9, 2021 · 4 comments
Open

Name clash bug #8752

Volker-Weissmann opened this issue May 9, 2021 · 4 comments

Comments

@Volker-Weissmann
Copy link
Contributor

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
@eli-schwartz
Copy link
Member

This would be an error for any build system, I imagine. Granted, it would be preferable to error out during setup rather than during build.

I will note, however, that meson setup builddir --layout flat actually works quite well here and is even intended for this use case. Although in the general case it tends to break if your targets clash rather than your directory layouts. ;)

@Volker-Weissmann
Copy link
Contributor Author

Volker-Weissmann commented May 9, 2021

This would be an error for any build system, I imagine.

Not if you do some name-mangeling. (Altough I'm not sure if this would be a good idea.)

Granted, it would be preferable to error out during setup rather than during build.

Absolutely.

meson setup builddir --layout flat actually works quite well here

The Problem is that --layout flat is global, so if you have a nameclash in the flat layout somewhere else, you are stuck.

@eli-schwartz
Copy link
Member

Not if you do some name-mangeling. (Altough I'm not sure if this would be a good idea.)

Probably not :) e.g. I'm highly dependent on the --layout mirror to preserve directory hierarchy so that an application can run uninstalled from the build tree for testing.

The Problem is that --layout flat is global, so if you have a nameclash in the flat layout somewhere else, you are stuck.

I did mention that in the next sentence, yes.

@tristan957
Copy link
Contributor

@eli-schwartz is there any actionable thing here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants