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

Always set --no-canonical-prefixes if we can #7316

Closed

Conversation

asuffield
Copy link
Contributor

Some configurations of gcc (I suspect --without-sysroot is the key
flag, but it's tricky to prove) will still resolve symlinks in the
compiler path even when -fno-canonical-system-headers is used. This
breaks remote execution in the presence of symlinks.

There's not much we can do other than include both flags - it's hard
to tell what will be correct when executing remotely. However, there
appears to be no real harm in adding --no-canonical-prefixes if it
passes the test in _is_linker_option_supported: prefix
canonicalisation is only required when gcc is invoked through a
symlink that does not also include the rest of its files, and the test
command will fail completely when this occurs.

Some configurations of gcc (I suspect --without-sysroot is the key
flag, but it's tricky to prove) will still resolve symlinks in the
compiler path even when -fno-canonical-system-headers is used. This
breaks remote execution in the presence of symlinks.

There's not much we can do other than include both flags - it's hard
to tell what will be correct when executing remotely. However, there
appears to be no real harm in adding --no-canonical-prefixes if it
passes the test in _is_linker_option_supported: prefix
canonicalisation is only required when gcc is invoked through a
symlink that does not also include the rest of its files, and the test
command will fail completely when this occurs.
@asuffield
Copy link
Contributor Author

This should fix #7315

@aiuto aiuto added the team-Rules-CPP Issues for C++ rules label Feb 4, 2019
@bazel-io bazel-io closed this in 1b4c37c Feb 19, 2019
@philwo
Copy link
Member

philwo commented Mar 3, 2019

FYI, this broke Bazel's bootstrap on Ubuntu 14.04: #7605 (comment)

bazel-io pushed a commit that referenced this pull request Mar 4, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 4, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 7, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 7, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 8, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 13, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
katre pushed a commit that referenced this pull request Mar 19, 2019
*** Reason for rollback ***

Breaks protobuf when bootstrapping bazel (#7605)

ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc':
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h'
  '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h'

*** Original change description ***

Always set --no-canonical-prefixes if we can

-no-canonical-prefixes should be enough in all cases except very
old compilers. For those, we keep using -fno-canonical-system-headers

Closes #7316.

PiperOrigin-RevId: 236613108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants