Default headers

Kevin Ingwersen ingwie2000@googlemail.com
Wed Dec 11 08:14:00 GMT 2013


Hello there ^^.

I have compiled GCC 4.8.2 and I am prepairing a re-distribution together with some packages. But there is something I noticed: There are no default headers installed. At least not those for Objective C.

So, during compilation, I moved everything into /opt/GNUstep (because I am building it for Mac right now) by using —prefix. And now that I have compiled it, I moved /usr/include to /usr/include-apple in order to „disable“ it, since I want to test the build like it was on a non-developer unit - on which you won’t have the headers.

So, this is what I get.

Ingwie@ingwies-air ~/Work/objc $ which gcc
/opt/GNUstep/bin//gcc
Ingwie@ingwies-air ~/Work/objc $ echo $PATH
/opt/GNUstep/bin/:/opt/GNUstep/usr/local/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Ingwie@ingwies-air ~/Work/objc $ cat win.m
#import <Foundation/Foundation.h>

int main() {
	NSString *str = @"o.o";
	NSLog(@"%@", str);
	return 0;
}
Ingwie@ingwies-air ~/Work/objc $ gcc win.m -o test
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:0,
                 from win.m:1:
/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:23: fatal error: sys/types.h: No such file or directory
 #include <sys/types.h>
                       ^
compilation terminated.


But … if I try to build WITH the default includes folder:

Ingwie@ingwies-air ~/Work/objc $ sudo mv /usr/include-apple/ /usr/include
Ingwie@ingwies-air ~/Work/objc $ gcc win.m -o test
In file included from /usr/include/os/object.h:74:0,
                 from /usr/include/dispatch/dispatch.h:48,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/objc/NSObject.h:21:26: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
 - (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
                          ^
/usr/include/objc/NSObject.h:35:14: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
 - (id)retain OBJC_ARC_UNAVAILABLE;
              ^
/usr/include/objc/NSObject.h:36:24: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
 - (oneway void)release OBJC_ARC_UNAVAILABLE;
                        ^
/usr/include/objc/NSObject.h:37:19: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
 - (id)autorelease OBJC_ARC_UNAVAILABLE;
                   ^
/usr/include/objc/NSObject.h:38:27: error: expected ‘;’ before ‘OBJC_ARC_UNAVAILABLE’
 - (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
                           ^
/usr/include/objc/NSObject.h:48:1: error: unknown type name ‘OBJC_ROOT_CLASS’
 OBJC_ROOT_CLASS
 ^
/usr/include/objc/NSObject.h:50:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘interface’
 @interface NSObject <NSObject> {
 ^
/usr/include/objc/NSObject.h:69:63: error: expected ‘:’ before ‘;’ token
 + (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
                                                               ^
In file included from /usr/include/dispatch/dispatch.h:50:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/object.h:249:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t finalizer);
  ^
In file included from /usr/include/dispatch/dispatch.h:52:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/queue.h:180:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/queue.h:246:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/queue.h:651:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/queue.h:731:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/queue.h:790:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/queue.h:832:17: error: unknown type name ‘dispatch_function_t’
  void *context, dispatch_function_t destructor);
                 ^
In file included from /usr/include/dispatch/dispatch.h:53:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/source.h:405:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t handler);
  ^
/usr/include/dispatch/source.h:464:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t cancel_handler);
  ^
/usr/include/dispatch/source.h:739:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t registration_handler);
  ^
In file included from /usr/include/dispatch/dispatch.h:54:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/group.h:123:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
/usr/include/dispatch/group.h:233:2: error: unknown type name ‘dispatch_function_t’
  dispatch_function_t work);
  ^
In file included from /usr/include/dispatch/dispatch.h:56:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/once.h:79:3: error: unknown type name ‘dispatch_function_t’
   dispatch_function_t function);
   ^
/usr/include/dispatch/once.h:85:3: error: unknown type name ‘dispatch_function_t’
   dispatch_function_t function)
   ^
In file included from /usr/include/dispatch/dispatch.h:57:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from win.m:1:
/usr/include/dispatch/data.h:85:1: error: unknown type name ‘dispatch_function_t’
 DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);
 ^
/usr/include/dispatch/data.h:94:1: error: unknown type name ‘dispatch_function_t’
 DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);
 ^

Any idea what THAT is - or what is wrong with my hdeaders? Are there ways to obtain compatible headers?

Kind regards - Ingwie.


More information about the Gcc-help mailing list