clang hangs when compiling libCVD on Mac OS X - macos

libCVD is a fairly standard library but when I try to build it using clang (the version that ships with XCode 5) it hangs on the target cvd_src/fast/fast_7_score.o
Has anybody else had experience with clang hanging on compilation or has been able to successfully build this library?

Compilation began hanging for me after upgrading to Mavericks.
Activity Monitor reported a high CPU usage for xcrun. My googling took me to this question, as well as to Xcode 4 Mavericks Creating Universal Binary for OSX hangs. I followed the advice given by user2965639 in the accepted answer for that question and I was able to compile again without any issue, so I thought perhaps this would be useful to share here as well. Here are the commands I ran:
sudo mv /usr/bin/lipo /usr/bin/lipo.orig
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo /usr/bin/lipo

Remove line OFLAGS=-O3 altogether in the Makefile generated by running ./configure_osx_32bit. That will get you past hang.

Related

What is the proper way to build a golang application for an older Mac OS version?

I'm building a go app which also uses cgo on Mac OS Catalina and would like the binaries to be able to run on previous Mac OS versions.
What is the proper way to do this and where is it documented.
I'm having a hard time finding information on how to do this.
So far i tried:
go help build
go help c
go doc cmd/cgo
man clang
googling various permutations of my question
building with
CGO_CFLAGS="-mmacosx-version-min=10.12" CGO_LDFLAGS="-mmacosx-version-min=10.12" go build -o myapp
This yields
otool -l myapp | grep -A3 MIN
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.12
sdk 10.15.6
Ultimately it complains when trying to run on Mojave
The application requires macOS 10.15 or later
In the absence of a proper answer this is what i ended up with:
CGO_CFLAGS="-mmacosx-version-min=10.12" CGO_LDFLAGS="-mmacosx-version-min=10.12" go build -o myapp
This does the trick for running on mac 10.14.
The
otool -l
stuff, if anything, makes things confusing and has apparently no relevance in this regard.

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.

Gcc 4.2 version missing

on my new macbook pro with osx lion and XCode 4.1 I have some problems with gcc.
In /usr/bin I cannot find gcc-4.2
I only have the following versions:
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2
As a result when I try to select gcc42 by means of port select --set gcc gcc42 it returns me the following error:
Selecting 'gcc42' for 'gcc' failed: could not create new link "/opt/local/bin/gcc": target "/usr/bin/gcc-4.2" doesn't exist
However port select gcc returns me the following versions:
apple-gcc42
gcc42
llvm-gcc42 (active)
mp-gcc44
How can I fix this problem?
Thanks!
I could manage to solve this issue in Mountain Lion with a symbolic link:
sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Hope this help someone
There should be a /usr/bin/gcc-4.2 with Xcode 4.1 installed. However, with the recent Xcode 4.2 update, Apple has finally removed their modified standard gcc-4.2. What remains is either llvm-gcc42 (also symlinked to gcc) and clang, the newer non-gcc C compiler. Apple is making the transition to clang; the first step is using the hybrid llvm-gcc42. There have been some reported problems using either of the new compilers. You should be using this time to figure out if you have problems with them and, if so, fix your code and report bugs to Apple. In the meantime, if you absolutely have to have the old gcc-4.2, it is possible to build one similar to the previous Apple-modified one via MacPorts:
port install apple-gcc42
but you'll be swimming against the tide.
With Xcode 4.3, you need to install the Command Line Tools separately. XCode -> Preferences -> Downloads, Click the Components button, and then click Install next to the "Command Line Tools" option.
I had the same issue.
I fixed it by doing a symlink.
Like this :
cd /usr/bin
then :
sudo ln -s llvm-gcc-4.2 gcc-4.2
You might consider compiling a newer GCC (e.g. 4.6.2) from its source code. Apple does not care much any more about GCC, but GCC has made significant progress since 4.2
And you probably could use your llvm-gcc42 as a GCC compiler.
I tampered with the innards of the makefile and found out that one invoked option provided an argument too many; replaced the variable with the actual result of the function called on my machine (removing the excess argument) and did run make again it worked.

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