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

Cannot compile with copts containing space on mac #3541

Closed
sulume opened this issue Aug 11, 2017 · 3 comments
Closed

Cannot compile with copts containing space on mac #3541

sulume opened this issue Aug 11, 2017 · 3 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@sulume
Copy link

sulume commented Aug 11, 2017

Description of the problem / feature request / question:

It fails to compile cc target with copts containing spaces (or maybe any character needed to escape on shell) on mac. I defined a macro -D_START_GOOGLE_NAMESPACE_="namespace google {" to build glog like google/glog#61.

clang: error: no such file or directory: 'google'
clang: error: no such file or directory: '{'

This is likely caused by wrapped_clang incorrectly passing arguments. I'd think it could succeed by just replacing clang $@ with clang "$@". I could make a change if that's considered reasonable but the wrapper script has been rolled back and forward twice maybe due to a regression (missing details though.) I don't know how it's designed and wonder the validity of that way.

If possible, provide a minimal example to reproduce the problem:

BUILD (for arbitrary a.cc):

cc_binary(name="a",srcs=["a.cc"],copts=["-DM='a b'"])

bazel 0.5.3

$ bazel build :a
INFO: Found 1 target...
ERROR: (workspace)/BUILD:1:1: C++ compilation of rule '//:a' failed (Exit 1).
clang: error: no such file or directory: 'b'
Target //:a failed to build

bazel 0.4.5

$ bazel build :a
INFO: Found 1 target...
Target //:a up-to-date:
  bazel-bin/a

Environment info

  • Operating System: macOS 10.12.6

  • Bazel version (output of bazel info release): release 0.5.3-homebrew

@iirina
Copy link
Contributor

iirina commented Aug 14, 2017

You can send us a change to review with your suggestion. The lack of details for the rollbacks/rollforwards is probably due to some internal factors. Marcel can tell you more about the validity of your suggestion.

@hlopko hlopko added category: rules > C++ P3 We're not considering working on this, but happy to review a PR. (No assignee) type: feature request labels Aug 14, 2017
sulume added a commit to sulume/bazel that referenced this issue Aug 15, 2017
Unquoted $@ parameter expansion was breaking up values containing spaces.
Fix bazelbuild#3541
@hlopko hlopko added team-Rules-CPP Issues for C++ rules and removed category: rules > C++ labels Oct 11, 2018
@VietTralala
Copy link

VietTralala commented Nov 29, 2019

I am facing the same problem on Ubuntu 18.04 as well. I tried to use gcc in a bazel build call with the following flags:

--copt=-mmmx --copt=-mno-3dnow --copt=-msse --copt=-msse2 --copt=-msse3 --copt=-mssse3 --copt=-mno-sse4a --copt=-mcx16 --copt=-msahf --copt=-mno-movbe --copt=-mno-aes --copt=-mno-sha --copt=-mno-pclmul --copt=-mno-popcnt --copt=-mno-abm --copt=-mno-lwp --copt=-mno-fma --copt=-mno-fma4 --copt=-mno-xop --copt=-mno-bmi --copt=-mno-bmi2 --copt=-mno-tbm --copt=-mno-avx --copt=-mno-avx2 --copt=-mno-sse4.2 --copt=-mno-sse4.1 --copt=-mno-lzcnt --copt=-mno-rtm --copt=-mno-hle --copt=-mno-rdrnd --copt=-mno-f16c --copt=-mno-fsgsbase --copt=-mno-rdseed --copt=-mno-prfchw --copt=-mno-adx --copt=-mfxsr --copt=-mno-xsave --copt=-mno-xsaveopt --copt=-mno-avx512f --copt=-mno-avx512er --copt=-mno-avx512cd --copt=-mno-avx512pf --copt=-mno-prefetchwt1 --copt=-mno-clflushopt --copt=-mno-xsavec --copt=-mno-xsaves --copt=-mno-avx512dq --copt=-mno-avx512bw --copt=-mno-avx512vl --copt=-mno-avx512ifma --copt=-mno-avx512vbmi --copt=-mno-clwb --copt=-mno-mwaitx --copt=-mno-clzero --copt=--param l1-cache-size=32 --copt=--param l1-cache-line-size=64 --copt=--param l2-cache-size=2048 --copt=-mtune=core2

The problem comes from the last 3 arguments --copt=--param .... which contain spaces. When I compile with only non-space-containing flags, the compilation works.

How can I help fixing this problem?

I can give the exact commands to repoduce the error on a docker image.

@hlopko hlopko removed their assignment Dec 6, 2019
@sgowroji sgowroji added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 17, 2023
@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

@sgowroji sgowroji closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants