I'm trying to compile https://github.com/zeromq/libzmq which requires me to run autoconf and then ./configure. It was working a few days ago, but now this happens:

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '502' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/Users/rajiv/libzmq/libzmq-4.2.5':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

config.log shows:

configure:4489: checking whether we are cross compiling
configure:4497: gcc -o conftest    conftest.c  >&5
configure:4501: $? = 0
configure:4508: ./conftest
dyld: mach-o, but built for simulator (not macOS)
./configure: line 4510: 98877 Abort trap: 6           ./conftest$ac_cv_exeext
configure:4512: $? = 134

After searching GitHub for a while it seems like something might be wrong with GCC:

$ gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/c++/4.2.1

Apple LLVM version 9.1.0 (clang-902.0.39.2)

Target: x86_64-apple-darwin17.7.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

It seems like it's trying to include from the iOS 11.4 SDK. How can I change it back to the correct path and how did this change happen? The only things I can think of are that I installed an update for the Xcode Command Line Tools and I may have updated autoconf with Homebrew

  • I doubt /usr/include/c++/4.2.1 is the correct include that is for an old gcc - Apple does not supply gcc anymore but clang. I wopuld look at ports systems like macports or Homebrew to see how they manage any changes this build needs
    – mmmmmm
    Commented Jul 6, 2018 at 9:15
  • Why have you used a homebrew tag?
    – mmmmmm
    Commented Jul 6, 2018 at 11:00
  • @Mark I had assumed that was the proper directory but really I just want to change it to whatever directory it should be. I'll edit the question accordingly. I added the homebrew tag because I'm not sure if Homebrew influenced this change but I'll remove it
    – Rajiv
    Commented Jul 6, 2018 at 15:13

1 Answer 1


I was seeing a similar issue.

$ gcc -v
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/c++/4.2.1

In my case, that configuration resulted in includes like #include <stdlib.h> referencing the iOS/iPhone simulator platform libraries rather than the macOS libraries. This resulted in my getting errors about the wrong architecture being used when compiling.

The only viable solution I found was to uninstall Xcode (deleting the app from /Applications) and uninstall the command line tools. That and a reboot seemed to resolve this issue in my case.

  • Thanks! That worked for me. Not sure what the root cause was, maybe an Xcode update
    – Rajiv
    Commented Jul 25, 2018 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .