Why is brew not compiling boost correctly? - c++

I'm on Mac OSX Yosemite 10.10.3, and brew install boost is not compiling boost correctly. For example, running
g++ -I/usr/local/Cellar/include -x c++ -E /dev/null -include boost/version.hpp && echo SUCCESS:
gives me
# 1 "/dev/null"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 326 "<built-in>" 3
# 1 "<command line>" 1
In file included from <built-in>:326:
<command line>:1:10: fatal error: 'boost/version.hpp' file not found
#include "boost/version.hpp"
^
# 1 "<built-in>" 2
# 1 "/dev/null" 2
I noticed that the directory structure obtained through Brew installing is substantially different from the one listed here: http://www.boost.org/doc/libs/1_35_0/more/getting_started/unix-variants.html Maybe this doesn't affect anything.

The command should instead be
g++ -I/usr/local/include -x c++ -E /dev/null -include boost/version.hpp && echo SUCCESS

Related

Unable to install tezos-crypto due to compliation error in package tezos-stdlib-unix

I am trying to install the library tezos-crypto using Opam on Kubuntu 20.04. I am getting the following error:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of tezos-stdlib-unix failed at "/home/marc/.opam/opam-init/hooks/sandbox.sh build dune build -p
tezos-stdlib-unix -j 15".
#=== ERROR while compiling tezos-stdlib-unix.10.2 =============================#
# context 2.0.5 | linux/x86_64 | ocaml-base-compiler.4.11.1 | https://opam.ocaml.org#e0171a79
# path ~/.opam/default/.opam-switch/build/tezos-stdlib-unix.10.2
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p tezos-stdlib-unix -j 15
# exit-code 1
# env-file ~/.opam/log/tezos-stdlib-unix-69301-e0ba4f.env
# output-file ~/.opam/log/tezos-stdlib-unix-69301-e0ba4f.out
### output ###
# [...]
# (cd _build/default && /home/marc/.opam/default/bin/ocamlc.opt -w -40 -open Tezos_error_monad -open Tezos_error_monad.TzLwtreslib -open Tezos_event_logging -open Tezos_stdlib -open Data_encoding -g -bin-annot -I src/lib_stdlib_unix/.tezos_stdlib_unix.objs/byte -I /home/marc/.opam/default/lib/angstrom -I /home/marc/.opam/default/lib/astring -I /home/marc/.opam/default/lib/base -I /home/marc/.op[...]
# File "src/lib_stdlib_unix/file_descriptor_sink.ml", line 116, characters 16-24:
# 116 | Fmt.strf "%s-%d%s" chopped (Unix.getpid ()) ext
# ^^^^^^^^
# Alert deprecated: Fmt.strf
# use Fmt.str instead.
# (cd _build/default && /home/marc/.opam/default/bin/ocamlopt.opt -w -40 -open Tezos_error_monad -open Tezos_error_monad.TzLwtreslib -open Tezos_event_logging -open Tezos_stdlib -open Data_encoding -g -I src/lib_stdlib_unix/.tezos_stdlib_unix.objs/byte -I src/lib_stdlib_unix/.tezos_stdlib_unix.objs/native -I /home/marc/.opam/default/lib/angstrom -I /home/marc/.opam/default/lib/astring -I /home/[...]
# File "src/lib_stdlib_unix/file_descriptor_sink.ml", line 116, characters 16-24:
# 116 | Fmt.strf "%s-%d%s" chopped (Unix.getpid ()) ext
# ^^^^^^^^
# Alert deprecated: Fmt.strf
# use Fmt.str instead.
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build tezos-stdlib-unix 10.2
└─
╶─ No changes have been performed
How can I resolve this error?

Problem at building conf-pkg-config 2 when installing tsdl with opam on windows 64

I get this error when installing tsdl for my caml project:
#=== ERROR while compiling conf-pkg-config.2 ==================================#
# context 2.0.8 | win32/x86_64 | ocaml-variants.4.11.1+mingw64c | git+https:
//github.com/fdopen/opam-repository-mingw.git#opam2
# path ~/.opam/4.11.1+mingw64c/.opam-switch/build/conf-pkg-config.2
# command dash.exe -ec pkg-config --help
# exit-code 127
# env-file ~/.opam/log/conf-pkg-config-1212-9b8556.env
# output-file ~/.opam/log/conf-pkg-config-1212-9b8556.out
### output ###
# dash: 1: pkg-config: not found
In the error message you have:
# dash: 1: pkg-config: not found
Have you tried
sudo apt install pkg-config

How to compile caffe_rtpose on OSX?

I've recently bumped spotted caffe_rtpose and I tried to compile and run the example. Unfortunately I'm super experienced with c++ so I ran into a lot of issues compiling and linking.
I've tried tweaking the Makefile config (modified from the existing Ubuntu config). (I'm using a system running OSX 10.11.5 with an nVidia GeForce 750M and I have installed CUDA 7.5 and libcudnn):
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0
# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
# You should not set this flag if you will be reading LMDBs with any
# possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1
# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3
# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++
# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_50,code=compute_50 \
-gencode arch=compute_52,code=sm_52 \
# -gencode arch=compute_60,code=sm_60 \
# -gencode arch=compute_61,code=sm_61
# Deprecated
#CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
# -gencode arch=compute_20,code=sm_21 \
# -gencode arch=compute_30,code=sm_30 \
# -gencode arch=compute_35,code=sm_35 \
# -gencode arch=compute_50,code=sm_50 \
# -gencode arch=compute_50,code=compute_50
# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas
# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib
BLAS_INCLUDE := /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers/
BLAS_LIB := /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A
# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
# ANACONDA_HOME := $(HOME)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
# $(ANACONDA_HOME)/include/python2.7 \
# $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib
# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib
# Uncomment to support layers written in Python (will link against Python libs)
# WITH_PYTHON_LAYER := 1
# Whatever else you find you need goes here.
# INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
# LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib
# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1
# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0
# enable pretty build (comment to see full commands)
# Q ?= #
And this is the modified version of the install_caffe_and_cpm_osx.sh script:
#!/bin/bash
echo "------------------------- INSTALLING CAFFE AND CPM -------------------------"
echo "NOTE: This script assumes that CUDA and cuDNN are already installed on your machine. Otherwise, it might fail."
function exitIfError {
if [[ $? -ne 0 ]] ; then
echo ""
echo "------------------------- -------------------------"
echo "Errors detected. Exiting script. The software might have not been successfully installed."
echo "------------------------- -------------------------"
exit 1
fi
}
# echo "------------------------- Checking Ubuntu Version -------------------------"
# ubuntu_version="$(lsb_release -r)"
# echo "Ubuntu $ubuntu_version"
# if [[ $ubuntu_version == *"14."* ]]; then
# ubuntu_le_14=true
# elif [[ $ubuntu_version == *"16."* || $ubuntu_version == *"15."* || $ubuntu_version == *"17."* || $ubuntu_version == *"18."* ]]; then
# ubuntu_le_14=false
# else
# echo "Ubuntu release older than version 14. This installation script might fail."
# ubuntu_le_14=true
# fi
# exitIfError
# echo "------------------------- Ubuntu Version Checked -------------------------"
# echo ""
echo "------------------------- Checking Number of Processors -------------------------"
NUM_CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
echo "$NUM_CORES cores"
exitIfError
echo "------------------------- Number of Processors Checked -------------------------"
echo ""
echo "------------------------- Installing some Caffe Dependencies -------------------------"
# Basic
# sudo apt-get --assume-yes update
# sudo apt-get --assume-yes install build-essential
#General dependencies
brew install protobuf leveldb snappy hdf5
# with Python pycaffe needs dependencies built from source - from http://caffe.berkeleyvision.org/install_osx.html
# brew install --build-from-source --with-python -vd protobuf
# brew install --build-from-source -vd boost boost-python
# without Python the usual installation suffices
brew install boost
# sudo apt-get --assume-yes install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
# sudo apt-get --assume-yes install --no-install-recommends libboost-all-dev
# Remaining dependencies, 14.04
brew install gflags glog lmdb
# if [[ $ubuntu_le_14 == true ]]; then
# sudo apt-get --assume-yes install libgflags-dev libgoogle-glog-dev liblmdb-dev
# fi
# OpenCV 2.4
# sudo apt-get --assume-yes install libopencv-dev
exitIfError
echo "------------------------- Some Caffe Dependencies Installed -------------------------"
echo ""
echo "------------------------- Compiling Caffe & CPM -------------------------"
cp Makefile.config.OSX.10.11.5.example Makefile.config
make all -j$NUM_CORES
# make test -j$NUM_CORES
# make runtest -j$NUM_CORES
exitIfError
echo "------------------------- Caffe & CPM Compiled -------------------------"
echo ""
# echo "------------------------- Installing CPM -------------------------"
# echo "Compiled"
# exitIfError
# echo "------------------------- CPM Installed -------------------------"
# echo ""
echo "------------------------- Downloading CPM Models -------------------------"
models_folder="./model/"
# COCO
coco_folder="$models_folder"coco/""
coco_model="$coco_folder"pose_iter_440000.caffemodel""
if [ ! -f $coco_model ]; then
wget http://posefs1.perception.cs.cmu.edu/Users/tsimon/Projects/coco/data/models/coco/pose_iter_440000.caffemodel -P $coco_folder
fi
exitIfError
# MPI
mpi_folder="$models_folder"mpi/""
mpi_model="$mpi_folder"pose_iter_160000.caffemodel""
if [ ! -f $mpi_model ]; then
wget http://posefs1.perception.cs.cmu.edu/Users/tsimon/Projects/coco/data/models/mpi/pose_iter_160000.caffemodel -P $mpi_folder
fi
exitIfError
echo "Models downloaded"
echo "------------------------- CPM Models Downloaded -------------------------"
echo ""
echo "------------------------- CAFFE AND CPM INSTALLED -------------------------"
echo ""
But I get this error:
examples/rtpose/rtpose.cpp:1088:22: error: variable length array of non-POD element type 'Frame'
Frame frame_batch[BATCH_SIZE];
I've tried swapping the array for a vector:
std::vector<Frame> frame_batch;
std::cout << "allocating " << BATCH_SIZE << " frames" << std::endl;
frame_batch.reserve(BATCH_SIZE);
That seems to take care of that compile error, but now I get a linker error:
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've searched for lib lib gomp and found a few related posts on caffe and OpenMP mentioning issues with clang on OSX and OpenMP.
What I tried:
Following this post I've installed gcc 4.9 with homebrew (as the homebrew formula for gcc 5 installs 5.9 which might be too high?)
I've set -fopenmp=libomp based on Andrey Bokhanko's answer: this didn't work for me ++-4.9: error: unrecognized command line option '-fopenmp=libomp'
I could download and build Caffe separately using the official instructions, but I can't seem to figure out how to compile this awesome looking demo.
Unfortunately I'm not experienced with c++ and OpenMP so I could really use your suggestions here. Thank you
Update: I've tried Mark Setchell's helpful suggestion of installing llvm via clang. I've updated the Makefile config to use
CUSTOM_CXX := /usr/local/opt/llvm/bin/clang++
but CUDA doesn't like it:
nvcc fatal : The version ('30801') of the host compiler ('clang') is not supported
I've tried compiling with CPU_ONLY but I still get CUDA errors:
examples/rtpose/rtpose.cpp:235:5: error: use of undeclared identifier 'cudaMalloc'
cudaMalloc(&net_copies[device_id].canvas, DISPLAY_RESOLUTION_WIDTH * DISPLAY_RESOLUTION_HEIGHT * 3 * sizeof(float));
^
examples/rtpose/rtpose.cpp:236:5: error: use of undeclared identifier 'cudaMalloc'
cudaMalloc(&net_copies[device_id].joints, MAX_NUM_PARTS*3*MAX_PEOPLE * sizeof(float) );
^
examples/rtpose/rtpose.cpp:1130:146: error: use of undeclared identifier 'cudaMemcpyHostToDevice'
cudaMemcpy(net_copies[tid].canvas, frame.data_for_mat, DISPLAY_RESOLUTION_WIDTH * DISPLAY_RESOLUTION_HEIGHT * 3 * sizeof(float), cudaMemcpyHostToDevice);
^
examples/rtpose/rtpose.cpp:1136:108: error: use of undeclared identifier 'cudaMemcpyHostToDevice'
cudaMemcpy(pointer + 0 * offset, frame_batch[0].data, BATCH_SIZE * offset * sizeof(float), cudaMemcpyHostToDevice);
^
examples/rtpose/rtpose.cpp:1178:13: error: use of undeclared identifier 'cudaMemcpyHostToDevice'
cudaMemcpyHostToDevice);
^
examples/rtpose/rtpose.cpp:1192:155: error: use of undeclared identifier 'cudaMemcpyDeviceToHost'
cudaMemcpy(frame_batch[n].data_for_mat, net_copies[tid].canvas, DISPLAY_RESOLUTION_HEIGHT * DISPLAY_RESOLUTION_WIDTH * 3 * sizeof(float), cudaMemcpyDeviceToHost);
^
examples/rtpose/rtpose.cpp:1202:155: error: use of undeclared identifier 'cudaMemcpyDeviceToHost'
cudaMemcpy(frame_batch[n].data_for_mat, net_copies[tid].canvas, DISPLAY_RESOLUTION_HEIGHT * DISPLAY_RESOLUTION_WIDTH * 3 * sizeof(float), cudaMemcpyDeviceToHost);
I'm no expert, but having a quick scan through the code, I don't see how the CPU_ONLY version will work with the cuda calls.
Having another look at the caffe OSX Installation guide, I may try the route >not for the faint of heart
I have finally managed to compile the rtpose example.
Here's what I did:
Swapped the Frame array for a vector in examples/rtpose/rtpose.cpp, as mentioned above:
std::vector<Frame> frame_batch;
std::cout << "allocating " << BATCH_SIZE << " frames" << std::endl;
frame_batch.reserve(BATCH_SIZE);
Used the default clang++ compiler, after failed attempts at using gcc++-4.9 and Homebrew installed LLVM's clang++, but removed the -fopenmp flags and the -pthread linker flag, not the compiler flag, based on this answer
After the compile finished, I tried to run it, but got a libjpeg related error:
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libJPEG.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5
The workaround was mdemirst's answer. I made a backup of the old symbolic links just in case though. I did symlink libjpeg/libpng/libtiff/libgif from ImageIO.framework.
I've commited the above config/setup script on github.
Now that the example is compiled, I still can't run it, possibly due to not enough GPU memory:
F0331 02:02:16.231935 528384 syncedmem.cpp:56] Check failed: error == cudaSuccess (2 vs. 0) out of memory
*** Check failure stack trace: ***
# 0x10c7a89da google::LogMessage::Fail()
# 0x10c7a80d5 google::LogMessage::SendToLog()
# 0x10c7a863b google::LogMessage::Flush()
# 0x10c7aba17 google::LogMessageFatal::~LogMessageFatal()
# 0x10c7a8cc7 google::LogMessageFatal::~LogMessageFatal()
# 0x1079481db caffe::SyncedMemory::to_gpu()
# 0x107947c9e caffe::SyncedMemory::mutable_gpu_data()
# 0x1079affba caffe::CuDNNConvolutionLayer<>::Forward_gpu()
# 0x107861331 caffe::Layer<>::Forward()
# 0x107918016 caffe::Net<>::ForwardFromTo()
# 0x1077a86f1 warmup()
# 0x1077b211d processFrame()
# 0x7fff8b11899d _pthread_body
# 0x7fff8b11891a _pthread_start
# 0x7fff8b116351 thread_start
Abort trap: 6
I have tried dimming the settings down as much as possible:
./build/examples/rtpose/rtpose.bin -caffemodel ./model/coco/pose_iter_440000.caffemodel -caffeproto ./model/coco/pose_deploy_linevec.prototxt -camera_resolution "40x30" -camera 0 -resolution "40x30" -start_scale 0.1 -num_scales=0 -no_display true -net_resolution "16x16"
But to no avail. Actually running the example may be another question in itself.

