2

I have recently updated to Mojave and since then am experiencing linking problems to libraries (gsl, Cuba etc.) that I had installed with Homebrew. When compiling my code, gcc (tried g++-6 and g++-8, also installed with brew) does not seem to search the directories where brew stores the header files for those libraries. The code compiled when I manually set the paths to

GSL_INCLUDE_PATH=/usr/local/include/gsl/
GSL_LIB_PATH=/usr/local/lib/
CUBA_PATH=/usr/local/include/

But since I am using this in all my make-files I do not want to do this every time... Before I was using Sierra and I have included in my .bash_profile the following:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

This seemed to do the trick before. But now /usr/local/sbin did not exist anymore. I ran brew doctor which suggested:

You should create these directories and change their ownership to your account. sudo mkdir -p /usr/local/Frameworks /usr/local/sbin sudo chown -R $(whoami) /usr/local/Frameworks /usr/local/sbin

I did just that and reinstalled the libraries but it did not sort out the issue.

I have tried to include export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/include:/usr/local/lib:$PATH

in the bash-profile, but that did not help either. (Maybe I did it wrong, I am not familiar with setting paths) At this point I am not sure whether brew installs the libraries in a weird place or if gcc just does not look in the correct location.

I have installed Xcode and the command tools. I have tried everything I found (and could understand) that I found as solutions for related problems.

I would like for gcc to look in the directories that brew installs the libraries to by default. I would be really grateful for a suggestion of a clean fix for this issue.

Please excuse the long essay; if you need additional information please do tell, this ist my first time asking for help here.

Quadrikel
  • 21
  • 1
  • Have a look here: https://stackoverflow.com/questions/58072318/cannot-link-any-c-program-with-gcc-on-mac-mojave Mojave seems to have affected a few things that need to be updated. – RobBW Sep 04 '20 at 03:11

0 Answers0