Skip to content

Conversation

@theuni
Copy link
Member

@theuni theuni commented Sep 12, 2022

From the included comment:

Homebrew may create symlinks in /usr/local/include for some packages. Because MacOS's clang internally adds -I /usr/local/include to its search paths, this will negate efforts to use -isystem for those packages, as they will be found first in /usr/local. Use the internal -internal-isystem option to system-ify all /usr/local/include paths without adding it to the list of search paths in case it's not already there.

This fixes the issue explained here: #26056 (comment)

Also temporarily includes #26056 as a test. I will remove that commit if/when c-i is happy, and fanquake can rebase it post-merge.
I've removed this commit now that c-i succeeded with it.

@theuni
Copy link
Member Author

theuni commented Sep 12, 2022

c-i was happy with this so I'm going to drop the test-commit.

@maflcko maflcko changed the title Quiet warnings in symlinked headers installed from homebrew build: Quiet warnings in symlinked headers installed from homebrew Sep 13, 2022
@fanquake
Copy link
Member

Concept ACK - picked into #26056.

@hebasto
Copy link
Member

hebasto commented Sep 13, 2022

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b50a4b7, tested as a part of #26056 on macOS Monterey 12.6 (21G115, both Intel and Apple M1) + Apple clang 14.0.0:

% ./configure --enable-suppress-external-warnings
...
checking for brew... brew
checking whether C++ preprocessor accepts -Xclang -internal-isystem/usr/local/include... yes
...

dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example).

dnl Homebrew may create symlinks in /usr/local/include for some packages.
Copy link
Member

@hebasto hebasto Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /usr/local path is relevant for macOS Intel systems only. macOS M1 uses the /opt/homebrew one.

Actually, the latter systems do not require this fix. But a comment update seems enough.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would almost be safe enough to do everywhere (not just mac/homebrew), and possibly even for /usr/include because it should have no unintended side-effects, and for gcc it will just fail the test.

I'm not suggesting that we do that, just pointing out that it should be pretty much harmless even if it's not needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the wording here is ok; we don't need to call out differences in defaults between x86_64 and arm64 installations of homebrew. Also, just because /opt/homebrew is the preferred prefix for arm64, it's not clear to me that a brew installation couldn't be in /usr/local on arm64, which this would also accomodate.

@fanquake fanquake merged commit 29d540b into bitcoin:master Sep 13, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 13, 2022
…lled from homebrew

b50a4b7 build: quiet warnings in system headers installed from homebrew (Cory Fields)

Pull request description:

  From the included comment:

  Homebrew may create symlinks in `/usr/local/include` for some packages. Because MacOS's clang internally adds `-I /usr/local/include` to its search paths, this will negate efforts to use `-isystem` for those packages, as they will be found first in `/usr/local`. Use the internal `-internal-isystem` option to system-ify all `/usr/local/include` paths without adding it to the list of search paths in case it's not already there.

  This fixes the issue explained here: bitcoin#26056 (comment)

  ~Also temporarily includes bitcoin#26056 as a test. I will remove that commit if/when c-i is happy, and fanquake can rebase it post-merge.~
  I've removed this commit now that c-i succeeded with it.

ACKs for top commit:
  hebasto:
    ACK b50a4b7, tested as a part of bitcoin#26056 on macOS Monterey 12.6 (21G115, both Intel and Apple M1) + Apple clang 14.0.0:

Tree-SHA512: 163aa359d27c31d52b444252762e32dd8a11acc043cf1a2aa953f902d1dab77ece52e2dfedcce637e6a1dda47e4c566bfeb8d3b092f82bfc73923843b7bc619c
@bitcoin bitcoin locked and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants