bjnspy / metasyntactic

Automatically exported from code.google.com/p/metasyntactic
Apache License 2.0
1 stars 0 forks source link

Build issues with Xcode 4.2 #139

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I just upgraded to the latest (last?) version of Xcode and I'm having problems 
compiling some code that worked perfectly before. It's not my code - it is the 
ObjC version of ProtocolBuffers - so I'm not 100% certain of the function of 
these sections.

The first error:

@property Class extendedClass;

gave these errors:

No 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
Default property attribute 'assign' not appropriate for non-gc object

I fixed it like this, is this correct?

@property (assign) Class extendedClass; // Added (assign)

However, the next one I have no idea about:
id<PBMessage_Builder> builder = [messageOrGroupClass builder];

Where...
  Class messageOrGroupClass;

The error is:

Initializing 'id<PBMessage_Builder>' with an expression of incompatible type 
'PBUnknownFieldSet_Builder *'

Any ideas on how to fix this?

Original issue reported on code.google.com by hoc...@gmail.com on 5 Oct 2011 at 7:06

GoogleCodeExporter commented 8 years ago
I think this should be a high priority. The code simply does not compile with 
Xcode 4.2 - iOS 5 GM.

Original comment by hoc...@gmail.com on 6 Oct 2011 at 4:46

GoogleCodeExporter commented 8 years ago
If you can figure out what's up, i'm happy to try to fix things.  As it is, my 
macbook is currently broken and needs to be repaired, so it will be a while 
before i can get around to this.  Cheers!

Original comment by cyrus.na...@gmail.com on 6 Oct 2011 at 7:50

GoogleCodeExporter commented 8 years ago
Xcode 4.2 uses LLVM 3.0 as the default compiler. And it seems that the default 
configuration treats some issues detected by the static analyzer as 
compile-time errors instead of warnings.

Here is a diff to fix the semantic issues:

Index: objectivec/Classes/ConcreteExtensionField.m
===================================================================
--- objectivec/Classes/ConcreteExtensionField.m (revision 4426)
+++ objectivec/Classes/ConcreteExtensionField.m (working copy)
@@ -15,14 +15,14 @@
 #import "ConcreteExtensionField.h"

 @interface PBConcreteExtensionField()
-@property PBExtensionType type;
-@property Class extendedClass;
-@property int32_t fieldNumber;
+@property (assign) PBExtensionType type;
+@property (assign) Class extendedClass;
+@property (assign) int32_t fieldNumber;
 @property (retain) id defaultValue;
-@property Class messageOrGroupClass;
-@property BOOL isRepeated;
-@property BOOL isPacked;
-@property BOOL isMessageSetWireFormat;
+@property (assign) Class messageOrGroupClass;
+@property (assign) BOOL isRepeated;
+@property (assign) BOOL isPacked;
+@property (assign) BOOL isMessageSetWireFormat;
 @end

 @implementation PBConcreteExtensionField
@@ -149,6 +149,8 @@
     case PBExtensionTypeSFixed64:
     case PBExtensionTypeDouble:
       return 8;
+    default:
+      break;
   }

   @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil];
@@ -490,14 +492,14 @@
     case PBExtensionTypeEnum:     return [NSNumber numberWithInt:[input readEnum]];
     case PBExtensionTypeGroup:
     {
-      id<PBMessage_Builder> builder = [messageOrGroupClass builder];
+      id<PBMessage_Builder> builder = 
(id<PBMessage_Builder>)[messageOrGroupClass builder];
       [input readGroup:fieldNumber builder:builder extensionRegistry:extensionRegistry];
       return [builder build];
     }

     case PBExtensionTypeMessage:
     {
-      id<PBMessage_Builder> builder = [messageOrGroupClass builder];
+      id<PBMessage_Builder> builder = 
(id<PBMessage_Builder>)[messageOrGroupClass builder];
       [input readMessage:builder extensionRegistry:extensionRegistry];
       return [builder build];
     }

Original comment by klaz...@gmail.com on 10 Oct 2011 at 5:56

GoogleCodeExporter commented 8 years ago
I had the same issue. I found that it was caused by the "Treat Warnings as 
Errors" flag being set. I don't like switching it, but there was no other way 
around it for me yet.

Original comment by swgil...@gmail.com on 21 Nov 2011 at 11:24

GoogleCodeExporter commented 8 years ago
Just to follow up, I have fixed this without needing my previous solution 
(changing warnings as errors).

What it was the default compiler was set to Apple LLVM GCC 4.2. Switching it to 
LLVM GCC 4.2 cleared up my errors I was getting.

Original comment by swgil...@gmail.com on 25 Nov 2011 at 11:49

GoogleCodeExporter commented 8 years ago
I had the same issues, I did what you said but I keep getting two erros: 

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_AreaRequest_Builder", referenced from:
      objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

and:

error: unable to open executable 
'/Users/fmota/Library/Developer/Xcode/DerivedData/PB_final-ehnvnttzdrnixobwoovtt
uyvwdby/Build/Products/Debug-iphonesimulator/PB_final.app/PB_final'

Any ideas or tips you can give me?

Original comment by filipeta...@gmail.com on 6 Jan 2012 at 3:22

GoogleCodeExporter commented 8 years ago
i get the same error at the end.
could it be a problem with arc? because it is not compiled for arc?

Original comment by hasan.gu...@gmail.com on 21 Feb 2012 at 7:21