clang: error: invalid version number in '-mmacosx-version-min=11.2' - gcc

I am currently on Mac OSX Big Sur 11.2.3. Whenever I run the command:
g++-10 -o project0 project0.cpp -lm -fopenmp
I get the following error:
clang: error: invalid version number in '-mmacosx-version-min=11.2'
I realized that this may be due to the fact that I'm on Big Sur 11.2.3 but I was told that this should not be an issue. I've tried many things already such as reinstalling gcc doing brew install gcc and so forth to no avail. At this point, I'm very unsure on what to do. Any help would be very much appreciated!

I ran into the same problem while trying to install fiona. You are correct it is due to Big Sur, as you can see in this article
Follow it and it should sort out the issue. Note, I had to uninstall Command Line tools and re-install it as outlined in this answer.

I ran into a similar issue when I tried to compile a library with clang-9 on an up-to-date system, with clang-9 installed via homebrew:
clang-9: error: invalid version number in '-mmacosx-version-min=12.6'
Updating xcode command line tools doesn't help here, since I actually want / have to use the old compiler. Setting the following environment variable for the build solved the issue:
export SYSTEM_VERSION_COMPAT=1

Related

Mac cmake: 'stdio.h' file not found

I have been stuck on this for a while, and I was wondering if I could get some help.
I'm currently stuck trying to run a cmake setup file and I'm constantly getting this error
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
I've been looking online, and haven't been able to find anything recent. I've tried using the xcode-select --install already.
cmake version is currently 3.21.3.
The library I'm trying to install is https://github.com/google/draco, where I'm trying to install python functions using pybind11. I was able to install this library through cmake, whoever when I try to install the pybind11 functionality I keep getting this error. This library seemed to function properly on a coworkers linux machine, and they were running cmake 3.20.4 on ubuntu 18.04 (I don't know if this makes a difference)
Any help would be appreciated, and please let me know if there's any other information that can help the process.
It looks like something in XCode has changed after updating MacOS to 12.3. I had to reinstall XCode command line tools. I don't say it's right solution, but it works for me.
Commands for reinstalling (from https://stackoverflow.com/a/47804075):
removing the old tools ($ sudo rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).

ld: library not found for -lvtkftgl

I'm trying to compile pcl program and I already done the installation of pcl using homebrew. I'm using Mac OSX 10.10.5 and command line to compile the program. At "make" step I got this error
ld: library not found for -lvtkftgl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
what could be the problems, and possibly solutions. I really appreciated it if anyone help me with this. Thanx in advance.
You can also install the latest PCL version.
brew install --HEAD pcl
So I had this issue as well; seems like the VTK library does not work well with pcl at this moment. A temporary solution is to install pcl without the VTK library, and you can compile and run their tutorial fine.
Run the following:
$ brew uninstall pcl
$ brew install pcl --without-apps --without-tools --without-vtk --without-qt # this will take a while, so be patient here
Now, follow the tutorial here: http://www.pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config
You should be able to compile and run their tutorial fine.
Here is a temporary fix:
brew uninstall pcl
brew install https://raw.githubusercontent.com/ahundt/homebrew-science/vtk6/vtk6.rb --build-from-source
brew install https://raw.githubusercontent.com/ahundt/homebrew-science/vtk6/pcl.rb --build-from-source
Here is a discussion of this particular issue:
https://github.com/mikepurvis/ros-install-osx/issues/32
Here is where I'm trying to submit my fix to homebrew-science. Feel free to encourage them to break the particularly esoteric impasse that's occurring there!
https://github.com/Homebrew/homebrew-science/pull/3512

Set up g++ on OS X

I just updated to OS X Mavericks and it seems it messed up my whole compiler setup. Not only do I have to reinstall a JDK in order to use a Java compiler, I get the following error when I'm trying to compile C/C++ using GCC/G++:
/usr/local/Cellar/gcc/4.7.2/gcc/lib/gcc/x86_64-apple-darwin12.2.1/4.7.2/../../../../include/c++/4.7.2/cwchar:46:19: fatal error: wchar.h: No such file or directory
Not sure what to think other than upgrading messed it up. My question is: how do I set up g++ to compile on OS X? If it's already set up, what is the problem here?
If I can provide more information, please let me know.
Note: I've installed gcc 4.7 using homebrew, but it doesn't seem to work. When I use g++-4.7 code.cpp specifically, I get the same error.
Installing the Command Line Tools (OS X Mavericks) for Xcode - Late October 2013 solved it for me. Here is the link:
OSX: Xcode Downloads
The often mentioned xcode-select --install command kept saying it cannot find the requested software.
To clarify: You need to already have gcc-4.7 installed using Homebrew. The update to the latest version of CMD Tools only fixes compatibility issues caused by upgrading from Mountain Lion to Mavericks.

Why is clang not working in Mac Os X 10.5.8 (Leopard) for compiling Z3?

I am not a pro-user of Mac, so I am having a lot of problems to install software. I would like to run the Z3Py (Z3 API using Python). I download Z3 v4.3.1, I installed clang v2.9 using Macports-2.1.2 and finally, when I run for Z3
>autoconf
>./configure CXX=clang++
>python scripts/mk_make.py
>cd build
>make
I obtained:
src/shell/datalog_frontend.cpp
make: clang++: Command not found
make: *** [shell/datalog_frontend.o] Error 127
Since clang++ is in /opt/local/libexec/llvm-2.9/bin
I am not able to understand what it is happening and how to solve it. I really appreciate whatever hint because after two days trying I have not find any solution.
I just tried to replicate this error report, but I was unable to do so. Z3 builds just fine with CXX=clang++ on my machine. I can only suspect that your clang++, while it may be installed, is not in the path. For instance, simply running clang++ in the console would throw the same "command not found" error. Perhaps this could be fixed by simply running
export PATH=$PATH:/opt/local/libexec/llvm-2.9/bin
before attempting compilation. However, I suspect there would be more issues with libraries not being found after that.
I could imagine that something went wrong during the installation via MacPorts, e.g., that it requires modifications to various environment variables which are not done automatically.
As Nuno suggests, XCode (with CLI tools) may be much easier to use and they should be available for free in the AppStore.
You should install XCode CLI tools instead. It already includes an up-to-date version of clang (2.9 is very old).
I think both XCode and XCode CLI tools are free on Appstore and/or apple developer center.

Problem installing node on Mac OSX 10.6.7

I'm getting this error when I try and install node on my new mac
error: could not configure a cxx compiler!
The error always occurs when I get to the ./configure part of the installation
I found this problem which applies to a linux build with the same error, but the solution does not seem to apply in my case:
How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).
I also took a look at the troubleshoot guide on the node wiki here:
https://github.com/joyent/node/wiki/Troubleshooting-Installation
and tried this solution:
export PATH=/Developer/usr/bin:$PATH
ISYSROOT="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
export LINKFLAGS=$ISYSROOT CXXFLAGS=$ISYSROOT CFLAGS=$ISYSROOT
./configure --prefix=$HOME --without-ssl
make
But I get the same problem when I get to the ./configure step
Any advice, insights or help would be much appreciated here.
Thanks
When you install Mac OS X Developer Tools (XCode, etc) ensure you have the Unix Tools option checked. I had to remember to install Developer Tools/Unix tools when I set up my new MBP and it resolved this error for me.
Optionally, you could remove and try installing with Homebrew. However, it still has the same requirements (XCode/Dev Tools) so ensure that you have those installed.
Hope this helps.
I had this problem too, I resolved this in a different way, as far as I know xcode 4.3.1 doesnt come with an Install Xcode.app file from the appstore, if you are under this case, just run xcode, go to preferences -> downloads and click on the Install button for the command line tools option. I did just that and all the errors on the .configure and make commands were gone :)
I had the same problem on OSX 10.7 with Xcode 4.2. I was trying to build node v0.4.7. I kept getting "unable to configure a c compiler" error. What finally worked for me is installing the GCC compiler seperately. I found a nice package for that here:
https://github.com/kennethreitz/osx-gcc-installer/
configure is currently broken for some versions of MacOS; for more details, see How to compile Node.js v0.4.2 on MacOS 10.5.8. The working approach cited there is as follows:
export PATH=/Developer/usr/bin:$PATH
ISYSROOT="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
export LINKFLAGS=$ISYSROOT CXXFLAGS=$ISYSROOT CFLAGS=$ISYSROOT
./configure --prefix=$HOME --without-ssl
make
This worked for me .
Al
After installing XCode 4.3.2 (in Mac OS X Lion) I still had the error.
Open XCode, Preferences, Downloads and installed Command Line Tools.
After it gets installed ./configure runs ok.

Resources