bugGNUstep - Bugs: bug #38189, gnustep make fails to detect...

Group
 
 

bug #38189: gnustep make fails to detect thread support with libobjc2/clang on openbsd

Submitter:  Sebastian Reitenbach <buzzdee>
Submitted:  Tue 29 Jan 2013 09:57:26 AM UTC
   
 
Category:  Makefiles Severity:  3 - Normal
Item Group:  Bug Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 18 Mar 2015 08:38:11 AM UTC, comment #2: 

No response from the original poster since almost a year, I consider the bug as obsoleted.

Riccardo Mottola <rmottola>
Group Member
Tue 27 May 2014 10:34:35 AM UTC, comment #1: 

Is this still valid with current gnustep and OpenBSD?

Riccardo Mottola <rmottola>
Group Member
Tue 29 Jan 2013 09:57:26 AM UTC, original submission:  

I'm on OpenBSD 5.2 -current. There it seems that gnustep-make (1.6.2 release and SVN) doesn't detect that the libobjc2 supports threading.

Using libobjc2 from svn, and llvm/clang 3.2.

So far this is what I researched:


I found in the beginning, the configure script sets the: OBJC_RUNTIME_LIB=gnu,
due to ac_cv_library_combo=gnu-gnu-gnu

then later it is setting:
CFLAGS="$CFLAGS -fgnu-runtime -DGNU_RUNTIME"

CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS"
if test "$OBJC_RUNTIME_LIB" = "gnu"; then
  CFLAGS="$CFLAGS -fgnu-runtime -DGNU_RUNTIME"
  if test "$OBJC_FINAL_LIB_FLAG" = ""; then
    OBJC_FINAL_LIB_FLAG=-lobjc
  fi
  OBJCRT="$OBJC_FINAL_LIB_FLAG"
fi


then, when it comes to test for thread support in the objc runtime, it uses the config_thread.m test program and fails:

/* Test whether Objective-C runtime was compiled with thread support */

#ifdef GNU_RUNTIME
/* Dummy NXConstantString impl for so libobjc that doesn't include it */
#include <objc/NXConstStr.h>
@implementation NXConstantString
@end
#endif

#ifdef GNU_RUNTIME
#include <objc/thr.h>
#else
#include <pthread.h>
void *dummy_thread_function(void *dummy)
{
  pthread_exit(NULL);
}
#endif

#include <objc/Object.h>

int
main()
{
#ifdef GNU_RUNTIME
  id o = [Object new];

  return (objc_thread_detach (@selector(hash), o, nil) == NULL) ? -1 : 0;
#else

  /* On Apple, there is no ObjC-specific thread library.  We need to
   * use pthread directly.
   */
  pthread_t thread_id;
  int error = pthread_create (&thread_id, NULL, dummy_thread_function, NULL);

  if (error != 0)
    {
      return -1;
    }

  return 0;

#endif
}

clang -o conftest -O2 -pipe -g -x objective-c -I.   -fgnu-runtime -DGNU_RUNTIME -I/usr/local/include/gnustep -L/usr/local/lib ./config_thread.m -lobjc2  -pthread

$ clang -o conftest -O2 -pipe -g -x objective-c -I.   -fgnu-runtime -DGNU_RUNTIME -I/usr/local/include/gnustep -L/usr/local/lib ./config_thread.m -lobjc2  -pthread
./config_thread.m:6:17: warning: incomplete implementation [-Wincomplete-implementation]
@implementation NXConstantString
                ^
/usr/include/objc/NXConstStr.h:43:1: note: method definition for 'cString' not found                                                                                                                                                                                  
-(const char *) cString;
^
/usr/include/objc/NXConstStr.h:44:1: note: method definition for 'length' not found                                                                                                                                                                                   
-(unsigned int) length;
^
In file included from ./config_thread.m:20:                                                                                                                                                                                                                           
In file included from /usr/local/include/gnustep/objc/Object.h:1:
In file included from /usr/local/include/gnustep/objc/runtime.h:211:
/usr/local/include/gnustep/objc/message.h:40:6: warning: incompatible redeclaration of library function 'objc_msgSend_stret'
void objc_msgSend_stret(id self, SEL _cmd, ...);
     ^
/usr/local/include/gnustep/objc/message.h:40:6: note: 'objc_msgSend_stret' is a builtin with type 'id (id, SEL, ...)'                                                                                                                                                 
In file included from ./config_thread.m:20:
In file included from /usr/local/include/gnustep/objc/Object.h:1:
/usr/local/include/gnustep/objc/runtime.h:254:1: error: unknown type name 'Method_t'
Method * class_copyMethodList(Class cls, unsigned int *outCount);
^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:280:1: error: unknown type name 'Method_t'                                                                                                                                                                                  
Method class_getClassMethod(Class aClass, SEL aSelector);
^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:294:1: error: unknown type name 'Method_t'                                                                                                                                                                                  
Method class_getInstanceMethod(Class aClass, SEL aSelector);
^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:448:31: error: unknown type name 'Method_t'                                                                                                                                                                                 
char* method_copyArgumentType(Method method, unsigned int index);
                              ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:454:29: error: unknown type name 'Method_t'                                                                                                                                                                                 
char* method_copyReturnType(Method method);
                            ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:461:37: error: unknown type name 'Method_t'                                                                                                                                                                                 
void method_exchangeImplementations(Method m1, Method m2);
                                    ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:461:48: error: unknown type name 'Method_t'                                                                                                                                                                                 
void method_exchangeImplementations(Method m1, Method m2);
                                               ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:470:29: error: unknown type name 'Method_t'                                                                                                                                                                                 
void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len);
                            ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:475:30: error: unknown type name 'Method_t'                                                                                                                                                                                 
IMP method_getImplementation(Method method);
                             ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:484:20: error: unknown type name 'Method_t'                                                                                                                                                                                 
SEL method_getName(Method method);
                   ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:490:38: error: unknown type name 'Method_t'                                                                                                                                                                                 
unsigned method_getNumberOfArguments(Method method);
                                     ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:499:27: error: unknown type name 'Method_t'                                                                                                                                                                                 
void method_getReturnType(Method method, char *dst, size_t dst_len);
                          ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:506:37: error: unknown type name 'Method_t'                                                                                                                                                                                 
const char * method_getTypeEncoding(Method method);
                                    ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:513:30: error: unknown type name 'Method_t'                                                                                                                                                                                 
IMP method_setImplementation(Method method, IMP imp);
                             ^
/usr/local/include/gnustep/objc/runtime.h:132:17: note: expanded from macro 'Method'                                                                                                                                                                                  
#       define Method Method_t
                      ^
/usr/local/include/gnustep/objc/runtime.h:772:34: warning: declaration of 'struct objc_super' will not be visible outside of this function [-Wvisibility]                                                                                                             
IMP objc_msg_lookup_super(struct objc_super*, SEL) OBJC_NONPORTABLE;
                                 ^
In file included from ./config_thread.m:20:                                                                                                                                                                                                                           
In file included from /usr/local/include/gnustep/objc/Object.h:1:
In file included from /usr/local/include/gnustep/objc/runtime.h:1036:
/usr/local/include/gnustep/objc/runtime-deprecated.h:75:16: warning: attribute declaration must precede definition [-Wignored-attributes]
_attribute_((deprecated))
               ^
/usr/include/objc/objc.h:58:1: note: previous definition is here                                                                                                                                                                                                      
sel_eq (SEL s1, SEL s2)
^
In file included from ./config_thread.m:20:                                                                                                                                                                                                                           
/usr/local/include/gnustep/objc/Object.h:3:1: error: duplicate interface definition for class 'Object'
@interface Object
^
/usr/include/objc/Object.h:41:12: note: previous definition is here                                                                                                                                                                                                   
@interface Object
           ^
4 warnings and 15 errors generated.                                                                                                                                                                                                                                   
$



Here, when I run the same thing, but without the -DGNU_RUNTIME, the test program seems to work:


$ clang -o conftest -O2 -pipe -g -x objective-c -I.   -fgnu-runtime -I/usr/local/include/gnustep -L/usr/local/lib ./config_thread.m -lobjc2  -pthread              
In file included from ./config_thread.m:20:
In file included from /usr/local/include/gnustep/objc/Object.h:1:
In file included from /usr/local/include/gnustep/objc/runtime.h:211:
/usr/local/include/gnustep/objc/message.h:40:6: warning: incompatible redeclaration of library function 'objc_msgSend_stret'
void objc_msgSend_stret(id self, SEL _cmd, ...);
     ^
/usr/local/include/gnustep/objc/message.h:40:6: note: 'objc_msgSend_stret' is a builtin with type 'id (id, SEL, ...)'                                                                                                                                                 
1 warning generated.

I'm unsure what the best approach would be here.

Sebastian

Sebastian Reitenbach <buzzdee>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rmottola (Posted a comment)
  • -email is unavailable- added by buzzdee (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-18 rmottola StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code