How to build a openldap library for iphone on OSX? - iphone

I am trying to build openldap-2.4.23 library for iOS3 and 4 but when I try to run configure I get error :
>./configure --disable-slapd --disable-shared --enable-static --host=arm-apple-darwin
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
Configuring OpenLDAP 2.4.23-Release ...
checking build system type... i686-apple-darwin10.7.0
checking host system type... arm-apple-darwin
checking target system type... arm-apple-darwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking configure arguments... configure: WARNING: slapd disabled, ignoring --enable- bdb argument
configure: WARNING: slapd disabled, ignoring --enable-hdb argument
configure: WARNING: slapd disabled, ignoring --enable-monitor argument
configure: WARNING: slapd disabled, ignoring --enable-relay argument
configure: WARNING: slapd disabled, ignoring --enable-syncprov argument
done
checking for style of include used by make... GNU
checking for arm-apple-darwin-gcc... /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See `config.log' for more details.
My env settings are like this :
export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"
export SDKROOT="/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk"
export CC="${DEVROOT}/usr/bin/gcc"
export LD="${DEVROOT}/usr/bin/ld"
export AR="${DEVROOT}/usr/bin/ar"
export AS="${DEVROOT}/usr/bin/as"
export NM="${DEVROOT}/usr/bin/nm"
export CPPFLAGS="-I${SDKROOT}/usr/lib/gcc/arm-apple-darwin10/4.2.1/include -I${SDKROOT}/usr/include"
export CPP="${DEVROOT}/usr/bin/cpp ${CPPFLAGS}"
export CFLAGS="${CPPFLAGS} -arch armv6 -pipe -no-cpp-precomp"
export LDFLAGS="-L${SDKROOT}/usr/lib"
By the way, I succeeded to configure after the CFLAGS and LDFALGS are modified as follows :
export CFLAGS="${CPPFLAGS} -pipe -no-cpp-precomp"
export LDFLAGS=""
However, that results of make & make install are not armv architecture :
> lipo -detailed_info libldap.a
input file libldap.a is not a fat file
Non-fat file: libldap.a is architecture: i386
How can I build armv6 architecture openldap library?
Anyone, please help!!
Thanks.

This may be a little late for you, however I ported OpenLDAP to iOS using Xcode. The project can be cloned from github. https://github.com/bindle/iOSPorts
There is some documentation and examples in the project.

I think I'm one step closer to the solution (it configuration is successful).
I've found similar problem here and simply adjusted build script so it would work on openLDAP.
#!/bin/bash
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
pwd=`pwd`
findLatestSDKVersion()
{
sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
arr=()
for sdk in $sdks
do
arr[${#arr[#]}]=$sdk
done
# Last item will be the current SDK, since it is alpha ordered
count=${#arr[#]}
if [ $count -gt 0 ]; then
sdk=${arr[$count-1]:${#1}}
num=`expr ${#sdk}-4`
SDKVERSION=${sdk:0:$num}
else
SDKVERSION="8.0"
fi
}
buildit()
{
target=$1
hosttarget=$1
platform=$2
echo =============================================================
echo = building for target $target platform $platform ... =
echo =============================================================
if [[ $hosttarget == "x86_64" ]]; then
hostarget="i386"
elif [[ $hosttarget == "arm64" ]]; then
hosttarget="arm"
fi
export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk"
mkdir -p $pwd/output/$target
./configure --disable-shared --host=$hosttarget-apple-darwin --with-tls=openssl --disable-slapd --prefix="$pwd/output-build/common" --exec-prefix="$pwd/output-build/$target"
make depend
# make clean
make
make install
echo =============================================================
echo = Success for target $target platform $platform ... =
echo =============================================================
}
findLatestSDKVersion iPhoneOS
buildit armv7 iPhoneOS
buildit armv7s iPhoneOS
buildit arm64 iPhoneOS
buildit i386 iPhoneSimulator
buildit x86_64 iPhoneSimulator
#LIPO=$(xcrun -sdk iphoneos -find lipo)
#$LIPO -create $pwd/output/armv7/lib/libpresage.a $pwd/output/armv7s/lib/libpresage.a $pwd/output/arm64/lib/libpresage.a $pwd/output/x86_64/lib/libpresage.a $pwd/output/i386/lib/libpresage.a -output libpresage.a
Problem is that build error is reported (when executing make):
Making all in /Users/maru/Documents/openldap-2c705e4/libraries
Entering subdirectory liblutil
cc -g -O2 -I../../include -I../../include -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -miphoneos-version-min=8.4 -c -o sasl.o sasl.c
sasl.c:26:10: fatal error: 'sasl/sasl.h' file not found
#include <sasl/sasl.h>
^
1 error generated.
make[2]: *** [sasl.o] Error 1
make[1]: *** [all-common] Error 1
make: *** [all-common] Error 1
If I understand documentation o SASL correctly it is not available for iOS. So it looks like I'm one step closer then #alkain, but still didn't find final solution.

Related

platformIO does not show binary sizes on build

I am using VsCode with PlatformIO with a very simple program.
It compiles correctly and produces working elf and hex files.
However, unless pio states that it checkes the sizes it does not output anything.
my configuration is the following
[env:release]
platform = atmelavr
board_build.mcu = atmega168A
board_build.f_cpu = 8000000L
running the build it just outputs:
Processing release (platform: atmelavr)
----------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
HARDWARE: ATMEGA168A 8MHz,
PACKAGES:
- toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> [had to replace link to being allowed to post]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\release\src\HMI.o
Compiling .pio\build\release\src\Oled.o
Compiling .pio\build\release\src\Segment.o
Compiling .pio\build\release\src\main.o
Linking .pio\build\release\firmware.elf
Checking size .pio\build\release\firmware.elf
Building .pio\build\release\firmware.hex
=========================================================== [SUCCESS] Took 1.95 seconds ===========================================================
even with running it with -v it shows not much more information
Processing release (platform: atmelavr; board_build.mcu: atmega168A; board_build.f_cpu: 8000000L)
----------------------------------------------------------------------------------------------------------------------------------------------------HARDWARE: ATMEGA168A 8MHz,
PACKAGES:
- toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> [had to replace link to being allowed to post]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
avr-gcc -o .pio\build\release\src\HMI.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\HMI.c
avr-gcc -o .pio\build\release\src\Oled.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\Oled.c
avr-gcc -o .pio\build\release\src\Segment.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A
-DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\Segment.c
avr-gcc -o .pio\build\release\src\main.o -c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega168A -DF_CPU=8000000L -DPLATFORMIO=50101 -Isrc src\main.c
avr-gcc -o .pio\build\release\firmware.elf -Os -mmcu=atmega168A -Wl,--gc-sections -flto -fuse-linker-plugin .pio\build\release\src\HMI.o .pio\build\release\src\Oled.o .pio\build\release\src\Segment.o .pio\build\release\src\main.o -L.pio\build\release -Wl,--start-group -lm -Wl,--end-group
MethodWrapper(["checkprogsize"], [".pio\build\release\firmware.elf"])
avr-objcopy -O ihex -R .eeprom .pio\build\release\firmware.elf .pio\build\release\firmware.hex
=========================================================== [SUCCESS] Took 1.77 seconds ===========================================================
I am using
PIO extension v2.3.2
PIO Core 5.1.1·Home 3.3.4
platform atmelavr at 3.3.0
Manually calling avr-size from the the downloaded packages correctly shows the info.
Any suggestions how to solve this?
Adding an explicit board config item to the config seems to fix that problem.
[env:release]
platform = atmelavr
board = ATmega168
board_build.mcu = atmega168A
board_build.f_cpu = 8000000L

Compiling perl Net::Interface module on CentOS 8.1 fails

I download the sources and manually tried to compile the perl Net::Interface module. Using CPAN to install the module gives the same error.
wget http://search.cpan.org/CPAN/authors/id/M/MI/MIKER/Net-Interface-1.016.tar.gz
tar xvfz Net-Interface-1.016.tar.gz
cd Net-Interface-1.016
perl Makefile.PL
Now this fails with the below error
checking for getnameinfo... yes
checking whether byte ordering is bigendian... no
checking for uint8_t... yes
checking size of uint8_t... configure: error: cannot compute sizeof (uint8_t)
See `config.log' for more details.
could not open config.h
config.log shows the below error
configure:10128: result: yes
configure:10135: checking size of uint8_t
configure:10437: gcc -o conftest -g -O2 -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib conftest.c >&5
/usr/bin/ld: /tmp/ccXH6miX.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
configure:10440: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
How can I fix this error? config.log seems to suggest to pass "-fPIC" flag but I am not sure how?
Thanks.
/usr/bin/ld: /tmp/ccXH6miX.o: relocation R_X86_64_32 against
`.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
The configure script needs to be run with --enable-shared for some reason (it is not necessary on Ubuntu). The following worked for me in a docker container with CentOS 8:
./configure --enable-shared
perl -I. Makefile.PL
make
sudo make install

