`illegal option -- D` when linking in macOS
See original GitHub issueDescription of the bug:
Any cc_library
with a non-empty srcs
fails to link when using a custom toolchain.
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
A minimal repro is here: https://github.com/asoffer/bazel_macos_repro
Which operating system are you running Bazel on?
macOS Monterey 12.4
What is the output of bazel info release
?
release 5.2.0
If bazel info release
returns development version
or (@non-git)
, tell us how you built Bazel.
No response
What’s the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD
?
No response
Have you found anything relevant by searching the web?
The D
flag is valid on unix systems but not macOS. This has shown up on some other builds (python-related) but nothing C++ related that I’ve found.
Any other information, logs, or outputs that you want to share?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
install: illegal option -- D - Ask Different - Apple Stack Exchange
Missing parent directories are created as required. I am attempting to install a library using a makefile and am getting this error on...
Read more >macos - Bash touch - illegal option -d - Stack Overflow
I want to change modification date of all files in a specific directory to minus 10 hours . #!/bin/sh for i in /Users/slick/Desktop/100D5200/*; ......
Read more >Easy symbolic linker please! - Apple Support Communities
... I think I do the ln -s thing own terminal I get 'illegal option'. ... You can't make symbolic links to a...
Read more >Command line installation fails on OSX: illegal option -D #252
This is the output of make install for the commandline subdirectory, on my machine: $ make install Building for OS=macosx ...
Read more >Restoring a Password in Single-User Mode? - macos
When I issued it, it said -d was an illegal option. Perhaps change your syntax? – sharksfan98 · Sorry, mistaken it for linux...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Both the workaround and the direct fix work. Thank you. I’m not sure what the correct action is moving forward… I suspect it would be valuable to document that an unknown target-libc does not work for macOS builds. But I’m not sure where the best place would be for this.
The quickest workaround would be to add the archiver_flags feature to your custom toolchain so you avoid the default one: