Building Wine 1.7.21 fails (Mavericks/10.9.3, GCC 4.8.2)

Questions about Wine on macOS.
Locked
User avatar
Siguza
Level 2
Level 2
Posts: 10
Joined: Fri Jul 04, 2014 12:45 pm

Building Wine 1.7.21 fails (Mavericks/10.9.3, GCC 4.8.2)

Post by Siguza »

Hello everyone

I'm trying to build Wine 1.7.21 on OS X Mavericks 10.9.3 and this is the part where the build fails:

Code: Select all

gcc -m32 -c -o cocoa_app.o cocoa_app.m -I. -I../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
  -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \
  -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith \
  -Wlogical-op -fno-omit-frame-pointer -m32 -I/usr/local/siguza/wine32/include -L/usr/local/siguza/wine32/lib
cc1obj: warning: command line option '-Wignored-qualifiers' is valid for C/C++ but not for ObjC [enabled by default]
In file included from cocoa_app.m:24:0:
cocoa_app.h:144:24: error: unknown type name 'dispatch_block_t'
 void OnMainThreadAsync(dispatch_block_t block);
                        ^
In file included from cocoa_app.m:25:0:
cocoa_event.h:52:19: error: unknown type name 'dispatch_block_t'
 void OnMainThread(dispatch_block_t block);
                   ^