Boost.Python Link Error with Python3 and virtualenv

I got the following error when I tried to compile .cpp file with clang++.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I set up Python and boost-python as follows.
Python
I installed Python 3.6.0 using pyenv-virtualenv (via homebrew)
Boost-Python
I used homebrew in Python 3 environment.
$ source activate py36
$ brew install boost-python --with-python3 --without-python
~/.bash_profile
My ~/.bash_profile looks like this:
export PYENV_ROOT="/usr/local/var/pyenv"
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
export CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH:/usr/local/var/pyenv/versions/3.6.0/include/python3.6m/"
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)" ; fi
Test cpp
This is the file I tried to compile and failed (saved as test.cpp).
#define BOOST_PYTHON_STATIC_LIB
#include <boost/python.hpp>
using namespace boost::python;
char const* say(){
return "hello, world";
}
BOOST_PYTHON_MODULE( hello ){
boost::python::def( "say", say );
}
makefile
CC = clang++
INCLUDE = -I`python -c 'from distutils.sysconfig import *; print(get_python_inc())’`
BOOST = -lboost_python3.6 -lboost_serialization
FMATH = -fomit-frame-pointer -fno-operator-names -msse2 -mfpmath=sse -march=native
CFLAGS = -std=c++11 -L/usr/local/lib -O3
CFLAGS_SO = -shared -fPIC -std=c++11 -L/usr/local/lib -O3
LINK = -L/usr/local/Cellar/boost-python/1.64.0/lib/
install:
$(CC) test.cpp -o hello.so $(INCLUDE) $(BOOST) $(LINK) $(FMATH) $(CFLAGS_SO)
Error
make install returns this error.
clang++ test.cpp -o hello.so -I`python -c 'from distutils.sysconfig import *; print(get_python_inc())’` -lboost_python3.6 -lboost_serialization -L/usr/local/Cellar/boost-python/1.64.0/lib/ -fomit-frame-pointer -fno-operator-names -msse2 -mfpmath=sse -march=native -shared -fPIC -std=c++11 -L/usr/local/lib -O3 -v
/bin/sh: command substitution: line 0: unexpected EOF while looking for matching `''
/bin/sh: command substitution: line 1: syntax error: unexpected end of file
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.6.0
ignoring nonexistent directory "-lboost_python3.6"
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
.
/usr/local/var/pyenv/versions/3.6.0/include/python3.6m
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -dylib -arch x86_64 -macosx_version_min 10.12.0 -o hello.so -L/usr/local/Cellar/boost-python/1.64.0/lib/ -L/usr/local/lib /var/folders/rm/qv81g4ss29j_gv1b366rl2080000gp/T/test-16790a.o -lboost_serialization -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
<LINES ARE OMITTED>
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [install] Error 1

Build ICU for 64 bit iOS

I'm trying to move my app to 64 bit arm processors (and 64 bit simulator), and for that I need to recompile the ICU library (49).
After three days I reached the point where the library compiles fine, and the script I'm using puts together various architectures into one (snippet):
# ...
#x86_64
DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneSimulator7.0.sdk
SYSROOT=$SDKROOT
export CFLAGS="-I$SDKROOT/usr/include/ -I./include/ $ICU_FLAGS -arch x86_64 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=7.0 -O3 -DU_HAVE_GCC_ATOMICS=0"
export CXXFLAGS="$CFLAGS"
export CC="$TOOLCHAINSROOT/usr/bin/clang"
export CXX="$TOOLCHAINSROOT/usr/bin/clang++"
export LDFLAGS="-L$SDKROOT/usr/lib/ -isysroot $SDKROOT -Wl,-dead_strip -miphoneos-version-min=7.0"
mkdir -p $BUILDDIR/iosbuild/x86_64
cd $BUILDDIR/iosbuild/x86_64
gnumake clean
sh $ICU_PATH/source/configure --host=arm-apple-darwin --enable-static --disable-shared -with-cross-build=$BUILDDIR/hostbuild --prefix=$BUILDDIR/iosbuild/x86_64 --with-data-packaging=library
gnumake
gnumake clean install
# ...
#x86_64
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicudata
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicudata
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicudata.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicui18n
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicui18n
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicui18n.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicuio
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicuio
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicuio.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicule
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicule
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicule.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libiculx
cd ${BUILDDIR}/iosbuild/x86_64/lib/libiculx
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libiculx.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicutest
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicutest
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicutest.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicutu
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicutu
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicutu.a"
mkdir -p ${BUILDDIR}/iosbuild/x86_64/lib/libicuuc
cd ${BUILDDIR}/iosbuild/x86_64/lib/libicuuc
ar -x "${BUILDDIR}/iosbuild/x86_64/lib/libicuuc.a"
ar -qc ${BUILDDIR}/iosbuild/x86_64/lib/libcombinedicu.a ${BUILDDIR}/iosbuild/x86_64/lib/libicudata/*.o ${BUILDDIR}/iosbuild/x86_64/lib/libicudata/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicuuc/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicui18n/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicuio/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicule/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libiculx/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicutest/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicutu/*.ao ${BUILDDIR}/iosbuild/x86_64/lib/libicuuc/*.ao
# ...
#put them together
lipo -create -arch x86_64 "${BUILDDIR}/iosbuild/x86_64/lib/libcombinedicu.a"
-arch i386 "${BUILDDIR}/iosbuild/i386/lib/libcombinedicu.a"
"${BUILDDIR}/iosbuild/arm64/lib/libcombinedicu.a"
"${BUILDDIR}/iosbuild/armv7s/lib/libcombinedicu.a"
-arch armv7 "${BUILDDIR}/iosbuild/armv7/lib/libcombinedicu.a"
-o "$FRAMEWORK_DIR/Versions/Current/$FRAMEWORK_NAME"
The problem is, when I'm compiling the app from XCode (for the 64 bit simulator), I get the following errors regarding the built ICU framework:
ld: warning: directory not found for option '-F"/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxPro/../BIMxEngine/extern/icu"'
duplicate symbol _OSAtomicIncrement32 in:
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(unistr.ao)
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(mutex.ao)
duplicate symbol _OSAtomicIncrement32Barrier in:
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(unistr.ao)
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(mutex.ao)
duplicate symbol _OSAtomicDecrement32 in:
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(unistr.ao)
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(mutex.ao)
duplicate symbol _OSAtomicDecrement32Barrier in:
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(unistr.ao)
/Users/gliptak/ac/m-220/Sources/VBExplorer/BIMxEngine/extern/icu/ICU.framework/ICU(mutex.ao)
...
ld: 64 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
As far as I can tell the mentioned functions are declared in system headers, and are not inline, so how can this error exist?
Do you have any ideas what I might do wrong?
UPDATE: indeed, those functions are static inline, so they cause the problem. So the question is now how do I avoid duplication?
UPDATE: tried the -std=gnu89 flag for the C compiler, no effect...
Found a solution here (confirmed working building on/for Mavericks). Could also be resolved using SVN trunk of icu4c, since that uses C++11 barriers instead.

xcodebuild not finding gcc 4.2

I am trying to run xcodebuild and I am getting the following error:
2011-12-11 04:42:22.834 xcodebuild[9155:4203] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1" UserInfo=0x4001a61a0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-11 04:42:22.835 xcodebuild[9155:4203] Warning: Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'objective-c'.
Compiler: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2
Reason: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x objective-c -c /dev/null 2>&1
2011-12-11 04:42:22.895 xcodebuild[9155:4203] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1" UserInfo=0x4013cbb80 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-11 04:42:22.900 xcodebuild[9155:4203] Warning: Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2
Reason: /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2 -v -E -dM -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -x c -c /dev/null 2>&1
Any idea why this is? I am guessing that it is because I don't have gcc-4.2 in the following path:
/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Resources/gcc-4.2
as of right now gcc-4.2 is located at usr/bin. The question is how do I redirect it?
This could be be related to your $CC variable in your shell ( it keeps track of your compiler ) you can find more information from jMoody on github
Essentially you need to remove $CC
How did you select the compiler? Go to the Xcode navigator, click on the upmost item, then in the right window on your project (not the target), then Build Settings. U and in the section Build Options you can select the compiler. Usually you can choose between LLVM gcc-4.x and some Apple LLVM x.
Have you used xcode-select to select the version of Xcode you want to use?
Manpage.