Disable some feauture while building Gstreamer Lib which cause Error?

I'm build gstreamer, at the step of building gstpgood/ext/aalib
The error log is
make[3]: Entering directory `sigma-gstreamer_1-2-rc5/build/gstpgood/ext'
make -C aalib
make[4]: Entering directory `/sigma-gstreamer_1-2-rc5/build/gstpgood/ext/aalib'
CC libgstaasink_la-gstaasink.lo
cc1: error: include location "/usr/include" is unsafe for cross-compilation [-Werror=poison-system-directories]
cc1: all warnings being treated as errors
make[4]: *** [libgstaasink_la-gstaasink.lo] Error 1
My friend build the same source on the other build host did not get this error. I compared gstpgood makefiles and found that my makefile has:
AALIB_CFLAGS = -I/usr/include
AALIB_CONFIG = /usr/bin/aalib-config
AALIB_LIBS = -L/usr/lib/x86_64-linux-gnu -laa
while my friend's make file has
AALIB_CFLAGS =
AALIB_CONFIG = no
AALIB_LIBS =
This aalib is used by aasink, how can i disable aasink when compiling gstreamer???
Pass --disable-aalib to configure before running make. Check ./configure --help for many other things you could disable.
Thank Sebastian Dröge!
I also find a way to bypass aalib check by editing .m4 file in: gstreamer/ext/gstpgood/m4/aalib.m4 it worked for me
#force disable aalibtes by putting enable_aalibtest=no
AC_ARG_ENABLE(aalibtest,
AC_HELP_STRING([--disable-aalibtest],
[do not try to compile and run a test AALIB program]),
, enable_aalibtest=yes)
enable_aalibtest=no
#comment some code
# AC_PATH_PROG(AALIB_CONFIG, aalib-config, no)
# min_aalib_version=ifelse([$1], ,0.11.0,$1)
# AC_MSG_CHECKING(for AALIB - version >= $min_aalib_version)
no_aalib=""
# if test "$AALIB_CONFIG" = "no" ; then
if test x$aalib_prefix == x ; then#add this line
no_aalib=yes
else
AALIB_CFLAGS="-I$aalib_prefix/include"#add this line
AALIB_LIBS="-L$aalib_prefix/lib -laa"#add this line
# AALIB_CFLAGS=`$AALIB_CONFIG $aalibconf_args --cflags`
# AALIB_LIBS=`$AALIB_CONFIG $aalibconf_args --libs`
# aalib_major_version=`$AALIB_CONFIG $aalib_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
# aalib_minor_version=`$AALIB_CONFIG $aalib_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
# aalib_micro_version=`$AALIB_CONFIG $aalib_config_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

LLVM equivalent of gcc -D macro definition on commandline

I am looking for LLVM (or clang) equivalent of gcc's -D flag which enables macro definition at commandline.
Any pointers would be great.
From clang --cc1 --help:
...
-D <macro>=<value> Define <macro> to <value> (or 1 if <value> omitted)
...
As a rule of thumb, assume that Clang emulates GCC, unless proven otherwise!
The default clang invocation is a gcc-like compiler driver, supporting the same options as gcc, including -D:
: ~$ cat test/z.c
int foo() {
return FOOBAR;
}
: ~$ clang -DFOOBAR -E -c test/z.c
# 1 "test/z.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 154 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test/z.c" 2
int foo() {
return 1;
}
So if you want to replace gcc, just invoke clang. clang -cc1 invokes the front-end component of clang, not the generic compiler driver.