I have an app that runs just fine on the simulator. However, it fails to build on the device, with a very unhelpful error message:
Command /Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
"Unrolling" the build output reveals a bit more information:
/var/folders/sj/_9x5rtbj59bb6wqhgy_ydlxr0000gn/T/cc-jCp4JC.s:703:bad instruction `lock'
/var/folders/sj/_9x5rtbj59bb6wqhgy_ydlxr0000gn/T/cc-jCp4JC.s:704:bad instruction `xaddl r1,(r0)'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Command /Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
So it seems the assembler phase of the llvm compiler was fed a corrupt source file. That source file was the output of the compiler:
/Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x c++ -arch armv7 -miphoneos-version-min=4.3 -c /Development/KommerceiPadEtape3/$KLIB/Source/KRefCount.cpp -o $BUILD/Objects-normal/armv7/KRefCount.o
(where I have obviously omitted or shortened a number of argument de clang).
To really get to the assembly source file, I re-ran the compiler command line adding the -v option a suggested by Xcode. This led to an output that also included:
-coverage-file /var/folders/sj/_9x5rtbj59bb6wqhgy_ydlxr0000gn/T/cc-JuRpTO.s
(yes the intermediary files seem to change names each time).
In my mind (but who am I to trust my mind), if the compiler silently emitted bad assembly code, it can only be a compiler bug.
Did I miss something? Is there anything worth trying or investigating? Note that this is C++ source code.
Thanks a lot.
Jean-Denis
PS: I get the same behavior with Xcode 4.1.
For the sake of it, here is the full Xcode build output for that file:
CompileC /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/Objects-normal/armv7/KRefCount.o KommerceiPadEtape3/KLib/Source/KRefCount.cpp
normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Development/KommerceiPadEtape3
setenv LANG en_US.US-ASCII
setenv PATH "/Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin:/Xcode4.2/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
/Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type
-Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-shorten-64-to-32 -Wc++0x-extensions -DDEBUG -isysroot /Xcode4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -gdwarf-2 -fvisibility-inlines-hidden -Wno-sign-conversion
-mthumb -miphoneos-version-min=4.3 -iquote /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/KommerceiPadEtape3-generated-files.hmap
-I/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/KommerceiPadEtape3-own-target-headers.hmap -I/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/KommerceiPadEtape3-all-target-headers.hmap
-iquote /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/KommerceiPadEtape3-project-headers.hmap -I/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Products/Debug-iphoneos/include
-IKommerceiPadEtape3/KLib -IKommerceiPadEtape3/KLib/Include -IKommerceiPadEtape3/KLib/Source -IKommerceiPadEtape3/KLib/Include/Db -IKommerceiPadEtape3/KLib/Include/gdiplus -IKommerceiPadEtape3/KLib/Include/Kdb -IKommerceiPadEtape3/KLib/Include/Record -IKommerceiPadEtape3/KLib/Include/Rep
-IKommerceiPadEtape3/KLib/Include/Shared -IKommerceiPadEtape3/KLib/Include/SystemRecord -IKommerceiPadEtape3/KLib/Include/SystemTable -IKommerceiPadEtape3/KLib/Include/Table -IKommerceiPadEtape3/KLib/Source/Db -IKommerceiPadEtape3/KLib/Source/Kdb -IKommerceiPadEtape3/KLib/Source/Record
-IKommerceiPadEtape3/KLib/Source/Rep -IKommerceiPadEtape3/KLib/Source/SystemRecord -IKommerceiPadEtape3/KLib/Source/SystemTable -IKommerceiPadEtape3/KLib/Source/Table -IKommerceiPadEtape3/KLib/Source/Kdb/Sqlite -IKommerceiPadEtape3/WinLib -IKommerceiPadEtape3/WinLib/GDIPlus
-IKommerceiPadEtape3/KLib/include -IKommerceiPadEtape3/KLib/include/Db -IKommerceiPadEtape3/KLib/include/gdiplus -IKommerceiPadEtape3/KLib/include/Kdb -IKommerceiPadEtape3/KLib/include/Record -IKommerceiPadEtape3/KLib/include/Rep -IKommerceiPadEtape3/KLib/include/Shared
-IKommerceiPadEtape3/KLib/include/SystemRecord -IKommerceiPadEtape3/KLib/include/SystemTable -IKommerceiPadEtape3/KLib/include/Table -IKommerceiPadEtape3/KLib/include/Kdb -I/Xcode4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/include -I/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/DerivedSources/armv7
-I/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/DerivedSources -F/Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Products/Debug-iphoneos
-include /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/PrecompiledHeaders/KommerceiPadEtape3-Prefix-afsgtmyrzqzjgaawplimihusetwu/KommerceiPadEtape3-Prefix.pch -MMD -MT dependencies -MF /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/Objects-normal/armv7/KRefCount.d
-c /Development/KommerceiPadEtape3/KommerceiPadEtape3/KLib/Source/KRefCount.cpp -o /Users/jdmuys/Library/Developer/Xcode/DerivedData/KommerceiPadEtape3-bhkgahdowrrdyefpoornbknjvapf/Build/Intermediates/KommerceiPadEtape3.build/Debug-iphoneos/KommerceiPadEtape3.build/Objects-normal/armv7/KRefCount.o
/var/folders/sj/_9x5rtbj59bb6wqhgy_ydlxr0000gn/T/cc-jCp4JC.s:703:bad instruction `lock'
/var/folders/sj/_9x5rtbj59bb6wqhgy_ydlxr0000gn/T/cc-jCp4JC.s:704:bad instruction `xaddl r1,(r0)'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Command /Xcode4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
|