Closed paulmadejong closed 2 years ago
Please add brew config
as requested in the issue template.
Please add
brew config
as requested in the issue template.
Done, missed the AND statement in the template. Thanks for pointing this out.
GCC isn't officially supported on ARM so that might have something to do with it.
Tagging in the GCC expert @fxcoudert who might have some more insights.
GCC isn't officially supported on ARM so that might have something to do with it.
Tagging in the GCC expert @fxcoudert who might have some more insights.
I have the same problem on my intel Macbook and /usr/local/include
and /usr/local/lib
after I updated homebrew on this machine as well (and hence, both arm and intel MacBooks run gcc/gfortran 11.2.0)
gfortran search path includes /opt/homebrew/include
This is what I don't understand. It shouldn't, and on my system, it doesn't. From the terminal, with Homebrew gcc, gfortran -E -Wp,-v -
gives:
#include "..." search starts here:
#include <...> search starts here:
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include-fixed
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks
End of search list.
/usr/local/include
was a special directory, and was included in the search path on Intel by default, IIRC. But /opt/homebrew/include
is not, so it is expected that it is not in the search path, and that you have to add it when you need it.
gfortran search path includes /opt/homebrew/include
This is what I don't understand. It shouldn't, and on my system, it doesn't. From the terminal, with Homebrew gcc,
gfortran -E -Wp,-v -
gives:#include "..." search starts here: #include <...> search starts here: /opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include /opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include-fixed /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks End of search list.
/usr/local/include
was a special directory, and was included in the search path on Intel by default, IIRC. But/opt/homebrew/include
is not, so it is expected that it is not in the search path, and that you have to add it when you need it.
Interesting, zo /opt/homebrew/include shouldn't be there? Weird. And to confirm, any arm64 gcc/gfortran project requiring libs from homebrew arm will require the include and lib directories to be manually added? Good to know 😉
so /opt/homebrew/include shouldn't be there?
No it shouldn't.
arm64 gcc/gfortran project requiring libs from homebrew arm will require the include and lib directories to be manually added?
Depends what you call "manually". Most software needs to be told where non-system libraries are, but they have simple flags to do to (configure
, cmake
, etc.) We view this as a feature not to be in the “special directories” (/usr/local/{include,lib}
) by default anymore: it means that random libraries don't get picked up over the versions you would prefer to see it.
Thanks for the clarification! Issue can be closed.
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Just gotten a brand new MacBook Pro 14" with M1 Pro. Used the migration assistant to transfer files from my intel MacBook Pro 13" 2017. This all worked find. Created an alias oldbrew that linked to brew in /usr/local/bin (the old intel homebrew installation). Installed homebrew for M1 in /opt/homebrew. Updated gcc and gfortran to 11.2.0 (also on my older intel MacBook Pro 13").
Now building my project requires to add additional include and library directives in CMake in order for gcc/gfortran to find brew installed libraries/headers. This wasn't required on my old MacBook Pro 13" with intel homebrew until this laptop got updated to gcc 11.2.0 as well.
The brew doctor "issues" are libraries build myself and are part of the large project I'm trying to build. Those can be found it seems, although they are in the homebrew intel version library path? Why is my (m1) brew doctor checking that location? It is not part of the gcc search path?
What happened (include all command output)?
Ever since this update, my project that uses CMake to build C, Fortran code and Python/Cython extensions requires me to explicitly set
LINK_DIRECTORIES(/opt/homebrew/lib)
andINCLUDE_DIRECTORIES(/opt/homebrew/include)
in CMakeListst.txt for gcc/gfortran to find module files or libraries for eccodes (also instead through homebrew in /opt/homebrew.I have asked about this issue on stack overflow (https://stackoverflow.com/questions/71196288/gcc-gfortran-11-cannot-find-headers-libraries-in-default-locations) as well. Initially I though the issue was just with a python extension using fortran. But since it seems to be more of a homebrew related issue, I figured to post the issue here as well. Am I missing something or misunderstanding how search paths work?
Building with gfortran:
eccodes.mod is in the proper location:
gfortran search path includes /opt/homebrew/include:
What did you expect to happen?
I'd expect homebrew installed gcc/gfortran to find eccodes modules and library as their search path are pointing to the proper location:
Step-by-step reproduction instructions (by running
brew
commands)