cocoa_app.m: In function '+[WineApplicationController sharedController]':
cocoa_app.m:123:9: warning: implicit declaration of function 'dispatch_once' [-Wimplicit-function-declaration]
         dispatch_once(&once, ^{
         ^
cocoa_app.m:123:30: error: expected expression before '^' token
         dispatch_once(&once, ^{
                              ^
cocoa_app.m: In function '-[WineApplicationController adjustWindowLevels:]':
cocoa_app.m:497:9: error: unknown type name '__block'
         __block NSInteger maxLevel = NSIntegerMin;
         ^
cocoa_app.m:497:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'maxLevel'
         __block NSInteger maxLevel = NSIntegerMin;
                           ^
cocoa_app.m:498:9: error: unknown type name '__block'
         __block NSInteger maxNonfloatingLevel = NSNormalWindowLevel;
         ^
cocoa_app.m:498:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'maxNonfloatingLevel'
         __block NSInteger maxNonfloatingLevel = NSNormalWindowLevel;
                           ^
cocoa_app.m:499:9: error: unknown type name '__block'
         __block WineWindow* prev = nil;
         ^
cocoa_app.m:499:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
         __block WineWindow* prev = nil;
                           ^
cocoa_app.m:530:50: error: expected expression before '^' token
                                       usingBlock:^(id obj, NSUInteger idx, BOOL *stop){
                                                  ^
cocoa_app.m:562:9: warning: 'NSMutableArray' may not respond to '-enumerateObjectsWithOptions:usingBlock:' [enabled by default]
         }];
         ^
cocoa_app.m:562:9: warning: (Messages without a matching method signature [enabled by default]
cocoa_app.m:562:9: warning: will be assumed to return 'id' and accept [enabled by default]
cocoa_app.m:562:9: warning: '...' as arguments.) [enabled by default]
cocoa_app.m:587:63: error: 'maxLevel' undeclared (first use in this function)
                 NSInteger maxLevelForType = window.floating ? maxLevel : maxNonfloatingLevel;
                                                               ^
cocoa_app.m:587:63: note: each undeclared identifier is reported only once for each function it appears in
cocoa_app.m:587:74: error: 'maxNonfloatingLevel' undeclared (first use in this function)
                 NSInteger maxLevelForType = window.floating ? maxLevel : maxNonfloatingLevel;
                                                                          ^
cocoa_app.m: In function '-[WineApplicationController setupObservations]':
cocoa_app.m:1953:32: error: expected expression before '^' token
                     usingBlock:^(NSNotification *note){
                                ^
cocoa_app.m:1957:9: warning: 'NSNotificationCenter' may not respond to '-addObserverForName:object:queue:usingBlock:' [enabled by default]
         }];
         ^
cocoa_app.m:1962:32: error: expected expression before '^' token
                     usingBlock:^(NSNotification *note){
                                ^
cocoa_app.m:1979:9: warning: 'NSNotificationCenter' may not respond to '-addObserverForName:object:queue:usingBlock:' [enabled by default]
         }];
         ^
cocoa_app.m: In function '-[WineApplicationController releaseMouseCapture]':
cocoa_app.m:2037:13: warning: implicit declaration of function 'dispatch_async' [-Wimplicit-function-declaration]
             dispatch_async(dispatch_get_main_queue(), ^{ [self releaseMouseCapture]; });
             ^
cocoa_app.m:2037:55: error: expected expression before '^' token
             dispatch_async(dispatch_get_main_queue(), ^{ [self releaseMouseCapture]; });
                                                       ^
cocoa_app.m: In function 'PerformRequest':
cocoa_app.m:2215:9: error: unknown type name '__block'
         __block dispatch_block_t block;
         ^
cocoa_app.m:2215:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'block'
         __block dispatch_block_t block;
                                  ^
cocoa_app.m:2217:9: warning: implicit declaration of function 'dispatch_sync' [-Wimplicit-function-declaration]
         dispatch_sync(controller->requestsManipQueue, ^{
         ^
cocoa_app.m:2217:55: error: expected expression before '^' token
         dispatch_sync(controller->requestsManipQueue, ^{
                                                       ^
cocoa_app.m:2227:14: error: 'block' undeclared (first use in this function)
         if (!block)
              ^
cocoa_app.m:2230:9: warning: implicit declaration of function 'block' [-Wimplicit-function-declaration]
         block();
         ^
cocoa_app.m:2231:9: warning: invalid receiver type '' [enabled by default]
         [block release];
         ^
cocoa_app.m:2231:9: error: cannot convert to a pointer type
cocoa_app.m: At top level:
cocoa_app.m:2240:24: error: unknown type name 'dispatch_block_t'
 void OnMainThreadAsync(dispatch_block_t block)
                        ^
cocoa_app.m: In function 'macdrv_window_rejected_focus':
cocoa_app.m:2288:5: warning: implicit declaration of function 'OnMainThread' [-Wimplicit-function-declaration]
     OnMainThread(^{
     ^
cocoa_app.m:2288:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_get_input_source_info':
cocoa_app.m:2300:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_beep':
cocoa_app.m:2325:5: warning: implicit declaration of function 'OnMainThreadAsync' [-Wimplicit-function-declaration]
     OnMainThreadAsync(^{
     ^
cocoa_app.m:2325:23: error: expected expression before '^' token
     OnMainThreadAsync(^{
                       ^
cocoa_app.m: In function 'macdrv_set_display_mode':
cocoa_app.m:2336:5: error: '__block' undeclared (first use in this function)
     __block int ret;
     ^
cocoa_app.m:2336:13: error: expected ';' before 'int'
     __block int ret;
             ^
cocoa_app.m:2338:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m:2342:12: error: 'ret' undeclared (first use in this function)
     return ret;
            ^
cocoa_app.m: In function 'macdrv_set_cursor':
cocoa_app.m:2373:27: error: expected expression before '^' token
         OnMainThreadAsync(^{
                           ^
cocoa_app.m:2385:31: error: expected expression before '^' token
             OnMainThreadAsync(^{
                               ^
cocoa_app.m:2391:31: error: expected expression before '^' token
             OnMainThreadAsync(^{
                               ^
cocoa_app.m: In function 'macdrv_get_cursor_position':
cocoa_app.m:2408:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_set_cursor_position':
cocoa_app.m:2425:5: error: '__block' undeclared (first use in this function)
     __block int ret;
     ^
cocoa_app.m:2425:13: error: expected ';' before 'int'
     __block int ret;
             ^
cocoa_app.m:2427:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m:2431:12: error: 'ret' undeclared (first use in this function)
     return ret;
            ^
cocoa_app.m: In function 'macdrv_clip_cursor':
cocoa_app.m:2443:5: error: '__block' undeclared (first use in this function)
     __block int ret;
     ^
cocoa_app.m:2443:13: error: expected ';' before 'int'
     __block int ret;
             ^
cocoa_app.m:2445:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m:2474:12: error: 'ret' undeclared (first use in this function)
     return ret;
            ^
cocoa_app.m: In function 'macdrv_set_application_icon':
cocoa_app.m:2489:23: error: expected expression before '^' token
     OnMainThreadAsync(^{
                       ^
cocoa_app.m:2487:14: warning: unused variable 'imageArray' [-Wunused-variable]
     NSArray* imageArray = (NSArray*)images;
              ^
cocoa_app.m: In function 'macdrv_quit_reply':
cocoa_app.m:2499:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_using_input_method':
cocoa_app.m:2509:5: error: unknown type name '__block'
     __block BOOL ret;
     ^
cocoa_app.m:2509:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ret'
     __block BOOL ret;
                  ^
cocoa_app.m:2511:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m:2515:12: error: 'ret' undeclared (first use in this function)
     return ret;
            ^
cocoa_app.m: In function 'macdrv_set_mouse_capture_window':
cocoa_app.m:2527:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_create_input_source_list':
cocoa_app.m:2543:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m: In function 'macdrv_select_input_source':
cocoa_app.m:2583:5: error: '__block' undeclared (first use in this function)
     __block int ret = FALSE;
     ^
cocoa_app.m:2583:13: error: expected ';' before 'int'
     __block int ret = FALSE;
             ^
cocoa_app.m:2585:18: error: expected expression before '^' token
     OnMainThread(^{
                  ^
cocoa_app.m:2589:12: error: 'ret' undeclared (first use in this function)
     return ret;
            ^
cocoa_app.m: In function 'macdrv_set_display_mode':
cocoa_app.m:2343:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
cocoa_app.m: In function 'macdrv_set_cursor_position':
cocoa_app.m:2432:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
cocoa_app.m: In function 'macdrv_clip_cursor':
cocoa_app.m:2475:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
cocoa_app.m: In function 'macdrv_using_input_method':
cocoa_app.m:2516:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
cocoa_app.m: In function 'macdrv_select_input_source':
cocoa_app.m:2590:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [cocoa_app.o] Error 1
make: *** [dlls/winemac.drv] Error 2
Bash commands used:

Code: Select all

bash$ ./configure --prefix=/usr/local/siguza/wine32 FREETYPE_CFLAGS='-I/usr/local/siguza/wine32/include/freetype2' CFLAGS='-m32 -I/usr/local/siguza/wine32/include -L/usr/local/siguza/wine32/lib' CXXFLAGS='-m32 -I/usr/local/siguza/wine32/include -L/usr/local/siguza/wine32/lib'
bash$ make
Dependencies (all successfully built as shared libraries with --prefix=/usr/local/siguza/wine32 and -m32):
  • freetype 2.5.3
  • harfbuzz 0.9.29
  • jpeg 9a
  • png 1.6.12
  • tiff 4.0.3
  • Xcomposite
  • Xcursor
  • Xi
  • Xinerama
  • Xxf86vm
GCC:

Code: Select all

bash$ gcc --version
gcc (MacPorts gcc48 4.8.2_2+universal) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Did I miss something or am I doing anything wrong?

Regards
Siguza
User avatar
Siguza
Level 2
Level 2
Posts: 10
Joined: Fri Jul 04, 2014 12:45 pm

Re: Building Wine 1.7.21 fails (Mavericks/10.9.3, GCC 4.8.2)

Post by Siguza »

For anyone having the same problem:
I managed to compile it by switching to clang (CC='clang' CXX='clang++'), but I don't understand why that worked, or what's the matter with gcc.
As far as I know, GCC is able to compile Objective-C if it is configured to do so, and it looks to me like the macports gcc is (the command line switch is there and it doesn't say anything about "unsupported").
I also tried things like including frameworks (Cocoa and Carbon), but that didn't change anything, it seemed to me that GCC found those by itself anyway.
Some types or whatever they are ("dispatch_block_t", "__block") seem to be missing/unknown, as well as the "^" operator (or whatever it is in ObjC).
I don't get it.

Regards
Siguza
User avatar
Siguza
Level 2
Level 2
Posts: 10
Joined: Fri Jul 04, 2014 12:45 pm

Re: Building Wine 1.7.21 fails (Mavericks/10.9.3, GCC 4.8.2)

Post by Siguza »

I finally found more information in the topic.

The issue is caused by many of Apple's frameworks making use of the so-called "Blocks" extension to C/C++/Obj-C, which is non-standard and not supported by GCC.
So for anyone like me who prefers GCC over clang, we're out of luck.

Regards
Siguza
Locked