I can't install gcc with Mojave 10.14 - xcode

I try to install a fortran compiler on my Mojave system thanks to the command
brew install gcc
Unfortunately, I have this error message
The directory that should contain system headers does not exist:
/usr/include
I found out that I had to install the latest update of the Command Line Tools, which I did and update Xcode to 10.1 but the error remains the same.
I tried to update brew but it said
Error: /usr/local must be writable!
and brew doctor said that my version of Xcode is outdated although I just updated to the 10.1 version
So... any help is appreciated.
Thanks everybody
Zhiv

I found very detailed instructions for compiling GCC by "Paul" at https://solarianprogrammer.com/2017/05/21/compiling-gcc-macos/
In particular this step will address your problem:
macOS Mojave changed the location of the system headers, this broke
the GCC 8 build process. In order to build GCC install the required
header files in the old location:
cd /Library/Developer/CommandLineTools/Packages/
open .

Update the permissions using:
sudo chown -R /usr/local/* /usr/local/.git; brew update

Related

Installing and running emscripten on OSX 10.15

I recently installed emscripten on my macbook air using homebrew.
But when I try to run it, even if i do a simple emcc --version i get the error llc executable not found at /usr/bin/llc. how can i fix this?
solution: llvm was not installed, so a brew install llvm followed by echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc solved this problem for me.
Hrm. Seems like adding brew install llvm, I'm still not able to call llvm on my end.
So i just installed brew install emscripten
then I did emcc giving me
Welcome to Emscripten!
This is the first time any of the Emscripten tools has been run.
A settings file has been copied to /usr/local/Cellar/emscripten/1.39.18/libexec/.emscripten, at absolute path: /usr/local/Cellar/emscripten/1.39.18/libexec/.emscripten
It contains our best guesses for the important paths, which are:
LLVM_ROOT = /usr/bin
NODE_JS = /usr/local/bin/node
EMSCRIPTEN_ROOT = /usr/local/Cellar/emscripten/1.39.18/libexec
Please edit the file if any of those are incorrect.
This command will now exit. When you are done editing those paths, re-run it.
Then i did emcc again, giving me BINARYEN_ROOT is set to empty value in /usr/local/Cellar/emscripten/1.39.18/libexec/.emscripten.
How did you set your BINARYEN_ROOT? i'm on the newest macos 10.15.5.

How to install OS X 10.12 command line tools on 10.11?

I get this error when trying to brew install geckodriver
==> Installing geckodriver dependency: rust
==> Downloading https://static.rust-lang.org/dist/rustc-1.42.0-src.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/rust/1.42.0 --release-channel=stable
==> make
Last 15 lines from /Users/nilshaus/Library/Logs/Homebrew/rust/02.make:
2020-04-12 21:13:48 -0400
make
make: error: unable to find utility "make", not a developer tool or in PATH
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk" cannot be located.
clang: error: unable to find utility "clang", not a developer tool or in PATH
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
Rust dependents that currently fail to build from source https://github.com/Homebrew/homebrew-core/issues/50815
Error: You are using macOS 10.11.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
Obviously 10.11 is no longer supported by Homebrew. The fact that it can't find make is weird, but I'm willing to bet that the real issue is that the rust build expects the 10.12 command line tools. Is there a way for me to install them on OS X 10.11? I have Xcode 8.
I encountered this same error message when brew upgrade installed a new version of clang and tcl-tk. Found a workaround here:
Xcode was overriding the command line tools install. After moving
Xcode to the trash I found the directory of the command line tools
install:
clang --version
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/Library/Developer/CommandLineTools/usr/bin
https://github.com/pytorch/pytorch/issues/1139#issuecomment-302967251
Another possible workaround - instead of moving Xcode, choose one of the following to specify CLT version:
sudo xcode-select -s /Library/Developer/CommandLineTools
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
To display the current CLT path: xcode-select -p
https://github.com/pytorch/pytorch/issues/1139#issuecomment-303033942

Installing GCC on macOS Catalina

I am on macOS Catalina and trying to install GCC by following the instructions here:
https://solarianprogrammer.com/2019/10/12/compiling-gcc-macos/
Everything seems to work fine until I try to configure. Then I get the following:
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
While trying to fix this I found the following:
MacOS "configure: error: cannot run C compiled programs"
However this answer requires going to the following directory:
/Library/Developer/CommandLineTools
The problem is I do not have CommandLineTools in /Library/Developer/ not even as a hidden file. Trying to fix this I found this
How to compile GCC on macOS Catalina?
but there is now answer here and I do not have nix and don't want to mess with it as it appears to not be very compatible with macOS Catalina. So the question is how can I run the configure?
Install GCC on MacOS
learn from above vedio,i use macOX 11.1, install gcc and g++ step:
"brew install gcc", after that, check install success by: "brew info gcc".
"cd /usr/local/bin"
"ls | grep 'gcc'" should see the gcc version you install before, like: gcc-10 or g++-10.
"ln -s gcc-10 gcc" make a symlink from your gcc version to gcc.
close terminal, and open again, input "gcc -v", should see it use gcc now.
If still use clang:
make sure you logout and login again.
use "where gcc" or "which gcc" to check your gcc symlink create success.
"echo $PATH", make sure "/usr/local/bin" show before "/usr/bin" on your PATH, if not, change it on your ~/.zshrc or ~/.bashrc
First you need to install the Command-Line tools.
$ xcode-select --install
Then you probably want to install the headers from a specific .pkg in Terminal:
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
(yours is 10.15, so):
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.15.pkg
After finishing the installation you should have the headers you need to compile with your GCC.
Probably not the elegant answer, but it worked. I was able to find the header files needed using $(xcrun --show-sdk-path) I then copied them all to /usr/local where the gcc location was expecting them to be. Now all works.

Unable to build and install Valgrind on macOS High Sierra

I cannot install Valgrind on macOS High Sierra. It's not available through brew. I've tried with 3.10. After make install, I get this message:
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x and 14.x (Mac OS X 10.6/7/8/9/10)
Homebrew says:
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
I had the problem like this.
So, I found the solving. You should install valgrind by this code
brew install --HEAD valgrind
I have created a port of valgrind 3.13.0 to work on macOS High Sierra (10.13.x). You can get it here: https://github.com/padiakalpesh/valgrind_3.13_high_sierra
Once you have obtained the source, run the following commands from inside the source directory:
./configure
make
sudo make install
brew install Valgrind has some compatibility problem when installing on latest macOS but there is a workaround with this problem. You must be getting this error message when you try to install it using brew.
$brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than High Sierra due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
-------------------------------------------------------------------SOLUTION--------------------------------------------------------------
Step1: $brew edit valgrind
Step2: Find this line in the file ->(url "https://sourceware.org/git/valgrind.git")
Step3: Replace it with -> (url "git://sourceware.org/git/valgrind.git")
Step4: $brew update
Step5: $brew install --HEAD valgrind
And Done!
Let me know if it still doesn't work.
Thanks!!
I have got this working in July 2018, for reference:
https://gist.github.com/AlessandroMinali/d8316d6cc650c97027433644c2ff31ee
Edit ./configure
- 5468: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
+ 5468: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*|applellvm-9.*)
- 5879: 16.*)
+ 5879: 17.*)
Run
./autogen.sh
./configure
make
make install
Create file ~/.valgrind.supp
# false positive for any executable (it seems)
# macOS 10.12.6
# valgrind 3.13.0
{
libtrace initialization false positive
Memcheck:Param
msg->desc.port.name
fun:mach_msg_trap
fun:mach_msg
fun:task_set_special_port
fun:_os_trace_create_debug_control_port
fun:_libtrace_init
}
Create file ~/.valgrindrc
--suppressions=$HOME/.valgrind.supp
Troubleshooting
if can not read suppresion file copy and paste the contents of $HOME
if it complains about clang versions, bump the first edit up
if it complains about Darwin version, bump the second edit up
using the brew install --HEAD valgrind also worked for me, but be sure to know that it will take awhile to pull the HEAD version, and build/install.
However, no other changes were needed.
I build the git head version of Valgrind on macOS fairly regularly. If you have xcode installed then there isn't much more to it than following the instructions here.
I'll update with my build script later.
As an alternative, you might want to consider clang sanitizers. This can be enabled in xcode, or with the -fsanitize=X option (where X is address, undefined, thread, memory and a few others).
Valgrind is a rather touchy piece of software, and requires updates for each major release of macOS.
As of February 2018, there is no released version of Valgrind which supports macOS High Sierra (10.13). You will need to use a development version of Valgrind, or use alternate tools. (Apple's Instruments may have some of the functionality you are looking for.)
MacPorts version started working for me in Sep 2018!
The command, for completeness sake (completes very fast - apparently, prebuilt):
sudo port install valgrind-devel
Version:
$ valgrind --version
valgrind-3.14.0.GIT
The following worked for me using the latest Valgrind release 3.14.0 (9th October 2018) on macOS 10.13.6.
VERSION="3.14.0"
wget -O - http://www.valgrind.org/downloads/valgrind-"$VERSION".tar.bz2 | tar xjf -
cd valgrind-"$VERSION"
# use --prefix=/path/to if you want it installed somewhere in particular
./configure
make
# may need sudo
make install
# test all is working
valgrind ls -l
These instructions are taken from the README inside the Valgrind release tar ball.

Unable to get MacPort functionality after installing Xcode 4.3

I am having trouble getting MacPorts to function properly. I just installed OSX Lion 10.7.3 I downloaded and installed MacPorts first, and then after reading the requirements, I downloaded Xcode4.3 from the App Store, and then installed it. I launched Xcode and it looks to be operational and functional. However when I attempted to port with MacPorts, it gave me this error message(excerpt):
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
I followed the advice from:
How do i install additional packages for Xcode on OSX Lion to allow MacPorts to work
and installed command_line_tools_for_xcode from the Preferences within Xcode. I closed Xcode, and again got the errors:
$ sudo port install libsocketsPassword:
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
---> Computing dependencies for libsockets
---> Dependencies to be installed: openssl zlib
---> Extracting zlib
Error: Couldn't determine your Xcode version (from '/usr/bin/xcodebuild -version').
Error:
Error: If you have not installed Xcode, install it now; see:
Error: http://guide.macports.org/chunked/installing.xcode.html
Error:
Error: Target org.macports.extract returned: unable to find Xcode
Error: Failed to install zlib
Log for zlib is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_zlib/zlib/main.log
Error: The following dependencies were not installed: openssl zlib
Error: Status 1 encountered during processing.
I am uncertain where to go next with this. How do i trouble shoot my Xcode and MacPort interface?
In theory this should work if you have Xcode4.3 installed (in /Applications):
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
(And you've installed the optional command line tools)
Everything will start working fine after installation of "Command Line Tools for Xcode" package.
You can get it from here: https://developer.apple.com/downloads/index.action#
Please see the MacPorts migration instructions for Xcode 4.3.
The instructions are pretty involved. You need to run xcode-select to set a new tools path, update developer_dir in macports.conf (as described by Henk Poley), re-install MacPorts (ouch), and finally uninstall and re-install all of your ports (double ouch).
Edit: libpvx still wouldn't install after the above. Two extra steps were required:
sudo ln -s /Developer /
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /SDKs
YMMV if you have different ports installed!
Also in /opt/local/etc/macports/macports.conf change the line with developer_dir to point to / instead of /Developer.
After
sudo xcode-select -switch /Applications/Xcode.app
I also had to run
sudo xcodebuild -license
and accept the licence
Here is a solution that has worked for me:
Install Command Line Tools for Xcode
Xcode -> Preferences -> Downloads
Help MacPorts find the right Xcode folder
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app
Create symbolic links for clang compilers as they now live elsewhere
sudo ln -s `which clang` /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s `which clang++` /Applications/Xcode.app/Contents/Developer/usr/bin/
Try using trunk, there's no release supporting Xcode 4.3 yet.
Setting the developer path in /opt/local/etc/macports.conf works for me,
developer_dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
since most of the compilers are stored there now instead of /usr/bin under Developer.
None of this works for me. Wait for macports to release a new version that officially supports XCode 4.3+
sudo mv /usr/bin/xcodebuild /usr/bin/xcodebuild.old
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild /usr/bin/xcodebuild
Starting with Xcode 4.3, the command-line build tools are not installed by default. Launch Xcode, open the Preferences, and go to the Downloads tab. From there you should have an option to install the command-line tools.
You can also download them from the web here: https://developer.apple.com/downloads/index.action
Disclaimer: I haven't installed Xcode 4.3 yet. I have only read about it on the web.
As of 27/2/2012, the official suggestion from MacPorts seems to be to not use XCode 4.3 and instead use 4.1 through 4.2.1, which can be downloaded from Apple.
There is a bug ticket which might be useful to follow the evolution of this.
Incidentally, and as reported in my comment #11 in that bug report, I am able to build ports without warnings by using the 2 most sane-looking suggestions found in this question: sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer and changing developer_dir in /opt/local/etc/macports/macports.conf to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
I have macports installed without admin/root privileges, so I was unable to test the xcode-select answers. However, I observed that Pall Melsted's answer worked, but not initially. What I found out was that I had not accepted the Xcode 4.5 license agreement!
If you have just installed Xcode for the purposes of macports, and you haven't accepted the Xcode license yet, you might get the error presented by the original post. When I checked my Xcode version using /usr/bin/xcodebuild -version, I was given the prompt to read and accept the license. After doing so, and after having made the changes suggested by Pall to the macports.conf developer_dir, it all works now.
As alternative: you can make downgrade of Xcode to 4.2.1 version. DMG of Xcode 4.2.1 placed here: https://developer.apple.com/downloads/index.action
After this MacPorts became works fine for me.
This is fixed in MacPorts 2.0.4.
To upgrade:
Download MacPorts 2.0.4 from the install site or run sudo port selfupdate.
Run the MacPorts migration described here to reinstall all ports. This is painful but required to get back to a working state.
You should definitely run sudo xcode-select -switch /Applications/Xcode.app like everyone here says, that'll fix many problems, but certainly not all.
Afaik, all the remaining problems exist within the configuration information for various packages. You might simply reinstall MacPorts as described in the migration instructions, but I found another solution.
You should begin finding all effected port files using commands like grep /Developer/ ..., after executing sudo bash and cd /opt/local naturally.
You should identify all effected ports by using port provides ..., which I piped through sed and sort | uniq. You could simply reinstall all these ports using either port -n upgrade --force ... or separate port uninstall ... and port install ... commands.
I recommend using one large port -n upgrade --force ... command to avoid duplicate rebuilds of dependencies, using the separate uninstall and install commands afterwards.
There are of course various ports for which /Developer exists only inside text config files, meaning you can fix them manually with sed -i -e 's/\/Developer//g' ..., but you cannot do so with binaries obviously.
I'm afraid you must at minimum rebuild all your Python and Perl installations, making this upgrade an ideal time to clean out packages that depend upon older versions, ala python26 and perl5.8.
There are several technically effected ports I decided against rebuilding like fuse4x-kext, who contained /Developer inside Library/Extensions/fuse4x.kext/Contents/MacOS/fuse4x but hasn't prevented sshfs from working correctly.
I had initially installed xcode 3.2.2, after which I installed 4.3. When I ran the xcode-select, I still got the same error about no xcode project in /Applications. I then dug into the /usr/bin/xcodebuild script and found out that this was working correctly, and another instance of xcodebuild (the one installed with xcode 4.3, not the one in /usr/bin) was being run and returning the error:
xcodebuild: error: The directory /Applications does not contain an Xcode project.
It seems the /usr/bin/xcode-select does not work for xcode 4.3, (it's compiled so you can't really see why it's not working). Strings doesn't give any clues. Good thing osx has strace.. oh wait.
Anyways, the best I could do was modify /opt/local/etc/macports.conf
and uncomment the line containing the path to the xcode installation. That seems to fix my problem for the most part.

Resources