Recent

Author Topic: XCode 5 - Using Apple LLVM compiler  (Read 13906 times)

Daniello

  • Jr. Member
  • **
  • Posts: 64
XCode 5 - Using Apple LLVM compiler
« on: October 31, 2013, 01:01:18 pm »
So, in XCode 5, Apple removed GCC support. And now I can't compile anything with the LLVM compiler...
It gives out dozens of errors, related to unsupported instructions. Anyone knows how to fix this?

Some samples of the errors:
/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:186:2: error: invalid instruction
 streqb r0,[r7, #-28]
 ^
/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:460:2: error: invalid instruction
 fstmiad r12,{d8}
 ^
/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:480:2: error: invalid instruction
 fldmiad r12,{d8}
 ^
/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:496:2: error: invalid instruction
 fstmiad r12,{d8}
 ^

Laksen

  • Hero Member
  • *****
  • Posts: 617
    • J-Software
Re: XCode 5 - Using Apple LLVM compiler
« Reply #1 on: October 31, 2013, 02:59:31 pm »
What command line did you use to compile it with?

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #2 on: October 31, 2013, 03:13:18 pm »
What command line did you use to compile it with?

I did not use command line directly, I am compiling inside XCode.
Here is the command XCode executed for one of my files:

   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x assembler-with-cpp -arch armv7 -fmessage-length=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fstrict-aliasing -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -miphoneos-version-min=5.1 -iquote "/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Minimon Quest-generated-files.hmap" "-I/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Minimon Quest-own-target-headers.hmap" "-I/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Minimon Quest-all-target-headers.hmap" -iquote "/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Minimon Quest-project-headers.hmap" -I/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Products/Optimized-iphoneos/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources/armv7 -I/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources -F/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Products/Optimized-iphoneos -MMD -MT dependencies -MF /Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Objects-normal/armv7/TERRA_Vector2D.d --serialize-diagnostics /Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Objects-normal/armv7/TERRA_Vector2D.dia -c /Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s -o /Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/Objects-normal/armv7/TERRA_Vector2D.o

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #3 on: October 31, 2013, 03:14:36 pm »
Some more errors (I am only posting two, but there are like 20 or more of each):

/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:441:2: error: instruction 'fcvtd' can not set flags, but 's' suffix specified
 fcvtds d0,s23


/Users/Mac/Library/Developer/Xcode/DerivedData/Minimon-drqjgxjvaikmvaeypuktpvwscmzt/Build/Intermediates/Minimon.build/Optimized-iphoneos/Minimon.build/DerivedSources-normal/armv7/TERRA_Vector2D.s:954:19: error: unexpected token in '.section' directive
.section .section __TEXT,__symbol_stub4,symbol_stubs,none,12

Laksen

  • Hero Member
  • *****
  • Posts: 617
    • J-Software
Re: XCode 5 - Using Apple LLVM compiler
« Reply #4 on: October 31, 2013, 04:27:26 pm »
What architecture did you compile for with freepascal?

fcvtds is a valid instruction in pre-UAL syntax, so it's probably a bug in the assembler unless of course it defaults to UAL syntax

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #5 on: October 31, 2013, 04:29:28 pm »
I compiled for arm7 only, using FPC 2.6.2
Is there a switch in FPC to enabled/disable that UAL sintax?

Laksen

  • Hero Member
  • *****
  • Posts: 617
    • J-Software
Re: XCode 5 - Using Apple LLVM compiler
« Reply #6 on: October 31, 2013, 04:36:18 pm »
No, currently UAL is only used for Thumb2 code which is only generated for ARMv7M. And that does not work for iPhone.

But try to set the architecture to armv7a instead of armv7. I'm only guessing here...

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #7 on: October 31, 2013, 04:42:50 pm »
No, it does not work at all with arm7a.
I am willing to pay 100$ if someone can make my game compile in latest XCode/FPC.
Is there any place where I can put an ad for this or something?

Laksen

  • Hero Member
  • *****
  • Posts: 617
    • J-Software
Re: XCode 5 - Using Apple LLVM compiler
« Reply #8 on: October 31, 2013, 04:58:29 pm »
You could just write a bugreport, wait a bit, and maybe write on the mac pascal mailing list.

Converting all floating point instructions in fpc to use UAL syntax will probably take a little while. The next best bet is to get the LLVM assembler to accept the pre-UAL syntax.

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #9 on: October 31, 2013, 05:00:20 pm »
Yeah, I will write on the mailing list. This is strange, because I am sure that there are already people using Xcode 5 and FPC

momor

  • Newbie
  • Posts: 4
Re: XCode 5 - Using Apple LLVM compiler
« Reply #10 on: August 19, 2014, 11:05:10 pm »
Hey, by chance - did you have any luck with a fix for this issue ?

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #11 on: August 19, 2014, 11:14:49 pm »
Hi Momor, actually I am using latest xcode with FPC, and thus using LLVM to compile.
But sadly I did not found an actual fix to this, rather than using a different FPC version to compile.

I am not in my Mac now, but I can later check what version I have that works (I have 3 versions installed).

Daniello

  • Jr. Member
  • **
  • Posts: 64
Re: XCode 5 - Using Apple LLVM compiler
« Reply #12 on: August 19, 2014, 11:26:46 pm »
Ah, wait, sorry my memory is hazy, there is indeed a fix, Jonas from FPC told me to use clang's -no-integrated-as parameter. It fixes the problem  ;)

momor

  • Newbie
  • Posts: 4
Re: XCode 5 - Using Apple LLVM compiler
« Reply #13 on: August 20, 2014, 09:56:12 am »
Thanks for your reply dude !

Since my memory is a bit lost in these settings - where shall I define this clang parameter ?